Thats the trigger that handles making the dialogs and destroying the dialogs, The dialogs refuse to destroy after 15 seconds unless every active player has voted. But I use computers in my map for AI players, and they dont vote so I have this dialog that stays up after 15 seconds for the entire game if I add an AI to the map.
After studying your code I've come to the conclusion that whether it works or not has nothing to do with the number of AI players in your game.
When 15 seconds have past, your trigger saves the [b]current[/b] maximum vote to the variable "max" and then checks in an endless loop whether there is only one option with "max" votes.
Now imagine the following example: 15 seconds are over but no player has voted yet. Then every "vote[i]" is 0, thus "max" is 0, too. But the endless loop will exit if and only if exactly one of the votes becomes "max", which is 0. Lets say the players now vote for option 1 and option 2. Then option 0 would be the only option with 0 votes - and it would be chosen! Do you understand what I mean?
Beside this major problem there is another one: Starcraft II automatically terminates triggers with endless loops if there is no delay in them. So, if there is no definite vote after 15 seconds, the trigger you posted is canceled and nothing happens anymore.
To fix this last issue, just add a "Delay" action to the loop's subactions.
To fix the whole problem, you should put the "For each integer i from 0 to 2 ..." action into the endless loop, before the "If, Then, Else" clause. This is probably not the best solution but it should work ;)
Alright thanks I think I will fix the lesser problem and let the guy who did the trigger handle the Harder one and link him to your answer :D i hate asking people to do something without giving them a way to do it lol.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
http://pastebin.com/UGU92aLZ
Thats the trigger that handles making the dialogs and destroying the dialogs, The dialogs refuse to destroy after 15 seconds unless every active player has voted. But I use computers in my map for AI players, and they dont vote so I have this dialog that stays up after 15 seconds for the entire game if I add an AI to the map.
After studying your code I've come to the conclusion that whether it works or not has nothing to do with the number of AI players in your game.
When 15 seconds have past, your trigger saves the [b]current[/b] maximum vote to the variable "max" and then checks in an endless loop whether there is only one option with "max" votes.
Now imagine the following example: 15 seconds are over but no player has voted yet. Then every "vote[i]" is 0, thus "max" is 0, too. But the endless loop will exit if and only if exactly one of the votes becomes "max", which is 0. Lets say the players now vote for option 1 and option 2. Then option 0 would be the only option with 0 votes - and it would be chosen! Do you understand what I mean?
Beside this major problem there is another one: Starcraft II automatically terminates triggers with endless loops if there is no delay in them. So, if there is no definite vote after 15 seconds, the trigger you posted is canceled and nothing happens anymore.
To fix this last issue, just add a "Delay" action to the loop's subactions. To fix the whole problem, you should put the "For each integer i from 0 to 2 ..." action into the endless loop, before the "If, Then, Else" clause. This is probably not the best solution but it should work ;)
@Sanktoras: Go
Alright thanks I think I will fix the lesser problem and let the guy who did the trigger handle the Harder one and link him to your answer :D i hate asking people to do something without giving them a way to do it lol.