HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Simple Question

12-27-2003, 02:45 AM#1
Mink
I am making a dialog to be able to let a player choose from one of the 11 players to be a king. I know how to make the dialog and how to have the variables count the votes, but the problem I am having is getting it to compare the votes that I have gotten to choose the king. Sorry to ask a simple question, but how do I compare the results so that a player with the most votes, and no less then 3 votes, becomes the king?

Thanks in advance!
12-27-2003, 03:01 AM#2
th15
I'm assuming youre using some sort of array for the player's votes. Introduce a varaible called KingPlayer to store a player value.

Code:
For loop 1-#ofplayers
loop:   if: 
          vote[for loop integer A]=>3 AND if vote[for loop integer A]>vote[player number of KingPlayer]
          then:
          Set KingPlayer=player(convert player index For loop interger A) 

          else:
          do nothing
That's it. It runs through each player checking his vote count. If his vote count is higher than the last one it stores the player as the 'new' king.
12-27-2003, 04:04 AM#3
Mink
Thank you very much, that was exactly what I needed.