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
889
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
889
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
889
> 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.
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top