i need a trigger that will end the game in victory for the player in the most minerals... I have a feeling it's really easy to do but I can't figure it out for the life of me :(
This would be much easier if the number of players always were the same... We have to make the trigger dynamic and work with any number of players. I hope you won't come back and say it's a 1v1 or something, cause then all this was pointless.
I will try to explain each step I did in case something doesn't work as expected.
Event is empty since I have no clue when your game is supposed to end. After 30 minutes? After someone built 10 structures? After a boss unit is killed?
The variables will make sense further down when we use them.
Player Group - Pick each player...
We need to do the same thing for every active player currently in the game.
Variable - Set Highest Minerals...
Each player starts out with the variable "Highest minerals" set to true. As long as the trigger doesn't find another player in the game with more minerals, this will stay true. This will work even if the highest mineral count is tied between two or more players.
General - For each integer x...
Now we need to count the amount of enemies and see if any of them have a higher mineral count. All active players minus one should give us the number of players to check. (there is another, easier, way to do this, but that's assuming all other players in the game are set as enemies)
General - If... 1
Now we can check each of the remaining players minerals against the current one.
It's kind of hard to explain the condition here, but basically this will check each other player individually against the picked one. If anyone else have a higher mineral count, we change the variable Highest Minerals to false.
General - If... 2
Now we simply end the game in victory for the picked player if Highest Minerals stayed true through all the checks. If not, defeat.
Now we pick the next player and go through it all again.
I just realized.. this might not work since we are ending the game for a player and then moving on to the next. If the player group "Active Players" does not count those that have been checked set for Victory / Defeat, we might have a problem. Try this first, if it does not work. I have another idea, but it would make the trigger even more complex.
I just realized.. this might not work since we are ending the game for a player and then moving on to the next. If the player group "Active Players" does not count those that have been checked set for Victory / Defeat, we might have a problem. Try this first, if it does not work. I have another idea, but it would make the trigger even more complex.
You got it close, just save the player number (integer) to an outside variable instead of end the game. When the loop ends, end game for that player
Yup, that would have been my next move. Or if you want to allow for the possibility of tied games, make "Highest Minerals" an array with the size of the maximum possible number of players (doesn't really matter if it's too big).
I believe this should do it. I kind of got the urge to remake the first part of the trigger too (more than I already did) since it feels like I'm mixing two different ways to do this trigger... but I'm too tired right now. Let me know if I messed up somewhere.
i need a trigger that will end the game in victory for the player in the most minerals... I have a feeling it's really easy to do but I can't figure it out for the life of me :(
bumppp
This would be much easier if the number of players always were the same... We have to make the trigger dynamic and work with any number of players. I hope you won't come back and say it's a 1v1 or something, cause then all this was pointless.
I will try to explain each step I did in case something doesn't work as expected.
Event is empty since I have no clue when your game is supposed to end. After 30 minutes? After someone built 10 structures? After a boss unit is killed?
The variables will make sense further down when we use them.
Player Group - Pick each player...
We need to do the same thing for every active player currently in the game.
Variable - Set Highest Minerals...
Each player starts out with the variable "Highest minerals" set to true. As long as the trigger doesn't find another player in the game with more minerals, this will stay true. This will work even if the highest mineral count is tied between two or more players.
General - For each integer x...
Now we need to count the amount of enemies and see if any of them have a higher mineral count. All active players minus one should give us the number of players to check. (there is another, easier, way to do this, but that's assuming all other players in the game are set as enemies)
General - If... 1
Now we can check each of the remaining players minerals against the current one.
It's kind of hard to explain the condition here, but basically this will check each other player individually against the picked one. If anyone else have a higher mineral count, we change the variable Highest Minerals to false.
General - If... 2
Now we simply end the game in victory for the picked player if Highest Minerals stayed true through all the checks. If not, defeat.
Now we pick the next player and go through it all again.
I just realized.. this might not work since we are ending the game for a player and then moving on to the next. If the player group "Active Players" does not count those that have been checked set for Victory / Defeat, we might have a problem. Try this first, if it does not work. I have another idea, but it would make the trigger even more complex.
You got it close, just save the player number (integer) to an outside variable instead of end the game. When the loop ends, end game for that player
Yup, that would have been my next move. Or if you want to allow for the possibility of tied games, make "Highest Minerals" an array with the size of the maximum possible number of players (doesn't really matter if it's too big).
I believe this should do it. I kind of got the urge to remake the first part of the trigger too (more than I already did) since it feels like I'm mixing two different ways to do this trigger... but I'm too tired right now. Let me know if I messed up somewhere.