- Joined
- Jun 23, 2009
- Messages
- 297
I'm creating a TD, and I started a spawn system using 1 trigger per wave. Then, I realize I can improve the system quite a lot, and I start making it more and more simple, untill I get this:
So, I have a 4 region map, for 4 players (that's why x 4 / 4), and I want units to spawn according to the number of online players, that is, if 1 player is online, only 4 units are spawned (aprox number), but if 4 players are online then 16 units are spawned, etc.
What I'm asking, is for you guys to indicate me a better way to make the spawning system, by better I mean leakless, faster, more simple, and above all, the day I want to change the number of units spawned, I just need to change 1 number/variable.
Maybe even in 1 single trigger, that would be awesome.
If it's not too much to ask, I'd rather have someone explain how to do this, instead of doing it for me.
Thank you for your time.
-
Wave 1
-
Events
- Time - Elapsed game time is 20.00 seconds
- Conditions
-
Actions
- Set BornEnemies = (((Online_Players x 4) + 2) / 4)
- Set UnitType = Footmen
- Set TempPoint = (Random point in Region 1 <gen>)
- Unit - Create BornEnemies UnitType for Player 12 (Brown) at TempPoint facing Default building facing degrees
- Set TempPoint = (Random point in Region 2 <gen>)
- Unit - Create BornEnemies UnitType for Player 12 (Brown) at TempPoint facing Default building facing degrees
- Set TempPoint = (Random point in Region 3 <gen>)
- Unit - Create BornEnemies UnitType for Player 12 (Brown) at TempPoint facing Default building facing degrees
- Set TempPoint = (Random point in Region 4 <gen>)
- Unit - Create BornEnemies UnitType for Player 12 (Brown) at TempPoint facing Default building facing degrees
- Wait 3.00 seconds
- Trigger - Run (This trigger) (ignoring conditions)
- Custom script: call RemoveLocation( udg_TempPoint)
- Custom script: call DestroyTrigger(GetTriggeringTrigger())
-
Events
So, I have a 4 region map, for 4 players (that's why x 4 / 4), and I want units to spawn according to the number of online players, that is, if 1 player is online, only 4 units are spawned (aprox number), but if 4 players are online then 16 units are spawned, etc.
What I'm asking, is for you guys to indicate me a better way to make the spawning system, by better I mean leakless, faster, more simple, and above all, the day I want to change the number of units spawned, I just need to change 1 number/variable.
Maybe even in 1 single trigger, that would be awesome.
If it's not too much to ask, I'd rather have someone explain how to do this, instead of doing it for me.
Thank you for your time.