Ok, iam creating an footman wars map at this moment, and there are TONS of ways you can do this. I chose this way, and even though there might be a much better way it works great:
First i have only 1 trigger for each player in the game to spawn a unit:
Code:
Spawn Player 1
Events
Time - player_spawn_timer[1] expires
Conditions
Actions
Unit - Create 1 player_main_spawn[1] for Player 1 (Red) at player_main_location[1] facing Default building facing (270.0) degrees
This trigger is actually quite simple, basicly this is what it does:
1. The trigger is run when a timer has reached his maximum value.
2. Then create a unit, which is saved in the variable player_main_spawn[1] (the one is because it is an array and the trigger is for player 1 (red)).
At the map initialization is have this part to set the player_main_spawn[]
Code:
Set player_main_spawn[1] = Militia (Tier 0)
The militia is the first unit in my maps. The reason i use an variable is because its very easy to create an unit and change what unit to spawn.
Code:
Set player_spawn_times[1] = 4.10
Set player_spawn_times[2] = 4.25
Set player_spawn_times[3] = 4.80
Set player_spawn_times[4] = 5.10
Set player_spawn_times[5] = 5.35
Here i set the variable for when each unit should spawn. As you can see i use 5 different timers for each "tier" of units. Each upgrade takes longer to spawn because they are more powerfull. I use an variable and not "hardcoded" times because this makes it very easy to change the times for balancing.
Code:
initialise trigger
Events
Time - Elapsed game time is 5.00 seconds
Conditions
Actions
Set all_playing_players = (All players matching ((((Matching player) slot status) == Is playing) and (((Matching player) controller) == User)))
Player Group - Pick every player in all_playing_players and do (Actions)
Loop - Actions
Countdown Timer - Start player_spawn_timer[(Player number of (Picked player))] as a Repeating timer that will expire in player_spawn_times[1] seconds
This trigger which is run 5 seconds after the map starts runs a countdown timer for every players that is an user and is in the game. The timer starts for each player at the first variable.
But now we need an trigger to update the spawn trigger when we create an new building, and hence my upgrade trigger:
Code:
Upgrade Finished
Events
Unit - A unit Finishes an upgrade
Conditions
Actions
Set player_main_building[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
Game - Display to (All players) the text: (((player_color[(Player number of (Owner of (Triggering unit)))] + just upgraded to: ) + (Name of (Triggering unit))) + <Empty String>)
-------- Human Upgrades --------
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of player_main_building[(Player number of (Owner of (Triggering unit)))]) == Human Main - Tier 1 (Tier 1 Human)
Then - Actions
Set player_main_spawn[(Player number of (Owner of (Triggering unit)))] = Footman (Human Tier 1)
Countdown Timer - Start player_spawn_timer[(Player number of (Owner of (Triggering unit)))] as a Repeating timer that will expire in player_spawn_times[2] seconds
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Unit-type of player_main_building[(Player number of (Owner of (Triggering unit)))]) == Human Main - Tier 2 (Tier 2 Human)
Then - Actions
Set player_main_spawn[(Player number of (Owner of (Triggering unit)))] = Sorceress (Human Tier 2)
Countdown Timer - Start player_spawn_timer[(Player number of (Owner of (Triggering unit)))] as a Repeating timer that will expire in player_spawn_times[3] seconds
Else - Actions
I only added the first 2 tiers for the human upgrades because this trigger is quite long.
First the trigger is run when an unit finishes an upgrade. I use the system most footman wars maps use, an townhall which upgrades into his next upgrade. (and that 4 times)
I set an variable which is used for each player (kinda like a local variable, but dont use this too much because it can be overwritten if the trigger is run again) that contains the unit that is upgrading.
If the unit that is upgrading is equal to Human tier 1 townhall i know the player started an upgrade to Human tier 1 and i change the player_unit_spawn variable to a footman. Then i also change the spawn time to the second spawn time.
then i rerun the timer so it has a new time:
Code:
Countdown Timer - Start player_spawn_timer[(Player number of (Owner of (Triggering unit)))] as a Repeating timer that will expire in player_spawn_times[2] seconds
And this is my "basic" footman wars spawn system
If you want i can send you my version i have at the moment so you can check out the triggers and all, but since iam still in beta phases (need to finish nightelves) i dont want to post it.
Lemme know if this is helpfull