How to randomize the loop with no of actors in the level

Hello Guys,

I’m trying to make a Turret, which shoots at player. I am trying to use tags to determine which actor the turret should target. When I try to use it, I get location of each player and turrets placed in the level with a loop it actually mixes up with other locations and then when I try to play, It actually messes up all locations and when I play, it only attacks one actor inspite of having other targets too. This is in a Turret Actor Blueprint.
This is what I am trying:

This works when there is only one target in the level which the turrets have to target. But when there are multiple elements it has to target, It actually messes up. Any help is kindly appreciated.

Q: What I Acutally Want to have?

  • A Turret which shoots down any actor with tag “Target” and turret should chose the nearest enemy and should shoot down.

You only have the write the code for one turret ( inside the BP ). Then the other turrets will do what you want as you copy them across the level.

So the whole turret loop is redundant.

Do you get it?..

( maybe this is your level BP ). Not the way to do it. Just write the turret BP and copy the turret actors.