Jump to content

Target Switching Before Registering underAttack


Recommended Posts

Posted

I'm scripting a combat bot and I'm checking if myPlayer() is:

  1. isAnimating()
  2. isMoving()
  3. 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?

Posted (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 by Gunman
Posted
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.

  • Like 1
  • 1 month later...
  • 4 weeks later...
Posted
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...