• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Leaderboard not updating when kills happen.

Status
Not open for further replies.
Level 2
Joined
Jul 14, 2014
Messages
7
  • kills
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set Player_Kills[(Player number of (Owner of (Killing unit)))] = Player_Kills[((Player number of (Owner of (Killing unit))) + 1)]
      • Leaderboard - Change the value for (Owner of (Killing unit)) in (Last created leaderboard) to Player_Kills[(Player number of (Owner of (Killing unit)))]
      • Leaderboard - Sort (Last created leaderboard) by Value in Descending order
My trigger doesn't update kills when people gets them, any idea why? It just jumps a bit around with the names, but the value stays at 0 for everyone.
 
Last edited by a moderator:
Level 2
Joined
Jul 14, 2014
Messages
7
How do I make it so it adds to the value? I can't find the action to choose. The one I used for mine is arethmic value, but which is the right one to choose?
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
What @rulerofiron99 is trying to say it that you performed:

Player_Kills[(Player number of (Owner of (Killing unit)))] = Player_Kills[((Player number of (Owner of (Killing unit))) + 1)]
->
Player_Kills - array; we retrieve values via [] operator, thus: Player_Kills[0] returns value for Player Red.

What you did is increasing the index by which you get value from an array instead of increasing actual value:
Player_Kills[ < player index here> ] = Player_Kills[ < player index here> + 1 ] -> as you can see, you have assigned value of Player_Kills[ <player index here> + 1 ] to another player "kills".

What you are supposed to do:
Player_Kills[ <player index here> ] = Player_Kills[ <player index here> ] + 1

As you can see with such operation we have increased value stored in array at index <player index here> by 1.
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
How do I make it so it adds to the value? I can't find the action to choose. The one I used for mine is arethmic value, but which is the right one to choose?

Post #2, difference is paranthesis.
 
Level 2
Joined
Jul 14, 2014
Messages
7
Maybe my second post should've been more in depth, but I already understood what to do from rulerofirons post, but thank you for explaining it more in depth, Bannar, but what I'm having trouble with is actually finding out how I choose that function itself, while I'm under the configuration of the action in trigger editor I can't seem to find it.

What I did was pick Set Variable, choose my variable, and then do the first part etc., and then make it equal to the same, but I can't see what I have to pick to make sure the +1 is outside ofthe paranthesis.

Thanks for all the help so far though!
 
Level 25
Joined
Sep 26, 2009
Messages
2,378
when you are setting the value (after the '=' equal symbol) use the option "Arithmetic".
Arithmetic makes you chose an input A and input B and mathematic function (+, -, x, /).
As input A select the variable whose value you want to increment, as input B set number 1. As mathematic function use adding '+'.

X = (A o B) (<= the arithmetic option)
A = X
B = 1
o = +
=> X = (X + 1)

Or in your case, you use array X[]
X[] = X[] + 1


Else I have no idea what could be problematic in here.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
attachment.php


Hope that makes it a bit more clear.
 

Attachments

  • asdfadsfdsa.jpg
    asdfadsfdsa.jpg
    86.4 KB · Views: 162
Level 2
Joined
Jul 14, 2014
Messages
7
Thanks a lot, it works now! Not really sure what I did, cause in my first function I picked an arithmetic value too, but whatever : )
 
Status
Not open for further replies.
Top