- Joined
- Oct 17, 2012
- Messages
- 849
How can I improve the code for this spawn system? My goal is to reduce the amount of triggers. Here is the code:
I have two more triggers similar to this.
There is one more trigger similar to this one.
System includes 2 more triggers similar to this for moderate and hard difficulty.
Now is the actual spawning of creeps and ordering of creeps to move.
-
Spawn Next Creep Easy
-
Events
- Time - Every 5.00 seconds of game time
-
Conditions
- SpawnCreepMiddle Equal to False
- SpawnCreepHard Equal to False
-
Actions
- Trigger - Run CreepSpawnTriggersEasy[(CreepSpawnNumberEasy mod 24)] (checking conditions)
- Set CreepSpawnNumberEasy = (CreepSpawnNumberEasy + 1)
-
Events
-
Change Spawn Middle
-
Events
- Time - Elapsed game time is 900.00 seconds
- Conditions
-
Actions
- Game - Display to (All players) for 20.00 seconds the text: |cffffcc00Now the r...
- Set SpawnCreepMiddle = True
- Set SpawnCreepHard = False
- Set CreepSpawnNumberMiddle = 0
- Trigger - Run Setup Creep Spawn Triggers Middle <gen> (checking conditions)
-
Events
-
Setup Creep Spawn Triggers Easy
-
Events
- Map initialization
- Conditions
-
Actions
- Set CreepSpawnTriggersEasy[0] = FurlborgOne <gen>
- Set CreepSpawnTriggersEasy[1] = OwlbearOne <gen>
- Set CreepSpawnTriggersEasy[2] = RockOne <gen>
- Set CreepSpawnTriggersEasy[3] = ReverantOne <gen>
- Set CreepSpawnTriggersEasy[4] = NerubianOne <gen>
- Set CreepSpawnTriggersEasy[5] = RazormanOne <gen>
- Set CreepSpawnTriggersEasy[6] = LizardOne <gen>
- Set CreepSpawnTriggersEasy[7] = DragonOne <gen>
- Set CreepSpawnTriggersEasy[8] = FurlborgTwo <gen>
- Set CreepSpawnTriggersEasy[9] = OwlbearTwo <gen>
- Set CreepSpawnTriggersEasy[10] = RockTwo <gen>
- Set CreepSpawnTriggersEasy[11] = ReverantTwo <gen>
- Set CreepSpawnTriggersEasy[12] = NerubianTwo <gen>
- Set CreepSpawnTriggersEasy[13] = RazormanTwo <gen>
- Set CreepSpawnTriggersEasy[14] = LizardTwo <gen>
- Set CreepSpawnTriggersEasy[15] = DragonTwo <gen>
- Set CreepSpawnTriggersEasy[16] = FurldorgThree <gen>
- Set CreepSpawnTriggersEasy[17] = OwlbearThree <gen>
- Set CreepSpawnTriggersEasy[18] = RockThree <gen>
- Set CreepSpawnTriggersEasy[19] = ReverantThree <gen>
- Set CreepSpawnTriggersEasy[20] = NerubianThree <gen>
- Set CreepSpawnTriggersEasy[21] = RazormanThree <gen>
- Set CreepSpawnTriggersEasy[22] = LizardThree <gen>
- Set CreepSpawnTriggersEasy[23] = DragonThree <gen>
-
Events
-
FurlborgOne
- Events
- Conditions
-
Actions
- Set CreepSpawn_SpawnPoint = (Center of FurbogSpawnPoint <gen>)
- Unit - Create 1 Furbolg Pup for Neutral Hostile at CreepSpawn_SpawnPoint facing 270.00 degrees
- Set TopLeftNewUnit = (Last created unit)
- Trigger - Run Move Creep Top Left <gen> (ignoring conditions)
- Custom script: call RemoveLocation(udg_CreepSpawn_SpawnPoint)
- Custom script: set udg_TopLeftNewUnit = null
-
Move Creep Top Left
- Events
- Conditions
-
Actions
- Set CreepSpawn_MovePoint = (Random point in FurbogMovePoint <gen>)
- Unit - Wake up TopLeftNewUnit
- Unit - Order TopLeftNewUnit to Attack-Move To CreepSpawn_MovePoint
- Wait 10.00 seconds
- Unit - Replace TopLeftNewUnit with a (Unit-type of TopLeftNewUnit) using The old unit's relative life and mana
- Custom script: call RemoveLocation(udg_CreepSpawn_MovePoint)
- Custom script: set udg_TopLeftNewUnit = null