AI Behavior Tree. AI Chasing issue

Hi Everyone

I currently have a Behavior tree set up for my AI to Patrol, Chase Player and Search. Currently what happens is when the AI See’s the Player he will chase him. When he loses sight he will stop and search the last known location. However when the AI Loses sight he instantly switches to searching. What i’m trying to do it make it so theres a delay before the AI Switches to searching. Basically what you can do is run round a corner in my game and then the AI stops dead. he wont come round the corner and stop if the player is no longer there.

Is there a way to make it so that he wont stop dead when you run round a corner?

Hey @Jurassic_Dave!

So what you need is to make sure on your blackboard, the target location for movement is the last location an unbroken line was drawn between the enemy and the player, not the player’s actual current location.

Then you need to make sure that there isn’t some sort of reset attached to the variable you’re using (like a “Sees Player” bool) until after they reach that spot, wait (seconds), then complete - maybe have the branch to wait only trigger if the “Sees Player” bool is false.

Hope that helps! Let us know how it goes! :slight_smile: