Interrupting casts
Interrupting casts
I found UNIT_CASTINGTIME while looking through the glossary and was wondering how I could use it to stun/interrupt a mob that starts casting a spell while I am fighting it.
Thanks
Thanks
Re: Interrupting casts
I would think the easiest way to interrupt would be to check if the mob is casting in the onpreskillcast or onskillcast profile event and then act.
Something like
Something like
Code: Select all
<onPreSkillCast>
local target = player:getTarget()
if target and target.Casting then
player:cast("interrupting skill")
end
</onPreSkillCast>
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
Re: Interrupting casts
this works great! a couple other things... to add skills from all three of my classes, would i have to make a conditional for each skill or is there a shorter way? also, is there a way to check what the target is casting so that i can only interrupt certain casts (like heals) and not others?
thanks
thanks
Re: Interrupting casts
Unfortunately yes. You can use something like thisDsanchez wrote: to add skills from all three of my classes, would i have to make a conditional for each skill or is there a shorter way?
Code: Select all
if player.Class1 == CLASS_PRIEST then
We don't save that information. You would have to look for an ingame function that will give you that info. I had an initial look at the rom wiki but couldn't see one.Dsanchez wrote:also, is there a way to check what the target is casting so that i can only interrupt certain casts (like heals) and not others?
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
Re: Interrupting casts
works great, and doesn't give an error and stop now with that added.
thanks!
thanks!
Re: Interrupting casts
hi, i have another question about this. i have two stuns on my paladin, shock and charge. i'd like to use shock first and then alternate to charge when shock is on cd and vice versa. is this possible?
thanks!
Code: Select all
<onPreSkillCast>
local target = player:getTarget()
if target and target.Casting then
if player.Class1 == CLASS_KNIGHT then
player:cast("KNIGHT_SHOCK")
end
end
</onPreSkillCast>
thanks!
Re: Interrupting casts
That should be
Saves you getting the target and checking casting if you are not a knight.
Checking the cooldown is a bit more difficult.
I think this will work.
Code: Select all
<onPreSkillCast>
if player.Class1 == CLASS_KNIGHT then
local target = player:getTarget()
if target and target.Casting then
player:cast("KNIGHT_SHOCK")
end
end
</onPreSkillCast>
Checking the cooldown is a bit more difficult.
I think this will work.
Code: Select all
<onPreSkillCast>
if player.Class1 == CLASS_KNIGHT then
local target = player:getTarget()
if target and target.Casting then
-- Look up Shock skill
if ShockIndex == nil then -- So it only does it once
for k,v in pairs(settings.profile.skills) do
if v.Name = "KNIGHT_SHOCK" then ShockIndex = k break end
end
end
-- Check cooldown
local cd = deltaTime(getTime(), settings.profile.skills[ShockIndex].LastCastTime)/1000 break end
if cd > 30 then
player:cast("KNIGHT_SHOCK")
else
player:cast("KNIGHT_CHARGE")
end
end
end
</onPreSkillCast>
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
Re: Interrupting casts
I receive a failed to compile error when using the latter.
Re: Interrupting casts
try
there was a "break end" that didn't look right to me.
Code: Select all
<onPreSkillCast>
if player.Class1 == CLASS_KNIGHT then
local target = player:getTarget()
if target and target.Casting then
-- Look up Shock skill
if ShockIndex == nil then -- So it only does it once
for k,v in pairs(settings.profile.skills) do
if v.Name = "KNIGHT_SHOCK" then ShockIndex = k break end
end
end
-- Check cooldown
local cd = deltaTime(getTime(), settings.profile.skills[ShockIndex].LastCastTime)/1000
if cd > 30 then
player:cast("KNIGHT_SHOCK")
else
player:cast("KNIGHT_CHARGE")
end
end
end
</onPreSkillCast>
Remember no matter you do in life to always have a little fun while you are at it
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: Interrupting casts
Code: Select all
if player.Class1 == CLASS_KNIGHT then
local target = player:getTarget()
if target and target.Casting then
-- Look up Shock skill
if ShockIndex == nil then -- So it only does it once
for k,v in pairs(settings.profile.skills) do
if v.Name == "KNIGHT_SHOCK" then ShockIndex = k break end
end
end
-- Check cooldown
local cd = deltaTime(getTime(), settings.profile.skills[ShockIndex].LastCastTime)/1000
if cd > 30 then
player:cast("KNIGHT_SHOCK")
else
player:cast("KNIGHT_CHARGE")
end
end
end
Remember no matter you do in life to always have a little fun while you are at it
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: Interrupting casts
TY, no more error with the == instead of =
Now I'd like to add interrupts for my warrior. I'm choosing Shout and Terror since Thunder requires a 1h weapon (would it be possible to use Thunder instead if I had a 1h weapon equipped?).
I've used the same format previous with a few changes but I am getting an error saying 'TERROR' is not in the database.
Now I'd like to add interrupts for my warrior. I'm choosing Shout and Terror since Thunder requires a 1h weapon (would it be possible to use Thunder instead if I had a 1h weapon equipped?).
Code: Select all
<onPreSkillCast>
if player.Class1 == CLASS_KNIGHT then
local target = player:getTarget()
if target and target.Casting then
-- Look up Shock skill
if ShockIndex == nil then -- So it only does it once
for k,v in pairs(settings.profile.skills) do
if v.Name == "KNIGHT_SHOCK" then ShockIndex = k break end
end
end
-- Check cooldown
local cd = deltaTime(getTime(), settings.profile.skills[ShockIndex].LastCastTime)/1000
if cd > 30 then
player:cast("KNIGHT_SHOCK")
else
player:cast("KNIGHT_CHARGE")
end
end
end
if player.Class1 == CLASS_WARRIOR then
local target = player:getTarget()
if target and target.Casting then
-- Look up Shout skill
if ShoutIndex == nil then -- So it only does it once
for k,v in pairs(settings.profile.skills) do
if v.Name == "WARRIOR_SHOUT" then ShoutIndex = k break end
end
end
-- Check cooldown
local cd = deltaTime(getTime(), settings.profile.skills[ShoutIndex].LastCastTime)/1000
if cd > 120 then
player:cast("WARRIOR_SHOUT")
else
player:cast("WARRIOR_TERROR")
end
end
end
</onPreSkillCast>
Re: Interrupting casts
do you mean
WARRIOR_TERRORIZE
which is the skill in database.
WARRIOR_TERRORIZE
which is the skill in database.
Remember no matter you do in life to always have a little fun while you are at it
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: Interrupting casts
I'll give this a try, the actual skill name in my spellbook says "Terror".lisa wrote:do you mean
WARRIOR_TERRORIZE
which is the skill in database.
Thanks
-
- Posts: 210
- Joined: Wed Oct 27, 2010 11:34 am
Re: Interrupting casts
With this code, Thunder will cast if there is something in the offhand, (as there should be, if you're using a 1-H weapon). Also, I would probably check the cooldown on all of them, not only the first in line, I hate seeing the skill called in MM, then the error message in the game that the skill is on CD.Dsanchez wrote:Now I'd like to add interrupts for my warrior. I'm choosing Shout and Terror since Thunder requires a 1h weapon (would it be possible to use Thunder instead if I had a 1h weapon equipped?).
I've used the same format previous with a few changes but I am getting an error saying 'TERROR' is not in the database.Code: Select all
-- Check cooldown local cd = deltaTime(getTime(), settings.profile.skills[ShoutIndex].LastCastTime)/1000 if cd > 120 then player:cast("WARRIOR_SHOUT") elseif not inventory.EquipSlots[17].Empty then player:cast("WARRIOR_THUNDER") else player:cast("WARRIOR_TERROR") end end end </onPreSkillCast>
He's right, it's WARRIOR_TERROR, and no, it's not in the database... I thought I had posted before asking for it to be added, but perhaps not. I manually added it a long time ago and have just continued to update it.lisa wrote:do you mean
WARRIOR_TERRORIZE
which is the skill in database.
Code: Select all
<skill name="WARRIOR_TERROR" id="490142" rage="30" range="90" cooldown="45" type="damage" target="enemy" />
Re: Interrupting casts
This is in database
Code: Select all
<skill name="WARRIOR_TERRORIZE" id="490142" rage="30" range="90" cooldown="45" type="damage" target="enemy" />
Remember no matter you do in life to always have a little fun while you are at it
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
-
- Posts: 210
- Joined: Wed Oct 27, 2010 11:34 am
Re: Interrupting casts
Yes it is, and everything is right except for the name, which should be Terror... skilltab 4, skill 13.
Re: Interrupting casts
It was probably just a different name from different language, no idea.
Not sure who added the skill to database.
Not sure who added the skill to database.
Remember no matter you do in life to always have a little fun while you are at it
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: Interrupting casts
Maybe the name changed at some stage.
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 52 guests