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 ....
check if in agro before casting home sweet home
Re: check if in agro before casting home sweet home
To check for aggro:
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()
if player.Battling then
-- you have aggro
end
Code: Select all
player:updateBattling()
while player.Battling do
player:target(player:findEnemy(true))
player:fight()
player:updateBattling()
end
-- use home sweet home
Re: check if in agro before casting home sweet home
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.
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
Re: check if in agro before casting home sweet home
Yes, you will have to update it inside the loop.
Code: Select all
player:updateBattling()
while player.Battling do
yrest()
player:updateBattling()
end
Re: check if in agro before casting home sweet home
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
Re: check if in agro before casting home sweet home
thanks again kenzu38 found another use for aggro check when opening chests in mirror.
Who is online
Users browsing this forum: Ahrefs [Bot] and 2 guests