How can I make an enemy back away from player when the player approaches?

Hello,

I am trying to make a ranged enemy that will back up when the player approaches them. I currently have the enemy chasing the player, and staying within a 150 radius, but I would like the enemy to back up as the player gets closer. Anyone have any ideas?

Thanks in advance!

Get the Vector from Enemy to Player : Direction = Enemy - Player.

So the position you want to Enemy to move to is : EnemyNewPosistion = Player + DistanceBetween * Direction

Only find a new Position when the distance between Player and Enemy is too close MinDistance > Direction.Size

I also wanted to add to duncan’s answer that you should also implement cone of vision for the enemies.
Something like this

Maybe I understood your suggestion wrong, but I do not have the enemy moving away when the player approaches. Using the debug, I do have the branch working correctly, so the error should be somewhere after the branch (All the uncommented code). Thanks again for your help!! Please see the 2 blueprints attached

Didn’t upload the pics. heh