Spawning multiple soliders of the same object type (Soldier1)
When Soldier1 has line of sight it sets HasLineOfSight to True
When a Soldier1 Intances turns LineOfSight to True it should spawn a bullet and set angle towards the Enemy
Here is what I have
Pick Solider1 where HasLineOfSight (true)
(sub) - Enemy - Pick nearest to (Soldier1.X, Soldier1.Y)
System - Every 2 Seconds
System - For Each Soldier 1
Action: System - Create Object bullet on layer 1 at (Solider1.X, Soldier1.Y)
Bullet - Set Angle toward (Enemy.X, Enemy.Y)
Bullet - set bullet(behaviour) enabled
Now what happens with the above is that each Soldier1 that HasLineOfSight (true) will spawn a bullet, but instead of setting angle towards the closest Enemy, they all set the Bullet angle towards only one of the Enemies, and I am not sure which instance the bullet is choosing.
I need each solider to spawn a bullet and set its angle toward the enemy that is closest to him.
Sometimes what will happen is that only one of the instances will spawn a bullet, but that only happens when I mess around with it.
Please Help Me Fix This
Please help me figure out how to get each solider to spawn their own bullet and set the bullets angle toward the enemy that is closest to him.