check if in agro before casting home sweet home

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

check if in agro before casting home sweet home

#1 Post by beanybabe » Sat Jun 11, 2016 11:54 am

I noticed if using mount and ride past mobs some times Iam still under agro when I try to cast home sweet home in this function and it fails.
viewtopic.php?f=21&t=6321
I can increase the timer and hope for agro to drop or is there a way to check for agro

if not agro then cast homesweethome ....

kenzu38
Posts: 279
Joined: Sun Dec 02, 2012 8:52 am

Re: check if in agro before casting home sweet home

#2 Post by kenzu38 » Wed Jun 22, 2016 12:34 pm

To check for aggro:

Code: Select all

player:updateBattling()
if player.Battling then
	-- you have aggro
end	
However, since you are using it for a userfunction, it's better to add in code to fight with the aggroed mobs:

Code: Select all

player:updateBattling()
while player.Battling do
	player:target(player:findEnemy(true))
	player:fight()
	player:updateBattling()
end
-- use home sweet home

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: check if in agro before casting home sweet home

#3 Post by beanybabe » Sun Jun 26, 2016 11:58 pm

Thank you.
What happens is when the quest status goes to complete I set wp to travel and mount then ride thru the mobs back to quest person. There is just enough distance the mobs do not follow but aggro is still set. The time can vary depending on mob aggro'd. Currently I just wait many seconds before trying to cast the home recall.

I was hoping a check for aggro could eliminate that wait or lesson it. This is also handy if you are going to teleport or recall if you are in aggro the spell will fail also.

I changed it a bit and will try this to replace yrest(4000) . Will need to test if player update needs in the repeat loop.

Code: Select all

		player:updateBattling() 	-- you have aggro
			repeat 
				yrest(200)
			untill player.Battling 

kenzu38
Posts: 279
Joined: Sun Dec 02, 2012 8:52 am

Re: check if in agro before casting home sweet home

#4 Post by kenzu38 » Tue Jun 28, 2016 2:23 am

Yes, you will have to update it inside the loop.

Code: Select all

player:updateBattling()
while player.Battling do
	yrest()
	player:updateBattling()
end   

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: check if in agro before casting home sweet home

#5 Post by beanybabe » Tue Jun 28, 2016 5:46 pm

Here is what I ended up with this works fast, it needed a *not* this worked well will add it to more wp

Code: Select all

repeat 	-- you have aggro wait for aggro to drop
    player:updateBattling() 
    yrest(500)         --   little delay to lessen server updates.  
until not player.Battling 

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: check if in agro before casting home sweet home

#6 Post by beanybabe » Thu Jul 28, 2016 9:51 am

thanks again kenzu38 found another use for aggro check when opening chests in mirror.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 12 guests