Make enemy freeze for few seconds when he looses player from sight range.

Hello everyone!
I was following one “simple ai” tutorial on youtube and everything from there is working fine, but I got an idea and cannot implement it. My enemy is by default wandering around and when he sees player, he starts to follow him. If player leaves enemy sight range, he gets back to “wandering around” behaviour. I was trying to make enemy freeze for a moment when he looses player from sight range, like he is thinking what to do next. Unfortunately the enemy is going back to “wandering around” immediately, even while “wait” node is on the very left side of the behaviour tree. Does anyone know some way to make this work? Thanks for any help!

Here’s the behaviour tree of that enemy:


never worked with the behavior tree but if your “wait node” isnt working you can probably just add a “delay” at the end of the code where the enemy scans for the player, dont you think?


Could you tell me please where exactly I should add “delay” node in here? You mean by adding it to one of those tasks or to new one?

Ok guys, nevermind. Found solution and as always it was simpler than I thought :wink:

In behaviour tree I added these 3 nodes:

And the task looks like this: