AceHart
Your Friendly Neighborhood Admin
- Reaction score
- 1,504
The interesting stuff first:
The boring part:
Select and remember all Creeps within a set of regions.
Once a region is empty, respawn them after expiration of some randomized timer
The question part:
What I don't like here, is that it requires a "well hidden" region,
unreachable by the player,
to keep the dead creeps until their respawning time has come.
No idea what happens if two or more timers expire at exactly the same time.
One trigger per timer seems a waste of space...
So, any comments welcome.
What's your preferred way of doing this?
Improvements?
Anything?
Hoping to read you soon,
AceHart
Code:
Init
Events
Time - Elapsed game time is 1.00 seconds
Conditions
Actions
Set RespawnRegions[1] = R Respawn 1 <gen>
Set RespawnRegions[2] = R Respawn 2 <gen>
Set RespawnRegions[3] = R Respawn 3 <gen>
Set RespawnRegions[4] = R Respawn 4 <gen>
Set RespawnRegions[5] = R Respawn 5 <gen>
For each (Integer A) from 1 to 5, do (Actions)
Loop - Actions
Unit Group - Pick every unit in (Units in RespawnRegions[(Integer A)]) and do (Actions)
Loop - Actions
Unit - Set the custom value of (Picked unit) to (Integer A)
Unit Group - Add (Picked unit) to SpawnGroups[(Integer A)]
Death
Events
Unit - A unit owned by Neutral Hostile Dies
Conditions
Actions
Set DeathUnit = (Triggering unit)
Set DeathIndex = (Custom value of DeathUnit)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) is in SpawnGroups[DeathIndex]) Equal to True
Then - Actions
Trigger - Run DeathInGroup <gen> (ignoring conditions)
Else - Actions
DeathInGroup
Events
Conditions
Actions
Unit Group - Remove DeathUnit from SpawnGroups[DeathIndex]
Unit - Create 1 (Unit-type of DeathUnit) for Neutral Hostile at (Center of RWellHidden <gen>) facing Default building facing degrees
Unit - Set the custom value of (Last created unit) to DeathIndex
Unit Group - Add (Last created unit) to Graveyard[DeathIndex]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Number of units in SpawnGroups[DeathIndex]) Equal to 0
Then - Actions
Countdown Timer - Start RespawnTimers[DeathIndex] as a One-shot timer that will expire in (Random real number between 20.00 and 50.00) seconds
Else - Actions
Respawn1
Events
Time - RespawnTimers[1] expires
Conditions
Actions
Wait until (RespawnInProgress Equal to False), checking every 2.00 seconds
Set RespawnIndex = 1
Trigger - Run Respawn <gen> (ignoring conditions)
Respawn2
Events
Time - RespawnTimers[2] expires
Conditions
Actions
Wait until (RespawnInProgress Equal to False), checking every 2.00 seconds
Set RespawnIndex = 2
Trigger - Run Respawn <gen> (ignoring conditions)
...repeat with timers 3 to 5
Respawn
Events
Conditions
Actions
Set RespawnInProgress = True
Set RespawnRegion = RespawnRegions[RespawnIndex]
Wait until ((All units of (Units owned by Player 1 (Red)) are in (Region centered at (Center of RespawnRegion) with size (2500.00, 2500.00))) Equal to False), checking every 3.00 seconds
Unit Group - Pick every unit in Graveyard[RespawnIndex] and do (Actions)
Loop - Actions
Unit - Move (Picked unit) instantly to (Random point in RespawnRegion), facing (Position of Tinkerbell 0025 <gen>)
Unit Group - Add (Picked unit) to SpawnGroups[RespawnIndex]
Unit Group - Remove (Picked unit) from Graveyard[RespawnIndex]
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Random integer number between 1 and 4) Equal to 2
Then - Actions
Unit - Add Wander (Neutral) to (Picked unit)
Else - Actions
Set RespawnInProgress = False
The boring part:
Select and remember all Creeps within a set of regions.
Once a region is empty, respawn them after expiration of some randomized timer
The question part:
What I don't like here, is that it requires a "well hidden" region,
unreachable by the player,
to keep the dead creeps until their respawning time has come.
No idea what happens if two or more timers expire at exactly the same time.
One trigger per timer seems a waste of space...
So, any comments welcome.
What's your preferred way of doing this?
Improvements?
Anything?
Hoping to read you soon,
AceHart


