AI stop from a distance

I have an ai follow a property when the property is withing 20 blender units. How do I get the ai to stop following when the property gets 21 blender units away from the ai?

what do you want it to do when it gets 21 or greater away…you need to give it something else to do…or make it stop (only chasing if within 20 away)

I want it to completely stop

Set the near sensor to pulse and tap, that way it only activates one time and if your character gets outside the range it doesn’t send a positive signal. It should only be following while the pulse sends true, so set the reset range to the same distance as the sensor range. It will now continually send positive causing the AI to follow and when you leave his range it will stop.