[Behavior Tree] Guard AI Search for Player

I know the basics of BT but I can’t find the solution for this problem…

I want my Guard AI to persue the player…and if he lost the line of sight…he need to go to the last place he saw the player and begin to patrol the area to find him…if he doesn’t find him after 30 seconds…he will go back to his patrol…

Screenshots of the Service/task/Behavior tree will help a lot! :slight_smile:

you might want to go here:
https://docs.unrealengine.com/latest/INT/Engine/AI/BehaviorTrees/QuickStart/index.html

This help me with first part : Go to the last place he saw de player…but the last one Search for player for 30 seconds…moving to random points close to player location isn’t fulfill

Unfortunately there isn’t an easy operator for this. It sounds like you are describing a system you will need to build.

yea as mentioned you need to build out functionality for this. There are some tutorials that cover this kinda thing.

in a nutshell:

in the behaviour tree make a target variable thats an actor and make its abort all lesser tasks if set. In it’s tree, do a move to target

in your AI BP, create a bool var called “target set”, then you can use pawn sensing to see the player, can use an is valid or == one of your players etc… If seen use a branch and check if “targetset” is true, if not then set the behaviour tree variable from here to the player seen from the blueprint, and the bool var “target set” to TRUE

since the behavior tree aborts all other behaviors when the actor target is set, it will now only do that tree and chase the player.

you can play with timers, or simply have a tick event in the AI BP that constantly runs your set target function.
when the player is no longer seen, your is valid from earlier will go to not valid and which point set your Behavior tree variable to empty