UntitledTrigger001EventsUnit-AnyUnitEnters(Entiremap)LocalVariablesConditions(Ownerof(Triggeringunit))==2ActionsUnitGroup-Add(Triggeringunit)toEnemyUnitsUntitledTrigger002EventsUnit-AnyUnitdiesLocalVariablesConditions(Ownerof(Triggeringunit))==2ActionsUnitGroup-Remove(Triggeringunit)fromEnemyUnitsUnitGroup-PickeachunitinEnemyUnitsanddo(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)IfAndConditions(Closestunitto(Positionof(Triggeringunit))inEnemyUnits)==(Pickedunit)(Distancebetween(Positionof(Triggeringunit))and(Positionof(Pickedunit)))<=8.0Then------- SOUND THE ALARM!Else
Trigger 001 - Is for adding any unit on map owned by Player 2 To the Enemy Units unit group.
Trigger002 - Is a little more complex and actually took me awhile to figure out. Basically, when any unit dies and is owned by Player 2, it removes that unit from the Enemy Units unit group.
This is because if you don't, then the first condition below (Which finds the closest unit to the unit that died within that unit group) will just return the unit that died as the closest unit to the unit that died.
The second condition checks if the distance between the killed unit and the closest unit to the killed is less than or equal to 8. By doing this we can adjust the value of 8 to what we believe would make the closest unit within vision of the killed unit, since if the closest unit isn't in vision, none of them are.
If all equals true...
Then - SOUND THE ALARM.
Added a map to demonstrate if needed.
IMPORTANT - Make sure any of the units that are going to be triggering this trigger have a Death Time of 1 or more. This is because if the Death Time is set to 0, the unit will be gone before the trigger can do it's work. You can change the Death Time of a unit within the Data Editor under the Unit tab.
Awe, you all beat me to the punch. :P
@Alnatair: Go
Trigger 001 - Is for adding any unit on map owned by Player 2 To the Enemy Units unit group.
Trigger002 - Is a little more complex and actually took me awhile to figure out. Basically, when any unit dies and is owned by Player 2, it removes that unit from the Enemy Units unit group.
This is because if you don't, then the first condition below (Which finds the closest unit to the unit that died within that unit group) will just return the unit that died as the closest unit to the unit that died.
The second condition checks if the distance between the killed unit and the closest unit to the killed is less than or equal to 8. By doing this we can adjust the value of 8 to what we believe would make the closest unit within vision of the killed unit, since if the closest unit isn't in vision, none of them are.
If all equals true...
Then - SOUND THE ALARM.
Added a map to demonstrate if needed.
IMPORTANT - Make sure any of the units that are going to be triggering this trigger have a Death Time of 1 or more. This is because if the Death Time is set to 0, the unit will be gone before the trigger can do it's work. You can change the Death Time of a unit within the Data Editor under the Unit tab.
Than, in another trigger you can use the Boolean in an If Than Else to only alert if true.