Leaderboard help.

Troll

New Member
Reaction score
4
Code:
Setup
    Events
        Time - Elapsed game time is 15.00 seconds
    Conditions
    Actions
        Leaderboard - Create a leaderboard for (All players) titled Footmen Frenzy TS v...
        Set Leaderboard = (Last created leaderboard)
        If ((Player 1 (Red) slot status) Equal to Is playing) then do (Leaderboard - Add Player 1 (Red) to Leaderboard with label (Name of Player 1 (Red)) and value 0) else do (Do nothing)
        If ((Player 2 (Blue) slot status) Equal to Is playing) then do (Leaderboard - Add Player 2 (Blue) to Leaderboard with label (Name of Player 2 (Blue)) and value 0) else do (Do nothing)
        If ((Player 3 (Teal) slot status) Equal to Is playing) then do (Leaderboard - Add Player 3 (Teal) to Leaderboard with label (Name of Player 3 (Teal)) and value 0) else do (Do nothing)
        If ((Player 4 (Purple) slot status) Equal to Is playing) then do (Leaderboard - Add Player 4 (Purple) to Leaderboard with label (Name of Player 4 (Purple)) and value 0) else do (Do nothing)
        If ((Player 5 (Yellow) slot status) Equal to Is playing) then do (Leaderboard - Add Player 5 (Yellow) to Leaderboard with label (Name of Player 5 (Yellow)) and value 0) else do (Do nothing)
        If ((Player 6 (Orange) slot status) Equal to Is playing) then do (Leaderboard - Add Player 6 (Orange) to Leaderboard with label (Name of Player 6 (Orange)) and value 0) else do (Do nothing)
        If ((Player 7 (Green) slot status) Equal to Is playing) then do (Leaderboard - Add Player 7 (Green) to Leaderboard with label (Name of Player 7 (Green)) and value 0) else do (Do nothing)
        If ((Player 8 (Pink) slot status) Equal to Is playing) then do (Leaderboard - Add Player 8 (Pink) to Leaderboard with label (Name of Player 8 (Pink)) and value 0) else do (Do nothing)
        If ((Player 9 (Gray) slot status) Equal to Is playing) then do (Leaderboard - Add Player 9 (Gray) to Leaderboard with label (Name of Player 9 (Gray)) and value 0) else do (Do nothing)
        If ((Player 10 (Light Blue) slot status) Equal to Is playing) then do (Leaderboard - Add Player 10 (Light Blue) to Leaderboard with label (Name of Player 10 (Light Blue)) and value 0) else do (Do nothing)
        If ((Player 11 (Dark Green) slot status) Equal to Is playing) then do (Leaderboard - Add Player 11 (Dark Green) to Leaderboard with label (Name of Player 11 (Dark Green)) and value 0) else do (Do nothing)
        If ((Player 12 (Brown) slot status) Equal to Is playing) then do (Leaderboard - Add Player 12 (Brown) to Leaderboard with label (Name of Player 12 (Brown)) and value 0) else do (Do nothing)
        Leaderboard - Show Leaderboard
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                (Player 1 (Red) slot status) Equal to Has left the game
                (Player 2 (Blue) slot status) Equal to Has left the game
                (Player 3 (Teal) slot status) Equal to Has left the game
                (Player 4 (Purple) slot status) Equal to Has left the game
                (Player 5 (Yellow) slot status) Equal to Has left the game
                (Player 6 (Orange) slot status) Equal to Has left the game
                (Player 7 (Green) slot status) Equal to Has left the game
                (Player 8 (Pink) slot status) Equal to Has left the game
                (Player 9 (Gray) slot status) Equal to Has left the game
                (Player 10 (Light Blue) slot status) Equal to Has left the game
                (Player 11 (Dark Green) slot status) Equal to Has left the game
                (Player 12 (Brown) slot status) Equal to Has left the game
            Then - Actions
                Leaderboard - Remove (Triggering player) from (Last created leaderboard)
            Else - Actions



Code:
Tally Kills
    Events
        Unit - A unit Dies
    Conditions
        ((Triggering unit) is A Hero) Equal to True
        ((Triggering unit) belongs to an enemy of (Owner of (Killing unit))) Equal to True
    Actions
        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)))]



i took this from a template, but i wonder how to change the players name to "has left the game" when a player leaves the game ... my code is correct? and if it is a leader board, why the most killer's name stay at the same spot instead of going to the top of all player's names ... what could be the exact code for this?
 

Exide

I am amazingly focused right now!
Reaction score
448
>but i wonder how to change the players name to "has left the game" when a player leaves the game
Try using a new trigger with the event 'Player - Player 1 (Red) leaves the game' (one for each player), then update your leaderboard accordingly.
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
> So what is it that you need help with?

Well, he needs someone to tell him to make a separate trigger that waits for "player ... leaves the game",
and changes the name of "triggering player" accordingly.

At the same time, remove that entire "if" from the initial leaderboard trigger.


The second part needs an extra action: "Leaderboard: sort ...".
 

CaptDeath

New Member
Reaction score
103
First off i dont have wc3 on this comp
so this is free hand
Code:
create A variable [By clicking the yellow X... Going new variable and label it as PLG
Code:
Now make a trigger
Events
Map ini
C
A
Set Variable PLG to Has Left The Game!
now when some one leaves you replace their name on the leader board with the variable string PLG
since i dont have wc3 atm i cant show you that trigg
 
R

Rhaged

Guest
Might i suggest a mutli board instead of a lead board?
I found this sorta tutorial a while ago, and just copied the triggers in,
http://www.epicwar.com/maps/5985/
Ive also editied it to suit my needs,


Code:
Create Multiboard
    Events
        Time - Elapsed game time is 1.00 seconds
    Conditions
    Actions
        Set Player_Count = (Number of players in (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing))))
        Multiboard - Create a multiboard with 3 columns and (1 + Player_Count) rows, titled |c0001B9FCPlayer Sc...
        Multiboard - Set the text for (Last created multiboard) item in column 2, row 1 to |c0001B9FCPlayer Na...
        Multiboard - Set the text for (Last created multiboard) item in column 3, row 1 to |c0001B9FCPoints|r
        For each (Integer A) from 1 to (1 + Player_Count), do (Actions)
            Loop - Actions
                Multiboard - Set the display style for (Last created multiboard) item in column 1, row 1 to Show text and Hide icons
                Multiboard - Set the display style for (Last created multiboard) item in column 1, row (Integer A) to Show text and Show icons
                Multiboard - Set the display style for (Last created multiboard) item in column 2, row (Integer A) to Show text and Hide icons
                Multiboard - Set the display style for (Last created multiboard) item in column 3, row (Integer A) to Show text and Hide icons
                Multiboard - Set the width for (Last created multiboard) item in column 1, row (Integer A) to 2.00% of the total screen width
                Multiboard - Set the width for (Last created multiboard) item in column 2, row (Integer A) to 8.00% of the total screen width
                Multiboard - Set the width for (Last created multiboard) item in column 3, row (Integer A) to 8.00% of the total screen width
        Set List = 2
        Set Temp_Player_Group = (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User)))
        Player Group - Pick every player in Temp_Player_Group and do (Actions)
            Loop - Actions
                Set Multiboard_Spots[(Player number of (Picked player))] = List
                Multiboard - Set the icon for (Last created multiboard) item in column 1, row List to ReplaceableTextures\CommandButtons\BTNVillagerMan.blp
                Multiboard - Set the text for (Last created multiboard) item in column 2, row List to (Player_Colors[(Player number of (Picked player))] + ((Name of (Picked player)) + |r))
                Multiboard - Set the text for (Last created multiboard) item in column 3, row List to (Player_Colors[(Player number of (Picked player))] + (1000 + |r))
                Set List = (List + 1)
        Multiboard - Show (Last created multiboard)
        Custom script:   call DestroyForce (udg_Temp_Player_Group)
        Custom script:   call DestroyTrigger(GetTriggeringTrigger())

Code:
Player Points Update
    Events
        Unit - A unit Dies
    Conditions
        ((Player((Player number of (Owner of (Killing unit))))) slot status) Equal to Is playing
    Actions
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Owner of (Killing unit)) controller) Equal to User
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        ((Owner of (Triggering unit)) Not equal to Player 6 (Orange)) or ((Owner of (Triggering unit)) Equal to Player 12 (Brown))
                    Then - Actions
                        Set Points[(Player number of (Owner of (Killing unit)))] = (Points[(Player number of (Owner of (Killing unit)))] + ((Point-value of (Dying unit)) + (Random integer number between 1 and 10)))
                        Multiboard - Set the text for (Last created multiboard) item in column 3, row Multiboard_Spots[(Player number of (Owner of (Killing unit)))] to (Player_Colors[(Player number of (Owner of (Killing unit)))] + ((String(Points[(Player number of (Owner of (Killing unit)))])) + |r))
                    Else - Actions
                        Do nothing
            Else - Actions
                Do nothing
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                ((Owner of (Killing unit)) controller) Equal to Computer
            Then - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Killing unit)) Equal to Player 6 (Orange)
                    Then - Actions
                        Set Temp_Player_Group = (All allies of Player 6 (Orange))
                        Player Group - Pick every player in Temp_Player_Group 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
                                    Then - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                (Owner of (Dying unit)) Not equal to Player 12 (Brown)
                                            Then - Actions
                                                Set Points[(Player number of (Picked player))] = (Points[(Player number of (Picked player))] + (((Point-value of (Dying unit)) / (Number of players in (All allies of Player 6 (Orange)))) + (Random integer number between 1 and 10)))
                                                Multiboard - Set the text for (Last created multiboard) item in column 3, row Multiboard_Spots[(Player number of (Picked player))] to (Player_Colors[(Player number of (Picked player))] + ((String(Points[(Player number of (Picked player))])) + |r))
                                            Else - Actions
                                                Do nothing
                                    Else - Actions
                                        Do nothing
                    Else - Actions
                        Do nothing
                Custom script:   call DestroyForce (udg_Temp_Player_Group)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Owner of (Killing unit)) Equal to Player 12 (Brown)
                    Then - Actions
                        Set Temp_Player_Group = (All allies of Player 12 (Brown))
                        Player Group - Pick every player in Temp_Player_Group 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
                                    Then - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                (Owner of (Dying unit)) Equal to Player 6 (Orange)
                                            Then - Actions
                                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                                    If - Conditions
                                                        (Owner of (Dying unit)) Not equal to Player 6 (Orange)
                                                    Then - Actions
                                                        Set Points[(Player number of (Picked player))] = (Points[(Player number of (Picked player))] + (((Point-value of (Dying unit)) / (Number of players in (All allies of Player 6 (Orange)))) + (Random integer number between 1 and 10)))
                                                        Multiboard - Set the text for (Last created multiboard) item in column 3, row Multiboard_Spots[(Player number of (Picked player))] to (Player_Colors[(Player number of (Picked player))] + ((String(Points[(Player number of (Picked player))])) + |r))
                                                    Else - Actions
                                                        Do nothing
                                            Else - Actions
                                                Do nothing
                                    Else - Actions
                                        Do nothing
                    Else - Actions
                        Do nothing
                Custom script:   call DestroyForce (udg_Temp_Player_Group)
            Else - Actions
                Do nothing

Code:
Player leaves
    Events
        Player - Player 1 (Red) leaves the game
        Player - Player 2 (Blue) leaves the game
        Player - Player 3 (Teal) leaves the game
        Player - Player 4 (Purple) leaves the game
        Player - Player 5 (Yellow) leaves the game
        Player - Player 6 (Orange) leaves the game
        Player - Player 7 (Green) leaves the game
        Player - Player 8 (Pink) leaves the game
        Player - Player 9 (Gray) leaves the game
        Player - Player 10 (Light Blue) leaves the game
        Player - Player 11 (Dark Green) leaves the game
        Player - Player 12 (Brown) leaves the game
    Conditions
    Actions
        Set Temp_Unit_Group = (Units owned by (Triggering player))
        Unit Group - Pick every unit in Temp_Unit_Group and do (Actions)
            Loop - Actions
                Unit - Remove (Picked unit) from the game
                Multiboard - Set the text for (Last created multiboard) item in column 0, row Multiboard_Spots[(Player number of (Triggering player))] to                    
                Multiboard - Set the text for (Last created multiboard) item in column 0, row Multiboard_Spots[(Player number of (Triggering player))] to (Player_Colors[(Player number of (Triggering player))] + Left|r)
        Custom script:   call DestroyGroup (udg_Temp_Unit_Group)
The following color list is fairly close to player colors, 1-12, red is 1, brown is 12
Code:
Define Colors
    Events
        Map initialization
    Conditions
    Actions
        Set Player_Colors[1] = |c00ff0000
        Set Player_Colors[2] = |c000000ff
        Set Player_Colors[3] = |c0000ffff
        Set Player_Colors[4] = |c00800080
        Set Player_Colors[5] = |c00ffff00
        Set Player_Colors[6] = |c00ff8000
        Set Player_Colors[7] = |c0000ff00
        Set Player_Colors[8] = |c00ff00ff
        Set Player_Colors[9] = |c00959697
        Set Player_Colors[10] = |c007EBFF1
        Set Player_Colors[11] = |c00004040
        Set Player_Colors[12] = |c00ff00ff
        Custom script:   call DestroyTrigger(GetTriggeringTrigger())
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top