I've been triggering for the past 7 hours, and these issues may be the result of numbers and triggers running through my head too much, but I thought I better just write these down and hopefully someone can assist me.
So to the issue, at the end of a round, I need to check all the players' Kills, and display who netted the most kills for that round. It seems like a fairly easy problem, but for the life of me I can't find anything that works correctly.
Event: Unit dies
Action: Modify Integer PlayerKills[owner of killing unit] + 1
at the end of the round just walk through the array and find whoever has the highest value. and maybe reset the array if you want it to reset per round.
Hi! I have the trigger setup already, and the Integer Array. I just have a problem scripting the trigger to 'look' for who has the highest kills. And when I find who has the highest kills, how do I reference that player into the final scoreboard?
Sorry if my original post caused any misunderstandings, my brain is all, "if then do variable modify numbers" etc. I don't think I can explain this thoroughly enough.
You basically need variable to hold highest kills and player who got them. Then just loop thru players and compare if kill amount is higher, and if yes then replace those variables.
Bplayer=0<Integer>Bkills=0<Integer>ActionsPlayerGroup-Pickeachplayerin(ActivePlayers)anddo(Actions)ActionsGeneral-If(Conditions)thendo(Actions)elsedo(Actions)ifKills[(Pickedplayer)] > Bkills // compare if this player got more kills then previous highest
then
Variable - Set Bkills = Kills[(Pickedplayer)] // set highest kill count to kills of that player
Variable - Set Bplayer = (Picked player) // set player with highest kills to that player
else
//note: else is empty
Variable - Set Kills[(Pickedplayer)] = 0 // for every player kill count is reset to 0 for the next round
//and just refer to Bplayer/Bkills to get what you need
You may need to do a secondary check in case multiple people tie for most kills, right now it'll take the first player it finds with the highest kills and declare them the winner.
Well, according to how my map works, that won't be an issue. The only issue that can arise is if 2 players kill each other at the exact same time, which I've already diagnosed.
Now comes my nightmare... making the map pretty :(
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Hey there!
I've been triggering for the past 7 hours, and these issues may be the result of numbers and triggers running through my head too much, but I thought I better just write these down and hopefully someone can assist me.
So to the issue, at the end of a round, I need to check all the players' Kills, and display who netted the most kills for that round. It seems like a fairly easy problem, but for the life of me I can't find anything that works correctly.
Thanks in advance.
@Prediction7: Go
Integer Array: PlayerKills size:15
Event: Unit dies
Action: Modify Integer PlayerKills[owner of killing unit] + 1
at the end of the round just walk through the array and find whoever has the highest value. and maybe reset the array if you want it to reset per round.
@Helral: Go
Hi! I have the trigger setup already, and the Integer Array. I just have a problem scripting the trigger to 'look' for who has the highest kills. And when I find who has the highest kills, how do I reference that player into the final scoreboard?
Sorry if my original post caused any misunderstandings, my brain is all, "if then do variable modify numbers" etc. I don't think I can explain this thoroughly enough.
You basically need variable to hold highest kills and player who got them. Then just loop thru players and compare if kill amount is higher, and if yes then replace those variables.
@uiasdnmb: Go
Ahh, exactly what I was searching for! Thank you, sir.
I knew I was missing a variable, and yeah, I didn't have the variable to determine player.
You may need to do a secondary check in case multiple people tie for most kills, right now it'll take the first player it finds with the highest kills and declare them the winner.
@BulletWoundSC2: Go
Well, according to how my map works, that won't be an issue. The only issue that can arise is if 2 players kill each other at the exact same time, which I've already diagnosed.
Now comes my nightmare... making the map pretty :(