- Joined
- Jul 22, 2015
- Messages
- 3,485
Hey everyone! I'm trying to create a spawn system that supports multiple unit types in a wave and makes it so that the next wave doesn't spawn until all units in the previous wave have been killed. I'm having a hard time figuring out the latter and would love some insight! This isn't finished yet, so things may seem a bit off. Just ask me anything if something seems a bit off!
EDIT: I forgot to add that I also want these spawns to be endless ! I don't want to have to keep editing every single wave after another. I just want it so that X unit type spawns after XX amount of seconds, then Y unit type spawns ALONG with X unit type after YY amount of seconds. I also need them to spawn in intervals that I set in a variable (EX - Spawns 1 unit every 1 second.)
-
Spawn System 1
-
Events
- Time - Elapsed game time is 2.00 seconds
- Conditions
-
Actions
- -------- -------------- --------
- -------- -------------- --------
- -------- OWNER --------
- Set SpawnSystem_Owner = Player 1 (Red)
- -------- ------------------- --------
- -------- ------------------- --------
- -------- UNIT TYPE --------
- Set SpawnSystem_UnitType = Pig
- -------- --------------------------------- --------
- -------- --------------------------------- --------
- -------- UNIT SPAWN LIMIT --------
- Set SpawnSystem_UnitTypeLimit = 3
- -------- -------------------------------- --------
- -------- -------------------------------- --------
- -------- SPAWN INTERVAL --------
- Set SpawnSystem_SpawnInterval = 1.00
- -------- --------------------------------------------------------- --------
- -------- --------------------------------------------------------- --------
- -------- SPAWN AMOUNT PER INTERVAL --------
- Set SpawnSystem_Amount = 1
- -------- -------------------------------- --------
- -------- -------------------------------- --------
- -------- SPAWN LOCATION --------
- Set SpawnSystem_Location = (Center of Spawn 1 <gen>)
- -------- --------------------- --------
- -------- --------------------- --------
- -------- SPAWN SFX --------
- Set SpawnSystem_SFX = <Empty String>
- -------- ------------------------------- --------
- -------- ------------------------------- --------
- Trigger - Run Spawn System Filter <gen> (checking conditions)
- -------- ------------------------------------------- --------
- -------- ------------------------------------------- --------
- -------- Changing Variable EX --------
- Wait 10.00 seconds
- Set SpawnSystem_TempUTL[1] = 5
-
Events
-
Spawn System 2
- Events
- Time - Elapsed game time is 5.00 seconds
- Conditions
-
Actions
- -------- -------------- --------
- -------- -------------- --------
- -------- OWNER --------
- Set SpawnSystem_Owner = Player 2 (Blue)
- -------- ------------------- --------
- -------- ------------------- --------
- -------- UNIT TYPE --------
- Set SpawnSystem_UnitType = Chicken
- -------- --------------------------------- --------
- -------- --------------------------------- --------
- -------- UNIT SPAWN LIMIT --------
- Set SpawnSystem_UnitTypeLimit = 10
- -------- -------------------------------- --------
- -------- -------------------------------- --------
- -------- SPAWN INTERVAL --------
- Set SpawnSystem_SpawnInterval = 1.00
- -------- --------------------------------------------------------- --------
- -------- --------------------------------------------------------- --------
- -------- SPAWN AMOUNT PER INTERVAL --------
- Set SpawnSystem_Amount = 1
- -------- -------------------------------- --------
- -------- -------------------------------- --------
- -------- SPAWN LOCATION --------
- Set SpawnSystem_Location = (Center of Spawn 1 <gen>)
- -------- --------------------- --------
- -------- --------------------- --------
- -------- SPAWN SFX --------
- Set SpawnSystem_SFX = <Empty String>
- -------- ------------------------------- --------
- -------- ------------------------------- --------
- Trigger - Run Spawn System Filter <gen> (checking conditions)
-
Spawn System Filter
- Events
- Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- SpawnSystem_Counter Equal to 0
-
Then - Actions
- Trigger - Turn on Spawn System Loop <gen>
- Else - Actions
-
If - Conditions
- Set SpawnSystem_Counter = (SpawnSystem_Counter + 1)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- SpawnSystem_Counter Greater than SpawnSystem_IndexMax
-
Then - Actions
- Set SpawnSystem_Index[SpawnSystem_Counter] = SpawnSystem_Counter
- Set SpawnSystem_IndexMax = SpawnSystem_Counter
- Else - Actions
-
If - Conditions
- Set SpawnSystem_LoopInt = SpawnSystem_Index[SpawnSystem_Counter]
- Set SpawnSystem_TempOwner[SpawnSystem_LoopInt] = SpawnSystem_Owner
- Set SpawnSystem_TempUT[SpawnSystem_LoopInt] = SpawnSystem_UnitType
- Set SpawnSystem_TempUTL[SpawnSystem_LoopInt] = SpawnSystem_UnitTypeLimit
- Set SpawnSystem_TempSI[SpawnSystem_LoopInt] = SpawnSystem_SpawnInterval
- Set SpawnSystem_TempAmount[SpawnSystem_LoopInt] = SpawnSystem_Amount
- Set SpawnSystem_TempLocation[SpawnSystem_LoopInt] = SpawnSystem_Location
- Set SpawnSystem_TempSFX[SpawnSystem_LoopInt] = SpawnSystem_SFX
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Spawn System Loop
-
Events
- Time - Every 0.03 seconds of game time
- Conditions
-
Actions
-
For each (Integer SpawnSystemLoop[1]) from 1 to SpawnSystem_Counter, do (Actions)
-
Loop - Actions
- Set SpawnSystem_LoopInt = SpawnSystem_Index[SpawnSystemLoop[1]]
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- SpawnSystem_TimeLoop[SpawnSystem_LoopInt] Greater than or equal to SpawnSystem_TempSI[SpawnSystem_LoopInt]
-
Then - Actions
- Set SpawnSystem_TimeLoop[SpawnSystem_LoopInt] = 0.00
-
For each (Integer SpawnSystemLoop[2]) from 1 to SpawnSystem_TempAmount[SpawnSystem_LoopInt], do (Actions)
-
Loop - Actions
- Set SpawnSystem_Group[SpawnSystem_LoopInt] = (Units in (Playable map area) matching (((Unit-type of (Matching unit)) Equal to SpawnSystem_TempUT[SpawnSystem_LoopInt]) and (((Owner of (Matching unit)) Equal to SpawnSystem_TempOwner[SpawnSystem_LoopInt]) and (((Matching unit) is alive) Equal to True))))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in SpawnSystem_Group[SpawnSystem_LoopInt]) Less than SpawnSystem_TempUTL[SpawnSystem_LoopInt]
-
Then - Actions
- Unit - Create 1 SpawnSystem_TempUT[SpawnSystem_LoopInt] for SpawnSystem_TempOwner[SpawnSystem_LoopInt] at SpawnSystem_TempLocation[SpawnSystem_LoopInt] facing Default building facing degrees
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- SpawnSystem_TempSFX[SpawnSystem_LoopInt] Not equal to <Empty String>
-
Then - Actions
- Special Effect - Create a special effect at SpawnSystem_TempLocation[SpawnSystem_LoopInt] using SpawnSystem_TempSFX[SpawnSystem_LoopInt]
- Special Effect - Destroy (Last created special effect)
- Else - Actions
-
If - Conditions
- Else - Actions
-
If - Conditions
-
Loop - Actions
-
Else - Actions
- Set SpawnSystem_TimeLoop[SpawnSystem_LoopInt] = (SpawnSystem_TimeLoop[SpawnSystem_LoopInt] + 0.03)
-
If - Conditions
-
Loop - Actions
-
For each (Integer SpawnSystemLoop[1]) from 1 to SpawnSystem_Counter, do (Actions)
-
Events
Last edited: