LKSim Posted March 19, 2020 Share Posted March 19, 2020 I'm scripting a combat bot and I'm checking if myPlayer() is: isAnimating() isMoving() isUnderAttack() but after interacting and my player runs and attacks the monster there's a moment when he's not animating, moving, or under attack (because the monster hasn't turned around yet). This is enough sometimes enough time for my character to select a new target and go to that new one, while still remaining in combat with the first target. Any insight into working around this? Quote Link to comment Share on other sites More sharing options...
Gunman Posted March 19, 2020 Share Posted March 19, 2020 (edited) @LKSim You could not switch targets till the current target is either , doesn't exist/dead, or starts/is interacting with another player that isn't yours(or if target is null of course). EDIT: Btw I noticed you put this in the sub forum Snippets it's suppose to go in the general scripting help forum area. Edited March 19, 2020 by Gunman Quote Link to comment Share on other sites More sharing options...
LKSim Posted March 25, 2020 Author Share Posted March 25, 2020 On 3/19/2020 at 10:19 PM, Gunman said: @LKSim You could not switch targets till the current target is either , doesn't exist/dead, or starts/is interacting with another player that isn't yours(or if target is null of course). EDIT: Btw I noticed you put this in the sub forum Snippets it's suppose to go in the general scripting help forum area. Ah thank you, I wasn't sure where it should go so I did my best (I'm new sorry, I'll make sure to try harder next time). I ended up solving my problem having my character look for nearby loot, and if failing to find it, pushing him back into combat with the closest target (which is now the target that the character ran up to). It was a strange work around, but it works so long as there's no loot nearby. 1 Quote Link to comment Share on other sites More sharing options...
Gabriel Ramuglia Posted April 27, 2020 Share Posted April 27, 2020 You can also build in a delay to check isAnimating -- check once every 250ms, for a total of 2s. If the player is not animating for all 2s, return back false. If the player shows as animating at any time during the 2s, return true. Useful for cooking, and other activities as well. Quote Link to comment Share on other sites More sharing options...
Son Christmas Posted May 21, 2020 Share Posted May 21, 2020 On 3/25/2020 at 7:05 AM, LKSim said: Ah thank you, I wasn't sure where it should go so I did my best (I'm new sorry, I'll make sure to try harder next time). I ended up solving my problem having my character look for nearby loot, and if failing to find it, pushing him back into combat with the closest target (which is now the target that the character ran up to). It was a strange work around, but it works so long as there's no loot nearby. bit of a late reply from me. You could create an array of possible monsters to fight by using a different thread, then when you want to pick an item from the array it will can constantly be checking which monsters are available to be attacked Quote Link to comment Share on other sites More sharing options...