Egg Sack Init

Events


Map initialization

Conditions

Actions


-------- number of egg sack unit types --------


Set ES_NumberOfSackType = 6


-------- register all egg sacks --------


Set ES_SackType[1] = Egg Sack (small 1)


Set ES_SackType[2] = Egg Sack (small 2)


Set ES_SackType[3] = Egg Sack (medium 1)


Set ES_SackType[4] = Egg Sack (medium 2)


Set ES_SackType[5] = Egg Sack (large 1)


Set ES_SackType[6] = Egg Sack (large 2)


-------- spiders spawned after the egg sack is destroyed --------


Set ES_SpawnType[1] = Spider (small)


Set ES_SpawnType[2] = Spider (small)


Set ES_SpawnType[3] = Spider (medium)


Set ES_SpawnType[4] = Spider (medium)


Set ES_SpawnType[5] = Spider (large)


Set ES_SpawnType[6] = Spider (large)


-------- minimum amount of units spawned --------


Set ES_SpawnMinimum[1] = 2


Set ES_SpawnMinimum[2] = 2


Set ES_SpawnMinimum[3] = 1


Set ES_SpawnMinimum[4] = 1


Set ES_SpawnMinimum[5] = 1


Set ES_SpawnMinimum[6] = 1


-------- maximum amount of units spawned --------


Set ES_SpawnMaximum[1] = 4


Set ES_SpawnMaximum[2] = 4


Set ES_SpawnMaximum[3] = 3


Set ES_SpawnMaximum[4] = 3


Set ES_SpawnMaximum[5] = 2


Set ES_SpawnMaximum[6] = 2


-------- number of regions --------


Set ES_NumberOfRegions = 4


-------- register regions --------


Set ES_SpawnRegions[1] = Region 1 <gen>


Set ES_SpawnRegions[2] = Region 2 <gen>


Set ES_SpawnRegions[3] = Region 3 <gen>


Set ES_SpawnRegions[4] = Region 4 <gen>


-------- maximum sacks in region --------


Set ES_MaxSacksInRegion[1] = 20


Set ES_MaxSacksInRegion[2] = 20


Set ES_MaxSacksInRegion[3] = 20


Set ES_MaxSacksInRegion[4] = 20


-------- host player --------


Set ES_SpiderPlayer = Player 2 (Blue)


-------- interval before creating more sacks --------


Set ES_TimerInterval = 45.00


-------- timer start --------


Countdown Timer - Start ES_Timer as a Repeating timer that will expire in ES_TimerInterval seconds


-------- spawn egg sacks --------


Trigger - Run Egg Sack Create <gen> (checking conditions)
Egg Sack Create

Events


Time - ES_Timer expires

Conditions

Actions


-------- enumerates region --------


For each (Integer ES_RegionLooper) from 1 to ES_NumberOfRegions, do (Actions)



Loop - Actions




Set ES_TempGroup = (Units in ES_SpawnRegions[ES_RegionLooper])




-------- enumerates region --------




For each (Integer ES_TypeLooper) from 1 to ES_NumberOfSackType, do (Actions)





Loop - Actions






-------- count egg sack --------






Unit Group - Pick every unit in ES_TempGroup and do (Actions)







Loop - Actions








Set ES_Picked = (Picked unit)








If (All Conditions are True) then do (Then Actions) else do (Else Actions)









If - Conditions










(ES_Picked is alive) Equal to True










(Unit-type of ES_Picked) Equal to ES_SackType[ES_TypeLooper]









Then - Actions










Unit Group - Add ES_Picked to ES_ValidGroup









Else - Actions










Set ES_Picked = No unit




Set ES_SackCount = (Number of units in ES_ValidGroup)




Unit Group - Remove all units from ES_ValidGroup




Custom script: call DestroyGroup(udg_ES_TempGroup)




-------- checks if the sacks are maxed --------




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






ES_SackCount Less than ES_MaxSacksInRegion[ES_RegionLooper]





Then - Actions






Set ES_MissingSack = (ES_MaxSacksInRegion[ES_RegionLooper] - ES_SackCount)






For each (Integer ES_SackLooper) from 1 to ES_MissingSack, do (Actions)







Loop - Actions








Set ES_TypeIndex = (Random integer number between 1 and ES_NumberOfSackType)








Set ES_CreatePoint = (Random point in ES_SpawnRegions[ES_RegionLooper])








Unit - Create 1 ES_SackType[ES_TypeIndex] for ES_SpiderPlayer at ES_CreatePoint facing (Random angle) degrees








Unit Group - Add (Last created unit) to ES_SackGroup








Custom script: call RemoveLocation(udg_ES_CreatePoint)





Else - Actions


Trigger - Turn off (This trigger)
Egg Sack Spawn

Events


Unit - A unit Dies

Conditions


((Triggering unit) is in ES_SackGroup) Equal to True

Actions


Set ES_DestroyedSack = (Triggering unit)


-------- spawn units --------


For each (Integer ES_TypeLooper) from 1 to ES_NumberOfSackType, do (Actions)



Loop - Actions




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






(Unit-type of ES_DestroyedSack) Equal to ES_SackType[ES_TypeLooper]





Then - Actions






Set ES_SpawnCount = (Random integer number between ES_SpawnMinimum[ES_TypeLooper] and ES_SpawnMaximum[ES_TypeLooper])






For each (Integer ES_SpawnLooper) from 1 to ES_SpawnCount, do (Actions)







Loop - Actions








Set ES_DestroyPoint = (Position of ES_DestroyedSack)








Unit - Create 1 ES_SpawnType[ES_TypeLooper] for ES_SpiderPlayer at ES_DestroyPoint facing (Random angle) degrees








Custom script: call RemoveLocation(udg_ES_DestroyPoint)





Else - Actions


Unit Group - Remove ES_DestroyedSack from ES_SackGroup


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Egg Sack Create <gen> is on) Equal to False



Then - Actions




Trigger - Turn on Egg Sack Create <gen>



Else - Actions