Stop AI from chasing player

If you are developing a single player game you can use a tick driven way to check if the cow is still in his pen (cow locationX is between X limits of the pen AND same for Y) and the tick it leave the pen you change the state and call the reset.

A more “correct” approach is to use a trigger box who trigger your cow reset event like in the attached picture:

this should work (change the state before reset, lol, forgot about it)