Liquidor
New Member
- Reaction score
- 0
Hi guys,
Basically I need to create workers for 6 players depending on 2 factors: Is Playing and Race selection.
I got 6 regions named PXStart where X is 1-6 and the players can select all 4 races.
How should I do this in a trigger without spamming 100s of If-else's like below?
Note that this trigger below doesn't even take in account for "Is Playing" :-/ and it's only for player 1, imagine the spam needed for all 6 players, I'm sure it can be done in loops or similar?
-------------------------------------------
I'm not sure if people follow what I'm trying to achieve so here's a recap.
Force 1
1) Player
2) Player
3) Player
4) Computer
Force 2
5) Player
6) Player
7) Player
8) Computer
Map Initialization:
- Create 1 worker for each player.
- The unit that is created depends on the race that is selected by the player (4 default races).
- Each player got their own region where that unit should spawn.
That's basically what I'm trying to do.
The issues I got now when trying to create the loops:
What region belongs to what player?
Is there a player on the slot?
What race did the player pick?
I hope this helps you helping me
Basically I need to create workers for 6 players depending on 2 factors: Is Playing and Race selection.
I got 6 regions named PXStart where X is 1-6 and the players can select all 4 races.
How should I do this in a trigger without spamming 100s of If-else's like below?
Note that this trigger below doesn't even take in account for "Is Playing" :-/ and it's only for player 1, imagine the spam needed for all 6 players, I'm sure it can be done in loops or similar?
Trigger:
- Player Group - Pick every player in Player Group - Player 1 (Red) and do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Race of Player 1 (Red)) Equal to Human
- Then - Actions
- Unit - Create 1 Peasant for Player 1 (Red) at (Center of P1Start <gen>) facing Default building facing degrees
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Race of Player 1 (Red)) Equal to Orc
- Then - Actions
- Unit - Create 1 Peon for Player 1 (Red) at (Center of P1Start <gen>) facing Default building facing degrees
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Race of Player 1 (Red)) Equal to Undead
- Then - Actions
- Unit - Create 1 Acolyte for Player 1 (Red) at (Center of P1Start <gen>) facing Default building facing degrees
- Else - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Race of Player 1 (Red)) Equal to Night Elf
- Then - Actions
- Unit - Create 1 Wisp for Player 1 (Red) at (Center of P1Start <gen>) facing Default building facing degrees
- Else - Actions
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
-------------------------------------------
I'm not sure if people follow what I'm trying to achieve so here's a recap.
Force 1
1) Player
2) Player
3) Player
4) Computer
Force 2
5) Player
6) Player
7) Player
8) Computer
Map Initialization:
- Create 1 worker for each player.
- The unit that is created depends on the race that is selected by the player (4 default races).
- Each player got their own region where that unit should spawn.
That's basically what I'm trying to do.
The issues I got now when trying to create the loops:
What region belongs to what player?
Is there a player on the slot?
What race did the player pick?
I hope this helps you helping me