Enemy pathfinding, after damage, enemy escape

Hi everyone,
I tried to make an enemy that chases the player to damage him, but I would like that when he damages him, the enemy moves away (de-active “Pathfinding” and active “TimedBackAndForthMirroredMovement”) so that he does not continue to damage him, I tried to do this (“Cimice_volante” is the enemy and Player is the player) but he continues to damage him without moving away.
How can I do it?

You should store enemy position in two object variables one for X and one for Y

When enemy is meant to chase player you move it with pathfidning toward player

After enemy damage player
You move enemy toward X and Y of his own variables so he go back to where he started

Is there any visual or video tutorial on these steps as I don’t know how to apply them? :frowning:

I managed to solve it another way, thanks in part to the image you sent me. Thank you :wink:
(I called the object variable “Stunned”)

1 Like

The issue seems that you’re using a cool down timer and switching back to the TimedBackAndForthMirroredMovement but the first event switches it back to pathfinding.

I like boolean variables. It makes the intentions clear. You could add an object variable like IsCollingDown. False by default. Set it to true when the timer starts and false when the timer expires. Then check it before activating the pathfinder.

Something like this. I didn’t want to add the and setup the behaviors. So, I just rotated the object when it was close to the enemy as a test. You should only need to add the boolean events.