Jump to content

Target Switching Before Registering underAttack


LKSim

Recommended Posts

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?

Link to comment
Share on other sites

@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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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