In my map, you can select between three different races.
Each race starts the game with some workers and a "leader."
When a player has no "leader" left in the game, he or she loses the game. But a player does NOT lose the game if he or she has 0 structures. Having no "leaders" is the only way to lose the game.
I am unsure how to build this trigger in a proper and flawless way.
If the game is played 2v2 or 3v3, is it possible to make the game end when ALL leaders in one team have been killed?
So if player A loses his leader, he does not lose the game alone. Instead ALL leaders in his team must be dead at the same time, then the whole team loses.
In that case, I would probably make 2 "leader groups" and use that same 'number of units in "leader group" condition, but have it set to 0. When that happens, end the game for all players on that team in loss, and victory for the other team. Does that make sense, or would it help to show it more in trigger form?
you could assign the leader to a variable. Then when you check to see if they have no units left, you also check to see if they are a leader with the variable.
In that case, I would probably make 2 "leader groups" and use that same 'number of units in "leader group" condition, but have it set to 0. When that happens, end the game for all players on that team in loss, and victory for the other team. Does that make sense, or would it help to show it more in trigger form?
Thank you.
I am currently trying to learn the basics of the trigger editor, but in this case I would appreciate to see how your suggestion looks more in trigger form. This will be the most important trigger in my map, thus it is important that it works absolutely perfect.
So first make 2 unit group global variables "Leader Group A" and "Leader Group B". At the beginning of the match I'd put all the heroes in their respective group.
@Kabelkorven: Go If you want to do it like Masked suggests, you need to place the units in the terrain editor first, one hero unit for every player. Now make the variables of the Unit Group type and then change the unit in the events to the units you placed in the terrain editor (pre-placed unit are under the Value tab). And now you can select your global variable.
At the moment the defeat conditions is per team, not per player. As long as one player in the team has his hero alive, then no player is defeated yet.
Terran starts the game with Leader A.
Zerg starts the game with Leader B.
Protoss starts the game with Leader C.
I use Melee initialization triggers, which causes each race to start with five workers and one leader, depending on if they choose to play as T, P or Z in the lobby-menu before the game starts.
Each race can build up to five leaders, and all of them are of the same kind. So Terran can build up to five Leader A, Zerg up to five Leader B and Protoss up to five Leader C.
If players play 1v1, a player will lose when he has no leaders left in play.
If players play 2v2, 3v3 or 4v4, the whole team will lose when there are NO leaders in play at all in that team.
In this way, the amount of leaders players have in the game will go up and down. New leaders will be produced, and leaders will die. As soon as one team has no leaders at all in play, they lose the game. (Same in 1v1)
Each leader needs to be added into the correct variable as it comes into play?
Edit: Ah, I see now that I wrote a badly written opening post with not enough details. Sorry for the missinformation : /
The easiest way to do it is make sure the unit type has a unique unit type or attribute like hero/leader/etc; Then in your unit dies trigger check for the attribute in the conditions, and run an if then for the number of units with that attribute in relation to the alliances. I'd also use a loop instead for the victory/defeat actions bases on teams.
Based on what you want, I think you can get away with just having two unit groups and a trigger that checks for unit creation.
PlayerGroupLeaderA = (Empty unit group) <Unit Group>
PlayerGroupLeaderB = (Empty unit group) <Unit Group>
For your trigger, you will need to check to see if one of your leader units are created. For example, we'll say that the leaders are a Zergling, Marine, or a Zealot (since I don't know what you're using).
In my map, you can select between three different races.
Each race starts the game with some workers and a "leader."
When a player has no "leader" left in the game, he or she loses the game. But a player does NOT lose the game if he or she has 0 structures. Having no "leaders" is the only way to lose the game.
I am unsure how to build this trigger in a proper and flawless way.
Any suggestion on how to build such a trigger?
Just a single trigger for when the leaders die is all you need.
Anyone who want to give some more detailed guidelines?
event - Unit dies
Condition - triggering unit = "leader"
(you could throw "Or" in here and do the same condition for each players leader. Or whatever works best for how your game is set up)
Action - End game for (triggering player) in defeat
(at the beginning you could put all the leaders into a unit group called "leader group" and then do this)
If
'number of units in "leader group" = 1'
then
end game in victory for owner of unit in "leader group"
Thanks for the help!
One additional thought:
If the game is played 2v2 or 3v3, is it possible to make the game end when ALL leaders in one team have been killed?
So if player A loses his leader, he does not lose the game alone. Instead ALL leaders in his team must be dead at the same time, then the whole team loses.
In that case, I would probably make 2 "leader groups" and use that same 'number of units in "leader group" condition, but have it set to 0. When that happens, end the game for all players on that team in loss, and victory for the other team. Does that make sense, or would it help to show it more in trigger form?
@MaskedImposter: Go
you could assign the leader to a variable. Then when you check to see if they have no units left, you also check to see if they are a leader with the variable.
New to the Editor? Need a tutorial? Click Here
Want data assets? Click Here
Thank you.
I am currently trying to learn the basics of the trigger editor, but in this case I would appreciate to see how your suggestion looks more in trigger form. This will be the most important trigger in my map, thus it is important that it works absolutely perfect.
So first make 2 unit group global variables "Leader Group A" and "Leader Group B". At the beginning of the match I'd put all the heroes in their respective group.
So It'd look something like this.
Then my win/lose trigger would look like this.
The main action in the above part is "End game for player". They are underneath "if then" actions.
Thanks for the help. I have built the trigger, but I can't save it because of two errors appear.
I have probably done something wrong with the variables, and nothing I've tried so far seems to solve it.
I attach two pictures below with the errors
@Kabelkorven: Go You've selected custom script in the second image. Just select the variables tab and select your global variable.
Thanks, yeah I tried that too, but no variables appear in that tab.
See image below
I have also tried to adjust the variables themselfes, but if I understand it correctly, they need to be integer-variables and they are already global.
@Kabelkorven: Go If you want to do it like Masked suggests, you need to place the units in the terrain editor first, one hero unit for every player. Now make the variables of the Unit Group type and then change the unit in the events to the units you placed in the terrain editor (pre-placed unit are under the Value tab). And now you can select your global variable.
At the moment the defeat conditions is per team, not per player. As long as one player in the team has his hero alive, then no player is defeated yet.
Ok I will try that. But the point is this:
Terran starts the game with Leader A. Zerg starts the game with Leader B. Protoss starts the game with Leader C.
I use Melee initialization triggers, which causes each race to start with five workers and one leader, depending on if they choose to play as T, P or Z in the lobby-menu before the game starts.
Each race can build up to five leaders, and all of them are of the same kind. So Terran can build up to five Leader A, Zerg up to five Leader B and Protoss up to five Leader C.
If players play 1v1, a player will lose when he has no leaders left in play.
If players play 2v2, 3v3 or 4v4, the whole team will lose when there are NO leaders in play at all in that team.
In this way, the amount of leaders players have in the game will go up and down. New leaders will be produced, and leaders will die. As soon as one team has no leaders at all in play, they lose the game. (Same in 1v1)
Each leader needs to be added into the correct variable as it comes into play?
Edit: Ah, I see now that I wrote a badly written opening post with not enough details. Sorry for the missinformation : /
The easiest way to do it is make sure the unit type has a unique unit type or attribute like hero/leader/etc; Then in your unit dies trigger check for the attribute in the conditions, and run an if then for the number of units with that attribute in relation to the alliances. I'd also use a loop instead for the victory/defeat actions bases on teams.
Would you mind being a bit more specific?
Based on what you want, I think you can get away with just having two unit groups and a trigger that checks for unit creation.
PlayerGroupLeaderA = (Empty unit group) <Unit Group>
PlayerGroupLeaderB = (Empty unit group) <Unit Group>
For your trigger, you will need to check to see if one of your leader units are created. For example, we'll say that the leaders are a Zergling, Marine, or a Zealot (since I don't know what you're using).
Then for your defeat thing, it could be another trigger:
This should work regardless if it's a 1v1, 2v2, 5v5, etc. since you can always set it up to be team 1 versus team 2.