I find it really hard to ask that stupid question, but, how can I get the Player with the most kills?
In Warcraft 3 you could create a leaderboard and simply get the position..... how do we do this in SC2?
I'm not sure if there's already a counter, if there were it'd probably be in "player property". You could always count it yourself using the "unit is killed" event and modifying a global variable.
yeah creating an array that contains all the kills for the player surely isnt the problem. I wouldnt want to use a player property because I'd have to check if the kills were legit.
But I need some method to sort this array or get the index of the highest index...
simple search problem, just iterate through all elements, save the one (the iterator integer, which is also the index) with the highest value in a local var and return this local variable.
simple search problem, just iterate through all elements, save the one (the iterator integer, which is also the index) with the highest value in a local var and return this local variable.
----
To explain this better:
have a local variable in the trigger. LV lets call it
Have a variable set (An array) for each player to record their kills. GV lets call it
for loop index from 1-player count
if GV[index]>LV, then set LV=GV[index]
This will find the highest kills, then you need to search who has the most kills (in the event of a tie) player[index] will be all players who have the highest kill count, represented by LV
for loop index from 1-player count
if GV[index]=LV, then ___________ whatever you need to do for player [index]
Well, when you loop through the players looking for the highest score, you could take that player out of the player group. Then have it loop for the new highest score (second place), etc. When there's no players left in the player group, have it break the loop.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hi,
I find it really hard to ask that stupid question, but, how can I get the Player with the most kills? In Warcraft 3 you could create a leaderboard and simply get the position..... how do we do this in SC2?
Thank you!
I'm not sure if there's already a counter, if there were it'd probably be in "player property". You could always count it yourself using the "unit is killed" event and modifying a global variable.
Hi MaskedImpost, thank you for your reply,
yeah creating an array that contains all the kills for the player surely isnt the problem. I wouldnt want to use a player property because I'd have to check if the kills were legit. But I need some method to sort this array or get the index of the highest index...
@mojothejojo: Go
simple search problem, just iterate through all elements, save the one (the iterator integer, which is also the index) with the highest value in a local var and return this local variable.
Quote from FunkyUserName:
@mojothejojo: Go
simple search problem, just iterate through all elements, save the one (the iterator integer, which is also the index) with the highest value in a local var and return this local variable.
----
To explain this better:
have a local variable in the trigger. LV lets call it
Have a variable set (An array) for each player to record their kills. GV lets call it
for loop index from 1-player count
if GV[index]>LV, then set LV=GV[index]
This will find the highest kills, then you need to search who has the most kills (in the event of a tie) player[index] will be all players who have the highest kill count, represented by LV
for loop index from 1-player count
if GV[index]=LV, then ___________ whatever you need to do for player [index]
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
hmm well I guess I'll have to bite in the sour apple.
If I want to get the player with the second/third/etc... most kills, the whole thing gets more and more complicated but I think I figured it out.
Thank you guys!
You will want to get the player score, there is a score value that tracks kills as far as I know.
@mojothejojo: Go
Well, when you loop through the players looking for the highest score, you could take that player out of the player group. Then have it loop for the new highest score (second place), etc. When there's no players left in the player group, have it break the loop.