This is useful for RPG's for creep respawn.
I know this probably leaks, but at the moment I don't care because I think this may be the only trigger out there like this.
Variables:
i - Integer | Init Value : 0
iMax - Integer | Init Value : Number of enemy units
unitcount - Integer | Init Value : 0
unitRef - Unit Array | Init Value : -None- | Array Size : Number of enemy units
unitRefType - Unit-Type Array | Init Value : -None- | Array Size : Number of enemy units
unitXY - Region Array | Init Value : -None- | Array Size : Number of enemy units
To find the number of enemy units on your map, Place the following trigger in your map.
I know this probably leaks, but at the moment I don't care because I think this may be the only trigger out there like this.
Variables:
i - Integer | Init Value : 0
iMax - Integer | Init Value : Number of enemy units
unitcount - Integer | Init Value : 0
unitRef - Unit Array | Init Value : -None- | Array Size : Number of enemy units
unitRefType - Unit-Type Array | Init Value : -None- | Array Size : Number of enemy units
unitXY - Region Array | Init Value : -None- | Array Size : Number of enemy units
To find the number of enemy units on your map, Place the following trigger in your map.
-
Unit Count
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
Unit Group - Pick every unit in (Units owned by Player 10 (Light Blue)) and do (Actions)
-
Loop - Actions
-
Set unitcount = (unitcount + 1)
-
-
-
-
Game - Display to (All players) the text: (String(unitcount))
-
-
NPC Revive
-
Events
-
Unit - A unit owned by Player 10 (Light Blue) Dies
-
-
Conditions
-
Actions
-
Wait 60.00 seconds
-
Trigger - Run NPC Revive Repeat <gen> (checking conditions)
-
-
-
NPC Revive Repeat
-
Events
-
Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
unitRef[i] Equal to (Dying unit)
-
-
Then - Actions
-
Unit - Create 1 unitRefType[i] for Player 10 (Light Blue) at (Center of unitXY[i]) facing Default building facing degrees
-
Set unitRef[i] = (Last created unit)
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
i Equal to iMax
-
-
Then - Actions
-
Set i = 0
-
-
Else - Actions
-
Set i = (i + 1)
-
-
-
Trigger - Run NPC Revive Repeat <gen> (checking conditions)
-
-
-
-
-
Set Units
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
Unit Group - Pick every unit in (Units owned by Player 10 (Light Blue)) and do (Actions)
-
Loop - Actions
-
Set unitRef[i] = (Picked unit)
-
Set unitRefType[i] = (Unit-type of (Picked unit))
-
Set unitXY[i] = (Region centered at (Position of (Picked unit)) with size (1.00, 1.00))
-
Set i = (i + 1)
-
-
-
-
Last edited: