| 06-14-2009, 08:52 PM | #1 |
Hi I'm having a bit of trouble. I'm making a map which has voting as one of its core things. I've got the dialog part all sorted and the whats been voted for part all sorted too, but I've got a bit of a problem with the counting of the vote. I need it as a maximum of 8 options, so at the moment its 'if Option1 is greater than Option2', 'if Option 1 is greater than Option 3' etc etc, which does work if a bit clunky. But if the vote is a tie, how would I go about working out what is tied without making hundreds of if/then/elses? I'm sure theres a simpler way than what I've got atm (maybe using 'for each integer'? I'm a noob when it comes to using that), or if not, one that at least sorts out ties easily. I'm afraid that I'm totally JASS-illiterate; I've never used it before in my life, so if I need to use that... If anyone can help, it'd be much appreciated. Thanks |
| 06-14-2009, 09:04 PM | #2 |
I would use a single array for all 8 options and them compare them in a loop like: If two options have an equal vote count then the one that comes first in the array will be chosen. |
| 06-14-2009, 09:30 PM | #3 |
Cheers Opossum, and that definitely works better than what I've got atm...but I want it so that players are voted out (not a boot system), and the map is based around players being voted out. Your system is a bit unfair on the player who comes first in the array. Thanks very much though, thats certainly better than the system that I was using. I just need to find a way of sorting out a tie, its confusing me. :D |
| 06-15-2009, 01:39 PM | #4 |
| 06-15-2009, 02:11 PM | #5 |
I just noticed that my loop is total bollocks actually. You need two additional variables instead of one: MaxOption and MaxOptionCount Trigger: For each (Integer A) from 1 to 8, do (Actions)Edit: No you actually don't. This should be enough too: I blame GUI for this confusion :\ |
