| 01-26-2004, 05:40 AM | #1 |
i have a vote box but how do i get around ties? right now i have conditions like Box1 greater than box 2 box1 greater than box 3 fire easy triggers if they tied, the triggers wont fire right? so how do i get around it? |
| 01-26-2004, 05:39 PM | #2 |
If you're confident that your conditionals cover all possible situations in which a vote is uneven, you should just put a "skip remaining actions" inside each of them and put the actions for a tie after them. Otherwise, you will need to come up with conditionals that determine whether a tie has ocurred. Incidentally, the way I would do it is like this: Have all the vote totals represented by an integer array (Total[]), and have all the players' choices represented by a different integer array (Vote[]). Meanwhile, have the maximum votes received represented by an integer variable (MaxVotes). Start MaxVotes, Vote[] and Total[] with values all set to zero. Then when a player votes, change Vote[index of voting player] to the index of the option they voted for. When voting is over, step through the Votes[] array with a "For A" loop and for each vote, add one to Total[Vote[integer A]]. Then step through the Total[] array with another "For A" loop and for each option, if Total[integer A] is greater than MaxVotes, set MaxVotes to Total[integer A]. Now you don't yet know who got the most votes, but you know how many votes the winner(s) received. At this point, you can run through the Total[] array one more time to check how many totals are equal to MaxVotes, and if there are more than one, call for a tiebreaker. Or if you are going to allow ties, you could simply run the results for each Total[] that equals MaxVotes. Anyway. That was a bit ridiculous... Hope you can make sense of it! Good hunting. |
| 01-26-2004, 07:44 PM | #3 |
*faints* |
| 01-26-2004, 09:32 PM | #4 |
Er. Sorry, maybe I overdid that a bit... How many possible choices do the players have? If it's only 2 or 3 then basically everything I said is completely unnecessary... I was thinking for a system that would allow players to vote for like 20 different items or something. Anyway if it was only 3, you could make a condition like this: OR (any conditions are true) -----Conditions: -----------Box1 = Box2 AND Box1 > Box3 -----------Box2 = Box3 AND Box2 > Box1 -----------Box1 = Box3 AND Box1 > Box2 And it would fire whenever there was a tie for winner. |
| 01-26-2004, 11:10 PM | #5 |
its 4 choices easy normal gosu extreme |
| 01-26-2004, 11:14 PM | #6 |
In that case it's a leetle harder. OR (any conditions are true) -----Conditions: -----------Box1 = Box2 AND Box1 > Box3 AND Box1 > Box4 -----------Box1 = Box3 AND Box1 > Box2 AND Box1 > Box4 -----------Box1 = Box4 AND Box1 > Box2 AND Box1 > Box3 -----------Box2 = Box3 AND Box2 > Box1 AND Box2 > Box4 -----------Box2 = Box4 AND Box2 > Box1 AND Box2 > Box3 -----------Box3 = Box4 AND Box3 > Box1 AND Box3 > Box2 That should work though. |
| 01-26-2004, 11:45 PM | #7 |
this is for each seperate trig right? or is it all one big one? |
| 01-27-2004, 12:04 AM | #8 |
Or add "Is greater than or equal to to some of them... |
| 02-11-2004, 12:25 AM | #9 | |
*bump*. I'm trying to do the same thing as shadow(ps). cant get the damn thing to work right no matter what i do. I've tried all different configurations, including the one that shadow mentioned in the first post of this thread. In that example, *supposing there are 3 difficulty levels, one if/than/else for each one*, where would the following go in that trigger? Quote:
Plz help, this is one of the last things I need to get working in my map... -Huh Anyone? Hate to bump with nothing else to add, but I'm desperate to get this trigger working right before the days end. -Huh |
| 02-11-2004, 01:55 AM | #10 |
I have voting on the difficulty on my map that i made, but I went the easy way out, in case of a tie, the harder difficulty is selected :D |
| 02-11-2004, 02:28 PM | #11 |
look, what i did was just make a trigger for each difficulty. gosu is greater than easy gosu is greater than normal, gosu is greater than extreme. then i changed it around for the next difficulty. in case of a tie, i just made a variable thats set after the votes are done and the difficulty is selected. i made a seperate trigger that had the conditions, variable easy normal gosu extreme all equal false, then run normal triggers. thats all i did and it works like a charm. |
