• 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.

[Trigger] Reorder Players based on Scores?

Status
Not open for further replies.
Level 4
Joined
Sep 26, 2005
Messages
40
I am trying to figure out something that should be simple but is really proving difficult for me..

i would like to reorder players based on their scores.

In my game i have 2 variables per player. one tracks Kills with an array size equal to 10 since it is a 10-player game. also have one that keeps track of Deaths.

i subtract the deaths from the kills and set that value to a variable. example:
for each integer A from 1 to 10
loop:
set RoundtallyVar[integer a] = kills[integer A] - deaths[integer a]

note;
the kills/deaths are set up and used in several other triggers where "integer A" is in line with the players 1 - 10


so what i want to do is reorder their names in a string variable according to score and not player order.
example; if player 5 has the highest score then that players name should be set to equal RoundStringVar[1]

and if player 8 has the 2nd highest score then they should be set to the 2nd array.
then i want to display each name as a button in a dialog showing each players name in order of score.

i havn't been able to figure out how to do the score comparisons...

the only idea i've come up with is: i've tried doing an integer B loop 1-10 within an integer A loop 1-10 with an if/then/else within the B loop with a condition that compares if the RoundtallyVar[integer a] greater than or equal to RoundtallyVar[integer b]

and if it does i have another non-array integer variable + 1 itself ... so then if that integer = 10 during the 1st loop of A then it should mean that player 1 has a higher score than everyone else and at least equal to his own score when A loop 1 checks against B loop 1. so then player 1 would be in first place, if not at least tie with other players.
since this would do 10X10 = 100 checks i have another condition that checks if that integer is 10 or over and stops if it is so that it does not exceed 10

that is as far as i've got. it's confusing the heck out of me! been looking at this for 3 days now.
 
Level 4
Joined
Sep 26, 2005
Messages
40
  • Leaderboard - Sort (Last created leaderboard) by Value in Descending order

lol...

I don't want this for a leaderboard. i stated "dialog"...with buttons.

so after a timer finishes, scores will be tallied and a popup box that appears before each player showing each player in their rank based on score listed in that window. And i will have a continue button at the bottom.
 
Last edited:
Level 7
Joined
Nov 19, 2007
Messages
253
i said "dialog" not leaderboard. you know the popup with an Ok/Continue button. i want names in that with each name as a button in order of score.

You don't have to double post! OMG!
I think you could make leaderboard then hide it and put you first player in leaderboard to first position in dialog etc...etc.. with other players that could work i think
 
Level 4
Joined
Sep 26, 2005
Messages
40
You don't have to double post! OMG!
I think you could make leaderboard then hide it and put you first player in leaderboard to first position in dialog etc...etc.. with other players that could work i think

sorry. i deleted other.

hm. so you mean i can use the leaderboard to organize it for me instead of me doing all of those calculations? can a variable reconize who is in a leaderboard position? i'll see if i can find, so far no luck, but that would be a much easier way.
 
Level 7
Joined
Nov 19, 2007
Messages
253
sorry. i deleted other.

hm. so you mean i can use the leaderboard to organize it for me instead of me doing all of those calculations? can a variable reconize who is in a leaderboard position? i'll see if i can find, so far no luck, but that would be a much easier way.

Ye there is condition about leaderboard position somewhere i don't know much about this but i think if you really need you could make it work :wwink:
 
Status
Not open for further replies.
Top