How can I make the AI stop following my character

It isn’t working my AI keeps following me even If I go out of range.

Hi,

To get the behavior you want, you first need to check how far your AI has gotten from its Start Location before Moving it toward the player. In your blueprints, in the Tick event, you check the distance between your AI and the player. As your AI chases the player, this distance might always remain below your threshold and therefore your AI might never return to its start location. Here’s a quick fix to your current blueprints. Keep your first blueprint as is, i.e. store the “Start Location” at BeginPlay. Delete whatever you have in Tick event and instead implement this for PawnSensing OnSee event:

As you can see, my AI first checks if it isn’t too far from its Start Location. If it isn’t, then it chases the player it saw. If it gets farther than 1000 units, then I simply return it back to its Start Location.

I also suggest you use AIPerception component instead of PawnSensing. AIPerception is newer, more efficient, thus recommended!

Hope this helps.

Thanks it worked, and I will look into AIPerception too.