I need one trigger in my mod-file, and I will try to explain it carefully:
1. When players play on B.net, they create a game, invite opponents and select races in the lobby - Terran, Zerg, Protoss - just as in a melee custom game. (There is no special made in-game lobby or anything like that.)
2. When the game starts, players do not start with any CC, Nexus or Hatchery. Instead, they start with 1 leader and 5 workers. I have modified the Races-tab in the Data editor, so each race starts with its own leader, instead of a structure. (For example Zerg starts with 1 Queen and 5 Drones)
3. Players can play 1v1, 2v2, 3v3, 4v4, 1v2, 2v3, FFA, 2v2v2v2 etc, depending on what map they play on. (There will be different maps that vary in size. Teams are selected in the lobby before the game starts, where players select races.)
4. When ALL players in the same team have NO leaders left, they together lose the game at the same time. An individual player can not lose, unless the whole team together has 0 leaders. (Same thing in 1v1, a player loses when he/she has 0 leaders left. If so, the other player wins)
5. Each player can have up to 5 leaders in the game at the same time, and they are produced from a structure. (So in a 4v4 game, there can be max 40 leaders in the game at the same time. Each race has its own unique leader, for example Queen for Zerg)
This will be the most important trigger in my map, so I need it to work perfectly.
Any suggestions on how this trigger can look like?
Is it a risk that it collides with the Melee Initialization trigger that is in each individual map? (It gives starting resources, units and normal victory condition. Players are NOT suppose to lose if they have no structures, ONLY if the team has no leaders.)
Not sure how the exact specifics of the trigger insides might look like, but I would definitely have the triggering event be the death of a leader unit. Like if you plan to have 1 unit as a zerg leader, 1 as terran, 1 as protoss, should be something like:
Event:
Queen Dies
Raynor Dies
Zeratul Dies
Then do your win/lose logic from there. Not sure how you are going to set your teams up, so can't be too specific on these parts :)
EDIT: Still not sure how you doing teams, but I'll give you a setup for an 8 team FFA in pseudo code anyways (that should work for any of the other setups included you set the teams up properly):
Make an int totalteams = 0, along with booleans Team1, Team2, .... Team7, Team8 all set initially to false.
Pick all units for Team 1, for each unit, if unit == Queen or Raynor or Zeratul, set Team1 to True.
Do a Pick all units for Team 2-8 as well.
If Team1 == false, end game in defeat for all players in that team,
Else Modify totalteams by +1.
Do the same If for the other 7 teams in similar fashion.
Then, if Totalteams < 2
If Team1 == true, end game in victory for all players in that team
Else if Team2 == true, end game in victory
Do the same for the next 6 teams as well.
Assuming you add players to teams correctly, this logic shouldn't have any issues doing what you are aiming for. Feel free to post back if you need further clarification on any of this, just not going to type out exact trigger code for you here :)
Anyone have time to take a look at the trigger I am using and give suggestions on how to improve it? Are there any flaws with it?
This is the most important trigger in my map so it needs to work perfectly, as described in the opening post.
I only know the basics of triggers, since I rarely use them in my maps/mods. If anyone finds a way to improve the trigger, please be specific so I understand : )
I'd probably do something more like this. Should work for any amount of teams as well.
Disclaimer: Haven't actually tested it, and this is the first time I've used the specific function "units in region with alliance to player matching condition".
I need one trigger in my mod-file, and I will try to explain it carefully:
1. When players play on B.net, they create a game, invite opponents and select races in the lobby - Terran, Zerg, Protoss - just as in a melee custom game. (There is no special made in-game lobby or anything like that.)
2. When the game starts, players do not start with any CC, Nexus or Hatchery. Instead, they start with 1 leader and 5 workers. I have modified the Races-tab in the Data editor, so each race starts with its own leader, instead of a structure. (For example Zerg starts with 1 Queen and 5 Drones)
3. Players can play 1v1, 2v2, 3v3, 4v4, 1v2, 2v3, FFA, 2v2v2v2 etc, depending on what map they play on. (There will be different maps that vary in size. Teams are selected in the lobby before the game starts, where players select races.)
4. When ALL players in the same team have NO leaders left, they together lose the game at the same time. An individual player can not lose, unless the whole team together has 0 leaders. (Same thing in 1v1, a player loses when he/she has 0 leaders left. If so, the other player wins)
5. Each player can have up to 5 leaders in the game at the same time, and they are produced from a structure. (So in a 4v4 game, there can be max 40 leaders in the game at the same time. Each race has its own unique leader, for example Queen for Zerg)
This will be the most important trigger in my map, so I need it to work perfectly.
Any suggestions on how this trigger can look like?
Is it a risk that it collides with the Melee Initialization trigger that is in each individual map? (It gives starting resources, units and normal victory condition. Players are NOT suppose to lose if they have no structures, ONLY if the team has no leaders.)
@Kabelkorven: Go
Not sure how the exact specifics of the trigger insides might look like, but I would definitely have the triggering event be the death of a leader unit. Like if you plan to have 1 unit as a zerg leader, 1 as terran, 1 as protoss, should be something like:
Event:
Queen Dies
Raynor Dies
Zeratul Dies
Then do your win/lose logic from there. Not sure how you are going to set your teams up, so can't be too specific on these parts :)
EDIT: Still not sure how you doing teams, but I'll give you a setup for an 8 team FFA in pseudo code anyways (that should work for any of the other setups included you set the teams up properly):
Make an int totalteams = 0, along with booleans Team1, Team2, .... Team7, Team8 all set initially to false.
Pick all units for Team 1, for each unit, if unit == Queen or Raynor or Zeratul, set Team1 to True.
Do a Pick all units for Team 2-8 as well.
If Team1 == false, end game in defeat for all players in that team,
Else Modify totalteams by +1.
Do the same If for the other 7 teams in similar fashion.
Then, if Totalteams < 2
If Team1 == true, end game in victory for all players in that team
Else if Team2 == true, end game in victory
Do the same for the next 6 teams as well.
Assuming you add players to teams correctly, this logic shouldn't have any issues doing what you are aiming for. Feel free to post back if you need further clarification on any of this, just not going to type out exact trigger code for you here :)
Bump.
Anyone have time to take a look at the trigger I am using and give suggestions on how to improve it? Are there any flaws with it?
This is the most important trigger in my map so it needs to work perfectly, as described in the opening post.
I only know the basics of triggers, since I rarely use them in my maps/mods. If anyone finds a way to improve the trigger, please be specific so I understand : )
I'd probably do something more like this. Should work for any amount of teams as well.
Disclaimer: Haven't actually tested it, and this is the first time I've used the specific function "units in region with alliance to player matching condition".
Also this is just the defeat side. For victory, I'd use something similar to this: http://www.sc2mapster.com/forums/resources/tutorials/71397-triggers-lazy-tutorial-emulating-melee-victory-defeat/#p1