Ai Stay in Area?

heres a example of how you could setup the system overall. so we begin with a event called move which moves to the pawn to a location. the location used is determined first by if the pawn is in the fenced area via the get “isFenced?” variable and the select node. the select node returns a value based on if the input is true or false in this case.

now as for getting the specific location i included a few methods here. first for the normal roaming movement we use a get random point in radius based on the pawns location. this will give us a random pint in a circle around the pawn. as for movement in the fenced area i used a random point in bounding box coupled with project to navigation. this works as it sounds, you provide a box and it returns a location within the box and tried to find a point that has navigation. you should note here that you will need a reference to the fence actor to get the box dimensions. to get teh reference i used an overlap event in the example. as you can see on begin overlap with fence actor we save a reference to the actor in a variable and set that we are now in the fence.