How to make A.I. stop searching for player

I have bots that see and hear. Once i am seen, the ai never forgets my character. I have it so that on pawn see it sets a blackboard value as actor. I call it enemy actor. I would like to set it up so that when I am not seen any more, the a.i. forgets my player. I used the node clear blackboard value, and it doesn’t seem to clear the value. In the pawn sensing it says it updates every 0.5 seconds, so i can not figure out why it is not updating when I am hidden from the a.i… The end result I am going for is: - Like a typical sneaking game, when i am spotted I get followed. If I break the line of sight the bot should then stop following me and go back to its default behavior. Thanks.

Here is my Controller Blue Print. Ive set it up the way I think it should work. What is wrong?

You have to change “See Enemy” after True.

you can’t do the forgetting right after seeing the player (OnSeePawn), or you’d have to see the player again before you can forget you saw him, which makes no sense. :smiley:


One thing you could do is (and i haven’t tested this), after Set Value as Object, put a Retriggerable Delay with the delay time being however long it should take the AI to forget the player (not 0, or there would be no time span where it knows it saw the player; i guess it would have to be at least 0.5secs, or the enemy would constantly forget the player, even though the player was never hidden from view).

After the delay, do the Clear Value.


The reason your current code doesn’t work is that you set See Enemy to true, then immediately check if it is true and your Clear Value follows on false… which can never be reached.

You are both right. I did some testing, and so far it seems to be working. Its making other parts of my behavior tree act strangely, but the clear value after the delay works. Ill update…