Leaderboard Help

Shimergloom

New Member
Reaction score
6
My leaderboard counts hero/unit kills and displays it for each active player but it only actually counts Red's kills then displays it for all players. It's seperated into 3 triggers. Just need to get it to count and display the kills of the individual players.

PHP:
Make Board
Events:
          Map initialization

Actions:
          Wait 5.00 seconds
          Leaderboard - Create a leaderboard for (All players) titled Hero Kill Differential
          Player Group - Pick every player in (All players) and do (If ((((Picked player) controller) Equal to User) and (((Picked player) slot status) Equal to Is playing)) then do (Leaderboard - Add (Picked player) to (Last created leaderboard) with label (Name of (Picked player)) and value 0) else do (Do nothing))


PHP:
Adjust Score Hero Kill
Events:
           Unit - A unit owned by Player 1-11 Dies

Conditions:
           ((Dying unit) is A Hero) Equal to True

Actions:
           Set leaderboarddeaths[(Player number of (Owner of (Dying unit)))] = (leaderboarddeaths[(Player number of (Owner of (Dying unit)))] - 1)
           Set leaderboarddeaths[(Player number of (Owner of (Killing unit)))] = (leaderboarddeaths[(Player number of (Owner of (Killing unit)))] + 1)
           Leaderboard - Sort playerkillleader by Value in Descending order


PHP:
Adjust Score Unit Kill
Events: 
           Unit - A unit owned by Player 10 (Light Blue) Dies
           Unit - A unit owned by Player 12 (Brown) Dies


Actions:
           Set unitkills[(Player number of (Owner of (Killing unit)))] = (unitkills[(Player number of (Owner of (Killing unit)))] + 1)
           Leaderboard - Sort unitkillleader by Value in Descending order
 
C

call me Mike

Guest
originally posted by 'SD_Ryoko'

Code:
Leaderboard
 Events
     Time - Elapsed game time is 5.00 seconds
 Conditions
(None)
 Actions
     Leaderboard - Create a leaderboard for (All players) titled (Your Title Here)
     Custom script:   set bj_wantDestroyGroup=true
     Player Group - Pick every player in (All players) and do (Actions)
         Loop - Actions
             If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                 If - Conditions
                     ((Picked player) controller) Equal to User
                     ((Picked player) slot status) Equal to Is playing
                 Then - Actions
                     Leaderboard - Add (Picked player) to (Last created leaderboard)
                     with label (Name of (Picked player)) and value 0
                 Else - Actions
                     Do nothing
     Leaderboard - Show (Last created leaderboard) (Must come last)

Code:
Trigger Tally Score

    Events
        Unit - A unit Dies
    Conditions
        ((Killing unit) belongs to an ally of Player 1 (Red)) Equal to True
    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


Its fairly simple and strait forward.

Hope it helps ^_^

(you can also find this Here! with other information on making leaderboards)
 

Shimergloom

New Member
Reaction score
6
PHP:
Leaderboard - Change the value for (Owner of (Killing unit)) in
        (Last created leaderboard) to Player_Kills[(Player number of (Owner of (Killing unit)))]

If I don't use the above function, the values never change. If I do use that function, the values change as soon as the unit death occurs. I have alternating values, so this is a problem because, rather then the values changing without being displayed or as soon as the proper field is displayed, they change immediatly, regardless of what's supposed to be showing.
Basicly if Hero Kills are being displayed and you kill even 1 unit, it shows your unit kills while still saying that Hero Kills are being displayed. How do I make it wait until that value is supposed to be displayed rather than displaying when it's changed?
 
M

MikeTheGuy

Guest
I'm no expert, but in the Tally Score trigger, you should also add a condition "Dying unit equal to Hero". That should stop unit kills from being tallied.
 

Shimergloom

New Member
Reaction score
6
Quick Variable Question

How can I get a variable to keep updating until another action happens? Without setting it to change every 0.1 seconds or something. I've already tried looping it.
 

Andrewgosu

The Silent Pandaren Helper
Reaction score
716
What exactly are You trying to do? You have to periodically update it. How, depends on what You are trying to do.
 

Shimergloom

New Member
Reaction score
6
The values on my leaderboard switch every 5 seconds between unit and hero kills. When they switch, the values are updated, but the scores won't change until it changes again so if you have 15 unit kills and make 15 more, it won't show you haveing 30 until it switchs to hero kills, and back to unit kills. I need it to update every time you get a kill.
 
S

Shades-X

Guest
When you kill a unit set the variable equal to the variable +1 that should do it for you!
 

Shimergloom

New Member
Reaction score
6
I do, and that works on a normal leaderboard, but because it switches between hero and unit kills it only updates them when they're first displayed.
 
S

Shades-X

Guest
Post the trigger, we might be able to help you better! And also explain exactly what you want!
 

Shimergloom

New Member
Reaction score
6
Ok, the whole leaderboard trigger is in 4 parts. I want the score to change as soon as a kill is made but not be displayed under the wrong category. (unit kills under hero kills, hero under unit) If you've played Hero Wars Exiled and remember the leaderboard from that, that's what I want.

PHP:
Make Board
Events - 
            Time - Elapsed game time is 5.00 seconds

Actions - 
            Leaderboard - Create a leaderboard for (All players) titled Hero Kill Different...
            Player Group - Pick every player in (All players) and do (Actions)
    Loop - Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Picked player) controller) Equal to User
                ((Picked player) slot status) Equal to Is playing
            Then - Actions
                Leaderboard - Add (Picked player) to (Last created leaderboard) with label (Name of (Picked player)) and value 0
            Else - Actions
                Do nothing
             Leaderboard - Show (Last created leaderboard)
             Countdown Timer - Start Leaderboardtimer2 as a Repeating timer that will expire in 10.00 seconds

PHP:
Board Shift
Events - 
            Time - Leaderboardtimer2 expires

Actions - 
            Leaderboard - Change the title of (Last created leaderboard) to Unit Kills
            Player Group - Pick every player in (All players) and do (Actions)
    Loop - Actions
        Leaderboard - Change the value for (Picked player) in (Last created leaderboard) to unitkills[(Player number of (Picked player))]
            Wait 5.00 seconds
            Leaderboard - Change the title of (Last created leaderboard) to Hero Kill Different...
            Player Group - Pick every player in (All players) and do (Actions)
    Loop - Actions
        Leaderboard - Change the value for (Picked player) in (Last created leaderboard) to leaderboarddeaths[(Player number of (Picked player))]

PHP:
Adjust Score Hero Kill
Events - 
            Unit - A unit Dies

Conditions - 
            ((Dying unit) is A Hero) Equal to True

Actions - 
            Set leaderboarddeaths[(Player number of (Owner of (Killing unit)))] = (leaderboarddeaths[(Player number of (Owner of (Killing unit)))] + 1)
            Set leaderboarddeaths[(Player number of (Owner of (Dying unit)))] = (leaderboarddeaths[(Player number of (Owner of (Dying unit)))] - 1)
            Leaderboard - Sort playerkillleader by Value in Descending order

PHP:
Adjust Score Unit Kill
Events - 
            Unit - A unit owned by Player 10 (Light Blue) Dies
            Unit - A unit owned by Player 12 (Brown) Dies

Actions - 
            Set unitkills[(Player number of (Owner of (Killing unit)))] = (unitkills[(Player number of (Owner of (Killing unit)))] + 1)
            Leaderboard - Sort unitkillleader by Value in Descending order

Final note, this function won't work:

PHP:
Leaderboard - Change the value for (Owner of (Killing unit)) in unitkillleader to (unitkills[(Player number of (Owner of (Killing unit)))] + 1)
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> but not be displayed under the wrong category.

Care to explain what that's supposed to mean?
A leaderboard has one value per player. There are no "categories".

> If you've played Hero Wars Exiled

Never seen it.


> Leaderboard - Change the value for (Owner of (Killing unit)) in unitkillleader to (unitkills[(Player number of (Owner of (Killing unit)))] + 1)

This will take whatever value you have in that array, add 1 to it, and show it in your leaderboard.

Since it isn't updating the array, this will always show the very same value.


Well, whatever.
Without any details on what exactly you're trying here... it's somewhat difficult to help.
 

Shimergloom

New Member
Reaction score
6
Without any details on what exactly you're trying here... it's somewhat difficult to help.
Ok, I'll explain it again and try to be absolutely clear. This time with pictures. :)

5 Seconds after the game is initialized a leaderboard titled "Hero Kill Differential" is created.
5 Seconds after that board is created, the values for each player are changed to unitkills from hero kills and the title is changed to "Unit Kills".
5 Seconds after that, it switches back to hero kills, then back to unit after 5, and so on.

As the board is right now, when a kill is made, it is not immediatly displayed on the board. If unit kills are being displayed (refer to picture 1) only the kills you had when unit kills was first displayed will be on the board. Once it switches to hero kills and back to unit kills, your score is updated. (refer to picture 2)

#1
5yrn0c8.jpg

(kills displayed = 31, actual kills = 38)

#2
6g9y0s3.jpg

(kills displayed = 38, actual kills = 38)

Clear? Ok, well what I want the leaderboard to do is update as soon as you get the kill, which it will do if I use the below function. The problem with using that is it will update unit kills even if hero kills are being displayed. (refer to picture 3)

PHP:
Leaderboard - Change the value for (Owner of (Killing unit)) in (Last created leaderboard) to (unitkills[(Player number of (Owner of (Killing unit)))] + 1)

#3
52m57x0.jpg

(hero kills displyed = 11, actual hero kills = 0, actual unit kills = 11)

So, I need it to update your kills as the kills are made but not display them unless that specific kill is supposed to be displayed (hero or unit). I basicly want it to work like the HW Exiled Leaderboard, but HW Exiled is protected so I can't get in to see how they made their leaderboard.
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top