Getting effect from multiple blueprints only apply once

Hey everyone, I started using unreal very recently so, theres a lot of things I dont quite know how to do them or search for a solution. Basically Ive got 4 different enemies AI roaming around a map, when the Ai sees the player it starts chasing it and while chasing it the player FOV gets an increase. The issue is, if more than one Ai sees the player the fov increase animation will play twice. How can I possibly made this fov increase global for the 4 ai instead of having it set individually.

Make an int variable called SeenBy. Increase it or decrease it based on how many AI sees the player. If number >0, then Do once node and set GOV. If the number drops to 0 the reset FOV and reset Do once node.

This SeenBy variable, where should I create it? Somewhere like the level blueprint or the AI blueprint? And how do I get it to increase, ive already got a boolean for when the enemy is seeing the player how do I make that boolean also increase the int?

Try:

  • in the player:

  • in the enemy:

See if that works for you.


Or does the fov changes based on the number of enemies chasing you? The more enemies, the greater the field of view?

1 Like

Alright Ill try that. No, the fov is just meant to change once.

Is FOV supposed to stay while the player is in sight?

Yes, because after the AI looses sight after 4 seconds the AI goes back to patrol and the fov gets decreased to normal.

Ok yeah, thats exactly what I need, but I guess that now Ive got a different issue. Because I wanted each AI to have a different patrol area, I just made 4 copies of the same blueprint but the patrol code as different locations. Will this still work if I place the AI code in 4 different ones? Or should I arrange a away of managing the paths within the blueprint instead of just making 4 different copies? In any case heres a SS of the patrol nodes.

You probably should, stacking nodes like you did is not the right way to do it - hard to expand and manage. Create an array, punch in coordinates and have the AI move between array elements. Flag this array as Instance Editable to set a unique path for every AI of the same class.


Or, better yet, use a spline instead of an array → nicer visualisation. Also, this may be a good point to start another thread.

I havent messed around arrays too much, but would something like this work?

Not really. But I’ll do you one better:

  • I gave this AI a spline component and set it to absolute coords:

I set up a path and closed the loop.

  • the script in the AI:

Now you can have any number of points without punching any numbers. The Ai will walk in circles.

They’re not really following the path (but this also can be done!), they go from point to point. A spline stores points just like an array but it’s easier to move them around. Would this work for you?

1 Like

Oh yeah that works just fine, even better than what I currently have. One question tought, how do I change the path for each one? After I placed them on the map, I modify the spline of each one?

Here’s a version with an array:

Now each AI can set their own coords.

Oh cool, thats the perfect solution, exactly what I needed. Thanks for all the help!

1 Like

Select the spline for this actor, drag it where the start point needs to sit. You can then create new spline points by alt dragging a spline point:

If in doubt, do look up a tut. There should be plenty on YT. Go with an array if that’s more convenient.

Good luck!

1 Like

Sorry to bother with this again, but only today I was able to fully apply everything you told me. So, the fov change works just fine, but before I used a timeline and a lerp node to make the fov change smoother, but when I use this nodes the fov change animation keeps repeating while Im being seen. What could possibly be wrong?

This event on the left triggers repeatedly via Pawn Sensing, ofc. This would need to be set up differently to work with a timeline. I’ll try to have a look tomorrow.

Alright, Ill get other things done meanwhile, thank you.

  • might be enough:

  • slightly better?:

Yep, that worked perfectly. Thanks again for all the help.