How to: Create a leaderboard

This is a discussion on How to: Create a leaderboard within the Warcraft 3 Custom Maps board part of the Warcraft 3 forum category; I just found this guide which explains some things about leaderboards Hope its worth reading Credits: Warcraft III World Editor, ...

Results 1 to 7 of 7
  1. #1
    MaRcDk is offline Business Owner

    Array
    Join Date
    May 2007
    Location
    Seattle
    Posts
    2,054
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    25
    Reputation
    2239

    How to: Create a leaderboard

    I just found this guide which explains some things about leaderboards Hope its worth reading
    Credits: Warcraft III World Editor, Warcraft III Map Making Tutorials, Warcraft III Scripting, Warcraft III Maps - World-Editor-Tutorials.thehelper.net


    About Leaderboards
    Leaderboards are a very simple score board for players to keep track of their kills or points. You don't need any tools or other programs to make one. Leaderboards can only keep track of two columns; a name and a value. If you need more than two columns, you need to create a multiboard. However, leaderboards are a lot more simple to create.



    Leader boards can only
    keep track of two columns.

    The left side is the players'
    label, and the right is the
    player value.


    When laying out your leaderboard, remember that they accept the standard Warcraft color codes and characters. You can use a color coding program to create a nice title, and space it out on different lines as shown. You can also later modify the title and properties of the leaderboard contents. All you need to create a leaderboard is two triggers. One to create the board, and one to keep score.

    Leaderboards can only keep track of a name, and a value.
    Leaderboards can use the common Warcraft color codes.
    Leaderboards can be assigned a variable, to show and hide them easily.
    A leaderboard cannot be created at map initialization.
    A leaderboard is a lot more simple than a multiboard.
    Creating a Leaderboard
    You cannot create the board at map initialization. This is a very common reason a leaderboard doesn't work. You can create the board after doing various things at the start of the map, or you can just have it wait 5 seconds or so. Most of my maps do the map initialization first, then call a separate trigger to create the board when done. Waiting a little also helps with laggers who drop at the beginning of the game. In this example trigger, I am going to wait five seconds.

    My example is simple. Five seconds into the game, pick all players and check that they are playing, and controlled by a user. Add each of these players to the leaderboard. When it's done, show the leaderboard to all players.

    Example trigger creating a leaderboard.
    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)
    Tallying Score
    A leaderboard can keep track of several different things. Maybe you want your board to keep track of kills. If your playing capture the flag, you would want to keep track of flags stolen. Because the board works off integers, you can assign it any integer values you like.
    In my map, I want the leaderboard to keep track of kills. Of course, this is the most common use for a leaderboard. So I will first need to create a variable to keep track of kills for each player. I will open the variable editor, and create a new integer variable called Player_Kills. Then I will check the Array box to keep track of more than one value

    Adding a variable to keep score


    Now we will need a trigger to tally score. Again, leaderboards work on values and integers. In my example, I need to keep track of kills. Sometimes you might want to keep track of just HERO kills. Other times, like a tower defense, you would keep track of ALL kills. You can also add conditions to limit what kinds of kills are legitimate.

    You only want to update the board when the score changes. I am highly against updating the board at any other time. You can see maps online where the players jump all around the leaderboard, because they are all zero. This is not only annoying, its bad practice and it can cause lag.

    My example trigger is really simple. The trigger will run every time a unit dies. First it will check that the killing unit belongs to a player, and not a computer. Then It will add one point to the owner of the killing units score. Lastly, it will update the leaderboard value for that player.

    Trigger to tally score.

    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

    Appendix of Trigger Functions

    Leaderboard - Create
    Creates the leaderboard. Also assigns a title and which players can see it.

    Leaderboard - Destroy
    Destroys a leaderboard. Once you destroy a board, you can no longer see it or manipulate it.

    Leaderboard - Show/Hide
    Shows and hides the leaderboard. Applies to all players that can see it. You can still manipulate the board when it is hidden.

    Leaderboard - Change Title
    Changes the title of the leaderboard. Remember, it can use common Warcraft color codes as well.

    Leaderboard - Change Label Colors
    Changes the color of a players label. By default, the label will be the game color of that player. So player number 1 is red, and player number 4 is purple.

    Leaderboard - Change Value Colors
    Changes the color of a players score. Again by default, this will correspond with the players game color.

    Leaderboard - Change Style
    Changes the leaderboard style. You can hide the title, labels, or player values, for all players.

    Leaderboard - Add Player
    Adds a player to the leaderboard.

    Leaderboard - Remove Player
    Removes a player from the leaderboard. This is handy when a player quits or is defeated.

    Leaderboard - Change Player Label
    Changes the label for a player. Usually, this is the name of the player. Some maps change the name to (Quit) when a player leaves.

    Leaderboard - Change Player Label Color
    Changes the color of a players label. This is also handy if someone leaves. Sometimes the player name will change gray.

    Leaderboard - Change Player Value
    Updates the value, or score, for a player.

    Leaderboard - Change Player Value Color
    Changes the color of a players score. Again by default, this will correspond with the players game color.

    Leaderboard - Change Player Style
    Changes the leaderboard style. You can hide the labels or player values, for a specific player.


    Enjoy
    Last edited by MaRcDk; 06-05-2008 at 02:12 PM.

  2. #2
    vegeta_020's Avatar
    vegeta_020 is offline Newbie
    Array
    Join Date
    Jan 2009
    Location
    Dubrovnik, Croatia
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    0
    Reputation
    0

    Unhappy I dont wanna bother you

    I am making a really great Resident Evil survival coop, but i need leaderboard so the killing of unlimited masses of zombies would make some sense... I tried to make leaderboard following your steps, but when i have to make "Trigger Tally Score", in the step where i have to do this:

    "Leaderboard - Change the value for (Owner of (Killing unit)) in (Last created leaderboard) to 0"


    i cant change that 0 to variable Player_Kills... It just says that there are no variables thac can be used... I beg you to help me, because it is really important

  3. #3
    risker is offline Banned User Array
    Join Date
    Oct 2008
    Location
    Australia
    Posts
    2,733
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    0
    Reputation
    673
    Its because you need to make something to record the killers?

    Calls player_kills
    Returns nothing

    You need to make that variable something lol

    Calls player_kills
    Returns ((Checks)) xxxMany of have been killed

    It doens't just record it for you Lol

    No i have no read the guide above so yea
    I may just be making no sense

    If you really need help to the helperforum and ask them

  4. #4
    vegeta_020's Avatar
    vegeta_020 is offline Newbie
    Array
    Join Date
    Jan 2009
    Location
    Dubrovnik, Croatia
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    0
    Reputation
    0

    Question :D

    The problem is that i followed the whole process, and i've made that variable, and it works in every step before described... But now, when i have to finish the job, it just wont show up... and everything seems ok... :frown:

  5. #5
    risker is offline Banned User Array
    Join Date
    Oct 2008
    Location
    Australia
    Posts
    2,733
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    0
    Reputation
    673
    Hmmm........
    Well obviously it isn't D:

    I'd ask to check but i feel like a dog

    thehelper.net/
    Go to there and post it up and ask for help

  6. #6
    Reinn's Avatar
    Reinn is offline Multi-qouter

    Array
    Join Date
    May 2008
    Location
    Denmark
    Posts
    1,894
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    21
    Reputation
    1846
    Quote Originally Posted by risker View Post
    Hmmm........
    Well obviously it isn't D:

    I'd ask to check but i feel like a dog

    thehelper.net/
    Go to there and post it up and ask for help
    Hmmm... I hope you find your answer...


    Btw. Risker: Add this to your sig: "Jeg skal fandme slå jer!"
    // Reinn

  7. #7
    greekk1 is offline Wannabe Member
    Array
    Join Date
    Aug 2010
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rep Power
    10
    Reputation
    1
    one problem with this, and if anyone could help me with a fix, it'd be appreciated thorns aura (Or spiked barricades) adding a kill to the wrong person.
    example
    Player red has spiked barricades.
    Player Blue attacks red, Player blue dies from barricades eventually.
    (Player number of (Owner of (Killing unit)))] + 1) <-- Killing unit, Blue technically Killed himself.
    What could I change it to, to fix it?

Similar Threads

  1. Create a Tower Defense (TD) Map!
    By GodOfWar in forum Warcraft 3 Custom Maps
    Replies: 4
    Last Post: 01-03-2010, 03:56 AM
  2. How to: Create a Creep Revival System
    By MaRcDk in forum Warcraft 3 Custom Maps
    Replies: 4
    Last Post: 05-27-2009, 11:34 AM
  3. How to: Create Chat over Unit
    By MaRcDk in forum Warcraft 3 Custom Maps
    Replies: 5
    Last Post: 06-02-2008, 10:04 PM
  4. i need help <.<
    By im1337 in forum WoW Private Servers
    Replies: 0
    Last Post: 06-25-2007, 02:52 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •