Problem with AI detection not working

Hi, I’m trying to make a system where the AI detects us based on the character’s lighting level. In short, it measures the level on probs and gives an average. If the AI sense the player and the illumination level is higher than 0.4, it should start detecting us.
My problem is that it only works when the character comes out from behind a wall? If I walk normally into his field of view and I’m illuminated, nothing happens. If I go out from behind a wall and I’m lit it starts detecting.
(I will add that if I remove the illumination factor then the detection works correctly based on distance)

(AI Controller) (“Succesfully Sensed” AND >0.4 propably causing a problem)

Also this error pops out, but not always

Code related to error


Video with described problem

On scan start reset illumination to 0…process new scan, get latest illumination value.

How would it look in blueprints? Sorry, i’m not a programmer

On target perception Update → Check Overall Illumination → Set Illumination → Branch → 0,4

Every time there’s a Detection (stimuli update) check the illumination, then compare against for 0,4 value.

How should I compare it against 0.4? I mean the part “Branch → 0.4”.

The perception system updates are only ran when the stimulus state is new for the perceiving actor. It doesn’t care about your illumination system.

A more sensible approach would be to detect changes in the illumination happening to the player and then updating the status to all actors which are perceiving it.

So for example, on successfully sensed, make the AI actors listen to “illumination level changed” event updates from the player, and then stop listening when the perception stimulus has ended.

I know what you mean, but don’t know how to implement it. How do I make AI actor to “listen”. You mean by “cast to…”?

Look into blueprint communications and event dispatchers