Interrupting casts

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Dsanchez
Posts: 77
Joined: Thu Aug 04, 2011 11:20 pm

Interrupting casts

#1 Post by Dsanchez »

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
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Interrupting casts

#2 Post by rock5 »

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

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
Dsanchez
Posts: 77
Joined: Thu Aug 04, 2011 11:20 pm

Re: Interrupting casts

#3 Post by Dsanchez »

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
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Interrupting casts

#4 Post by rock5 »

Dsanchez 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?
Unfortunately yes. You can use something like this

Code: Select all

if player.Class1 == CLASS_PRIEST then
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?
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.
  • 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
Dsanchez
Posts: 77
Joined: Thu Aug 04, 2011 11:20 pm

Re: Interrupting casts

#5 Post by Dsanchez »

works great, and doesn't give an error and stop now with that added.


thanks!
Dsanchez
Posts: 77
Joined: Thu Aug 04, 2011 11:20 pm

Re: Interrupting casts

#6 Post by Dsanchez »

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?

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!
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Interrupting casts

#7 Post by rock5 »

That should be

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>

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
			-- 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
Dsanchez
Posts: 77
Joined: Thu Aug 04, 2011 11:20 pm

Re: Interrupting casts

#8 Post by Dsanchez »

I receive a failed to compile error when using the latter.
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Interrupting casts

#9 Post by lisa »

try

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>
there was a "break end" that didn't look right to me.
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
Dsanchez
Posts: 77
Joined: Thu Aug 04, 2011 11:20 pm

Re: Interrupting casts

#10 Post by Dsanchez »

same error
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Interrupting casts

#11 Post by lisa »

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
was a = when needed a ==
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
Dsanchez
Posts: 77
Joined: Thu Aug 04, 2011 11:20 pm

Re: Interrupting casts

#12 Post by Dsanchez »

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?).

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>
I've used the same format previous with a few changes but I am getting an error saying 'TERROR' is not in the database.
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Interrupting casts

#13 Post by lisa »

do you mean
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
Dsanchez
Posts: 77
Joined: Thu Aug 04, 2011 11:20 pm

Re: Interrupting casts

#14 Post by Dsanchez »

lisa wrote:do you mean
WARRIOR_TERRORIZE
which is the skill in database.
I'll give this a try, the actual skill name in my spellbook says "Terror".


Thanks
Mushroomstamp
Posts: 210
Joined: Wed Oct 27, 2010 11:34 am

Re: Interrupting casts

#15 Post by Mushroomstamp »

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?).

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>
I've used the same format previous with a few changes but I am getting an error saying 'TERROR' is not in the database.
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.
lisa wrote:do you mean
WARRIOR_TERRORIZE
which is the skill in database.
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.

Code: Select all

	<skill name="WARRIOR_TERROR" id="490142" rage="30" range="90" cooldown="45" type="damage" target="enemy" />	
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Interrupting casts

#16 Post by lisa »

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
Mushroomstamp
Posts: 210
Joined: Wed Oct 27, 2010 11:34 am

Re: Interrupting casts

#17 Post by Mushroomstamp »

Yes it is, and everything is right except for the name, which should be Terror... skilltab 4, skill 13.
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Interrupting casts

#18 Post by lisa »

It was probably just a different name from different language, no idea.
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
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Interrupting casts

#19 Post by rock5 »

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
Post Reply