- Joined
- Apr 1, 2009
- Messages
- 201
I've created a trigger that spawns a certain number of units between two integers and of a certain unit type. Both are random when the hero enters the region. What I can't figure out how to do is, how to check if all the units spawned in that region are dead and if they are wait 60 seconds then turn the trigger back on. I'm not sure if I should use unit groups and if I do, would I have to make a bunch of unit groups? Or will just one work?
-
Setup Copy
-
Events
- Map initialization
- Conditions
-
Actions
- -------- Unit Type And Amount Spawned --------
- Set UnitTypeSpawnF[1] = Wolf
- Set NumberOfSpawnedUnits[1] = 3
- Set UnitTypeSpawnF[2] = Bear
- Set NumberOfSpawnedUnits[2] = 2
-
Events
-
Forest Region 1
-
Events
- Unit - A unit enters Enter Forest Spawn 1 <gen>
- Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Owner of (Triggering unit)) Not equal to Neutral Passive
- (Owner of (Triggering unit)) Not equal to Neutral Hostile
- (All units of CreepRespawnCheck are dead) Equal to True
-
Then - Actions
- Set UnitTypeSpawnInteger = (Random integer number between 1 and 2)
- Unit - Create (Random integer number between 1 and NumberOfSpawnedUnits[UnitTypeSpawnInteger]) UnitTypeSpawnF[UnitTypeSpawnInteger] for Neutral Hostile at (Random point in Forest Spawn 1 <gen>) facing (Random angle) degrees
-
Unit Group - Pick every unit in (Units in Enter Forest Spawn 1 <gen>) and do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Enter Forest Spawn 1 <gen> contains (Picked unit)) Equal to True
- (Owner of (Picked unit)) Equal to Neutral Hostile
-
Then - Actions
- Unit Group - Add (Picked unit) to CreepRespawnCheck
- Custom script: call DestroyGroup(udg_CreepRespawnCheck)
- Trigger - Turn off (This trigger)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events