Why will my AI stop chasing the player when LoS is broken?

So I got an AI that will follow the player on gaining LoS, however they will not stop chasing the player until they make physical contact where they run back to their guardtarget. There is obviously a LoS system implemented as after this they will not chase again until the player goes in front of them, additionally I have a printing part in their blueprint to say ‘I saw you!’ in the interface when LoS is triggered. This occurs as expected, even when the AI loses LoS, but they continue to chase the player around or behind objects as though they still had LoS rather than ‘forgetting’ about the player immediately, they only ‘forget’ the player when they make physical contact.

I have screencaps of the blueprints and the behaviour tree here;

I have been following 's tutorial for this (Ignore the sound segments, I have no interest in using those).

You’re missing LoS-loss detection and clearing the EnemyTarget BB key (I assume that’s the player).

And before you ask, no there’s not event like “OnLoSLost”, if you need that you need to check it yourself (or use not documented yet AISensingComponent).

Cheers,

–mieszko

I cannot find an AISensingComponent event (preusmably as I’m having to use 4.4, which the project sadly requires and every tutorial seems to be made for).

I assumed it was something to do with the lack of ‘forgetting’ the EnemyActor or LoS-loss, but I haven’t the faintest idea how to clear the BB key (I presume you mean EnemyActor instead of EnemyTarget? I do not see such a value). I will dig around in the blueprints however.

If you can’t upgrade to 4.7 then you need to stick to PawnSensingComponent, but I strongly suggest you tried upgrading unless you use some third party code that doesn’t support it.

Clearing BB key’s value is as simple as calling ClearValueAsVector on your BlackboardComponent or ClearBlackboardValueAsVector in a BT node code.