Flashlight should stops AI movement, then resume movement when flashlight isn't shining on them

The idea is that when the flashlight is shining on any AI, it pauses their movement until the light is no longer shining on them. I’ve used Line Trace to detect when its on them or not.

As you can see below. I’ve told The AI to Patrol then chase me unless flashlight is on and shining on him. However I’ve noticed that the AI only stops when you(the pawn) are directly facing it with the flashlight. The AI doesn’t care when the flashlight’s linetrace is behind an object. And even outputs that it is paused(stop movement) in printscreen when the flashlight is turned off but facing the AI. Very odd!

I’ve also posted my turn on and off blueprint for the flashlight as well in case I’m missing something obvious

If you turn on the debug for duration of 10 seconds on the Line Trace node, does it show the red line going through obstacles, or does it turn green at the point it hits the obstacle?

If it stays red for the entire length of the line, then it’s not hitting the obstacle, and you might need to try Trace by Object Type or something instead, and feed a MakeArray of WorldStatic and one or two others into it for the collision Object Type.

Trace by Object Type works!!!
However as you can see in this gif below. The AI doesn’t resume after being flashed on. It actually seems to only care once I turn the light on or off function. Not the actual light itself. Wondering if I made a mistake in the flashlight?
Gif link Imgur: The magic of the Internet

You can see my blueprint for flashlight above. But i posted snippets here too!

Sorry i have been away from this thread so long. I let my inbox get flooded with too many answerhub notifications and so i recently turned off most of them.

It is hard to tell whats wrong here but it might help with troubleshooting if you move the logic out of the flashlight and into the monsters since they are the ones who care whether the flashlight is shining on them. The flashlight doesnt need to know anything about monsters. You can do it that way but it makes it more complicated.

If a trace from the monster toward the flashlight hits the flashlight, and the flashlight rotation is within -0.2 dot product of the monster’s trace direction, then the flashlight is facing the monster or close to it and the monster can tell itself to freeze---- or unfreeze if the trace is out of range or a dot product of less than -0.2 or more than 0.

That way you dont have to do complicated gates and loops because each monster handles its own freezing and unfreezing.

hey no worries! I ended up doing an invisible cone attached to the flashlight for object detection. I was having a ton of trouble with tracing, but I really like your idea here. If I get time to revist the base logic, I will most definitely do so. Thank you!
I’ll mark this as completed.

Any tutorials on how to make that?