M
Macintuss
Guest
Hi I have a leaderboard in my map that keeps track of all the kills you make. It works great for everyone (players 2-8) except red (player 1). What happens is that the integer array "TotalKills" for player one red wont change until he kills two units, and only then it will jump to 1 (instead of 2). I know it has something to do with the leaderboard because i made a trigger to display totalkills[player number of player 1 red] when i type "sk" and It always shows the correct number of kills but that number is not the same number showing on my leaderboard. [For example I kill two units as player 1 red. I type "sk", it displays "2", leaderboard for player 1 red says "1" kill(s)]
Here is the trigger(s) for my leaderboard.
Any help would be greatly appreciated as i have been dealing with this problem for quite a while now. Thanks for reading!
Here is the trigger(s) for my leaderboard.
Get kills
setup board
update board
Code:
Kills
Events
Unit - A unit Dies
Conditions
(Owner of (Dying unit)) Not equal to (Owner of (Killing unit))
(Unit-type of (Triggering unit)) Not equal to Golem Part
(Unit-type of (Triggering unit)) Not equal to Dummy
(Unit-type of (Triggering unit)) Not equal to Skeleton Warrior
(Unit-type of (Triggering unit)) Not equal to Hero Golem Part
(Unit-type of (Triggering unit)) Not equal to Base Destroyer
Actions
Set TotalKills[(Player number of (Owner of (Killing unit)))] = (TotalKills[(Player number of (Owner of (Killing unit)))] + 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
TotalLevels[(Player number of (Owner of (Killing unit)))] Equal to 0
TotalKills[(Player number of (Owner of (Killing unit)))] Greater than or equal to 500
Then - Actions
Set TotalLevels[(Player number of (Owner of (Killing unit)))] = 1
Else - Actions
Do nothing
Code:
Setup Board
Events
Time - Elapsed game time is 0.01 seconds
Conditions
Actions
Leaderboard - Create a leaderboard for (All players controlled by a User player) titled Kills
Set TheLeaderBoard = (Last created leaderboard)
For each (Integer A) from 1 to 12, do (If (((Player((Integer A))) slot status) Equal to Is playing) then do (Leaderboard - Add (Player((Integer A))) to TheLeaderBoard with label (Name of (Player((Integer A)))) and value TotalKills[(Player number of (Player((Integer A))))]) else do (Do nothing))
Leaderboard - Remove Player 9 (Gray) from (Last created leaderboard)
Code:
Update Board
Events
Unit - A unit Dies
Conditions
Actions
For each (Integer A) from 1 to 12, do (If (((Player((Integer A))) slot status) Equal to Is playing) then do (Leaderboard - Change the value for (Player((Integer A))) in TheLeaderBoard to TotalKills[(Integer A)]) else do (Do nothing))
Leaderboard - Sort TheLeaderBoard by Value in Descending order