# How to stop AI movement after distance?

Hello,

I am using the simple AI Move To blueprint in the AI controller. How would I create a distance blueprint where the AI stop moving after the player is away from the AI at a certain distance? And is it possible without using the behavior tree?

I was facing the same problem but I found out a solution.Get the world location of the AI and break it, then do the same with your character. Subtract the X of the AI by the X of your ![alt text]character and the Y of the AI by the Y of your character. Create a branch with the condition of if the value is less than 0 then multiply it by “-1”(to make it positive).Now Make two variables “Distance X” and “Distance Y”. Plug the difference of X of the character and the AI into “Distance X” and the difference of Y of the character and the AI into Distance Y". Now as you know the distance between the characters, now make a variable “Total Distance” = (sqrt(“Distance X”^2 + “Distance Y”^2)) by this you can get the distance between your characters. create a branch where you check if the “Total Distance” is less than a certain value, and if it is you stop your character by either creating an “AI MoveTo” node and set the target to itself or by a “stop movement node”. Hope it helps