• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Need help about ranking score system

Status
Not open for further replies.
Level 13
Joined
Nov 20, 2006
Messages
553
Hello.. i need help for trigger which check the most kill
for example i use integer Kill . it gained after each kill.
at end of game. it decide who is the winner. between rank 1 - 3,
it will show name of the player rank1, rank2, rank3.

my rank system is buggy. so i ask here. thanks for coming :)
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
In tihs post, I'm going to assume you've got an arrayed variable where you store the kills of each player in.

It's not a very efficient method, but since you only need to do this for a maximum of 12 players, here's a trigger that will sort them by score:
  • For each (Integer LoopInt1) from 1 to 10, do (Actions)
    • Loop - Actions
      • For each (Integer LoopInt2) from 1 to 9, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • PlayerKills[PlayerRank[(LoopInt2 + 1)]] Greater than PlayerKills[PlayerRank[LoopInt2]]
            • Then - Actions
              • Set TempInt = PlayerRank[LoopInt2]
              • Set PlayerRank[LoopInt2] = PlayerRank[(LoopInt2 + 1)]
              • Set PlayerRank[(LoopInt2 + 1)] = TempInt
            • Else - Actions
"PlayerKills[X]" is the amount of kills Player X has (GUI player numbers, so Player 1 is red).
"PlayerRank[X]" is the player number of the player ranked Xth (the player with the most kills will be stored in "PlayerRank[1]").
At the start, PlayerRank will just be the same as the player's number (PlayerRank[1] = 1, PlayerRank[2] = 2, ...).

LoopInt1 goes from 1 to (number of players).
LoopInt2 goes from 1 to (number of players - 1).
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Those 2 are just integer variables. You can use Integer A/B instead.
The reason I used LoopInt1 and LoopInt2 is because, for one, I thought I needed to subtract it sometimes (so it loops longer than it usually would).
The second reason is because Integer A/B sometimes fails for me (very rare).
 
Status
Not open for further replies.
Top