Tutorial Leaderboards

Naminator

Coming Back To Life
Reaction score
76
Well..first of all Hi everyone. As you can see this it's my first tutorial, it's about leaderboard cause i don't see many of that. Well here it goes..

First Part: Creating The Leaderboard
The event to create the leaderboard has to be Time Elpased., it can't be Map Init. You can use periodic event to create a continue leadboard to register something like experience, but that's not what am going. First I recommend to use variable for player group, and destroy them by custom scrpit. Well let's see how.

Code:
Leaderboard Tutorial
    Acontecimientos
        Time - Elapsed game time is 1.00 seconds
    Condiciones
    Acciones
        Set Players_InGame = (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User)))
        Leaderboard - Create a leaderboard for (All players) titled .:Your Title Here:.

See that I set the Group Variable call [Players_InGame], you can put the name you want, and in that variable I check that the player I want to be on the leaderboard It's playing and It's a User.

Second Part: Setting The Players

Here we will set the players in the leaderboard with the action Player Group:, and then add them with correct label and the wanted value. Let's see how:

Code:
Leaderboard Tutorial
    Acontecimientos
        Time - Elapsed game time is 1.00 seconds
    Condiciones
    Acciones
        Set Players_InGame = (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User)))
        Leaderboard - Create a leaderboard for (All players) titled .:Your Title Here:.
        Set Leaderboard = (Last created leaderboard)
        Player Group - Pick every player in Players_InGame and do (Actions)
            Bucle: Actions
                Leaderboard - Add (Picked player) to Leaderboard with label (Name of (Picked player)) and value 0

I picked every player in my Group Variable and then add them to the leaderboard. I created a variable for the multiboard to use it later In the value you can put the number you want. I recommend 0, beacuse leaderboard are most use for counting kills.

Third Part Part: Finishing The Leaderboard

Well now that we create the leaderboard and set on the players, it's time to finish the creation, but that's not all. First we will show the leadboard to all players and if we want you can order the leaderboard. What do I mean by "order the leaderboard". Let's see how:

Code:
Leaderboard Tutorial
    Acontecimientos
        Time - Elapsed game time is 1.00 seconds
    Condiciones
    Acciones
        Set Players_InGame = (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User)))
        Leaderboard - Create a leaderboard for (All players) titled .:Your Title Here:.
        Set Leaderboard = (Last created leaderboard)
        Player Group - Pick every player in Players_InGame and do (Actions)
            Bucle: Actions
                Leaderboard - Add (Picked player) to Leaderboardwith label (Name of (Picked player)) and value 0
        Leaderboard - Show Leaderboard
        Custom script:   call DestroyForce (udg_Players_InGame)

See that I show the leaderboard to all player and then I sort it. At the final I use the Custom script to remove the Group Varible.


Third Part: Other Things

Leaves Game

Well let's say that a player has left the game and you want to put the word "Gone" in the player's label. Let's see how

Code:
Player Leaves
    Acontecimientos
        Player - Player 1 (red) leaves the game
    Condiciones
    Acciones
        Leaderboard - Change the label for (Triggering player) in Leaderboard to "Gone"

We must create this trigger to check that a playe leaves. I only put Player 1 but you can add the other players. See that I change to player Label to "Gone.

Kills

Now let's say that you want to control the kills. Let's see how:

Code:
Kills
    Acontecimientos
        Unit - A unit dies
    Condiciones
        ((Dying unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
    Acciones
        Set Kills[(Player number of (Owner of (Killing unit)))] = Kills[((Player number of (Owner of (Killing unit))) + 1)]
        Leaderboard - Change the value for (Owner of (Killing unit)) in Leaderboard to Kills[(Player number of (Owner of (Killing unit)))]

See that I created a variable for Kills. It's an Integer Variable with array. To check what player has kill the unit and add +1 to his value. Here you can sort the leaderboard. You can order the player depending of the value of the player. From bigger to smaller or backwards.

Code:
Leaderboard - Sort (Last created leaderboard) by Value in Descendant order

Fourth Part: Other Type Of Leaderboard

Team Leaderboard

You want to create a team leaderboard but you have no idea of Multiboards, you can easily create one with Leaderboards. Let's see how:

Code:
Team Leaderboard
    Acontecimientos
        Time - Elapsed game time is 1.00 seconds
    Condiciones
    Acciones
        Set Team_A = (All allies of Player 1 (red))
        Set Team_B = (All allies of Player 6 (orange))
        Leaderboard - Create a leaderboard for (All players) titled .:Team Leaderboard:.
        Set Leaderboard = (Last created leaderboard)
        Leaderboard - Add Neutral Hostile to Leaderboard with label |cffffcc00[First Team] and value 0
        Custom script:   set bj_wantDestroyGroup=true
        Player Group - Pick every player in Team_A and do (Actions)
            Bucle: Actions
                Leaderboard - Add (Picked player) to Leaderboard with label (Name of (Picked player)) and value 0
        Leaderboard - Add Neutral Victim to Leaderboard with label |cffffcc00[Second Team] and value 0
        Custom script:   set bj_wantDestroyGroup=true
        Player Group - Pick every player in Team_B and do (Actions)
            Bucle: Actions
                Leaderboard - Add (Picked player) to Leaderboard with label (Name of (Picked player)) and value 0
        Leaderboard - Mostrar Leaderboard

You see that I make to Group Variable. Team A and Team B. Before to add the Group Variable, mean the player. I add another one. Before Team A, I add Neutral Hostile and before Team B I add Neutral Victim. It separates one team from another, and it also can track the kills of the team.
"|cffffcc00", this I used to make it look more cool. It's the gold color.


Fifth Part: Leaderboard Things

Other things you can do with Leaderboard commands:

Leaderboard - Change the title of (Last created leaderboard) to <Your Title>

Leaderboard - Change the color of all labels for (Last created leaderboard) to (100.00%, 80.00%, 20.00%) with 0.00% transparency

Leaderboard - Change the color of all values for (Last created leaderboard) to (100.00%, 80.00%, 20.00%) with 0.00% transparency

Leaderboard - Change the display style for (Last created leaderboard) to Show the title, Show labels, Show values, and Show icons

Leaderboard - Remove Player 1 (red) from (Last created leaderboard)

Leaderboard - Change the color of the label for Player 1 (red) in (Last created leaderboard) to (100.00%, 80.00%, 20.00%) with 0.00% transparency

Leaderboard - Change the color of the value for Player 1 (red) in (Last created leaderboard) to (100.00%, 80.00%, 20.00%) with 0.00% transparency

Leaderboard - Change the display style for Player 1 (red) in (Last created leaderboard) to Show the label, Show the value, and Show the icon

Leaderboard - Change the color of the label for Player 1 (red) in (Last created leaderboard) to (100.00%, 80.00%, 20.00%) with 0.00% transparency



Well, that's all I can say. Hope it Helps! Thanks for reading. :D
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
890
Well, no offence, but this is kind of a mess. (I still love your Spanish editor, though. :p )

1. There is already a leaderboard tutorial here:

http://world-editor-tutorials.thehelper.net/leaderboard.php

2. Your first trigger:

Code:
Leaderboard Tutorial
    Acontecimientos
        Time - Elapsed game time is 1.00 seconds
    Condiciones
    Acciones
        Set Players_InGame = (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User)))
        Leaderboard - Create a leaderboard for (All players) titled .:Your Title Here:.
        Unit Group - Pick every player in Players_InGame and do (Actions)
            Bucle: Actions
                Leaderboard - Add (Picked player) to (Last created leaderboard) with label (Name of (Picked player)) and value 0

> Here we will set the players in the leaderboard with the action Unit Group

It should be Player Group, not Unit Group, and it leaks as well.

3. This trigger:

Code:
Leaderboard Tutorial
    Acontecimientos
        Time - Every 2.00 seconds of game time
    Condiciones
    Acciones
        Set Players_InGame = (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User)))
        Leaderboard - Create a leaderboard for (All players) titled .:Your Title Here:.
        Unit Group - Pick every player in Players_InGame and do (Actions)
            Bucle: Actions
                Leaderboard - Add (Picked player) to (Last created leaderboard) with label (Name of (Picked player)) and value 0
        Leaderboard - Show (Last created leaderboard)
        Custom script:   call DestroyForce (udg_Players_InGame)

You don't want to be creating a new leaderboard and adding players to it every 2 seconds. You already added the players in the previous trigger. Or is this supposed to be an expansion on the same trigger? If so, it has the wrong event.

> See that I show the leaderboard to all player and then I sort it.

I don't see a sort action. Only a Show action.

4. Here:

Code:
Player Leaves
    Acontecimientos
        Player - Player 1 (red) leaves the game
    Condiciones
    Acciones
        Leaderboard - Change the label for (Triggering player) in (Last created leaderboard) to "Gone"

Why are you still using (Last Created Leaderboard)? Set the leaderboard to a variable when you create it.

5. This:

Code:
Set Kills[(Player number of (Owner of (Dying unit)))] = Kills[((Player number of (Owner of (Killing unit))) + 1)]

That doesn't look right. Owner of Dying Unit and Owner of Killing Unit are two different players.

6. Please, please try to translate your Spanish editor, for others' sake. It makes it hard to tell what you mean sometimes.
 

Naminator

Coming Back To Life
Reaction score
76
Thanks. I make that mystake beacuse I was a little rush. I correct them right now. And in the actio of translating something I forgot to correct :D
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
890
Code:
Set Multiboard = (Last created leaderboard)

I wouldn't call it Multiboard since that is a whole different concept.
 

Xapphire

Liberty, Simply said; a lie.
Reaction score
45
This is pretty handy, i dont think anyone would search for this topic in specific, but its nice.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
890
> What do you mean by a whole different concept?

There are leaderboards, then there are multiboards. Both show a 'board' at the top of the screen, but they are quite different. I think you should change the name of that variable to avoid confusion.
 

Xapphire

Liberty, Simply said; a lie.
Reaction score
45
Ghan is right, a multi board can have different features than a leader board, it is a whole different trigger system. A multiboard has nothing to do with a leader board but the fact that they both represent aspects of the game categorized and shown for you, both very different therefore a variable named multiboard, should not be a leaderboard. :D
 

Naminator

Coming Back To Life
Reaction score
76
> What do you mean by a whole different concept?

There are leaderboards, then there are multiboards. Both show a 'board' at the top of the screen, but they are quite different. I think you should change the name of that variable to avoid confusion.

Right. What was I thinking..
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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