"Dota's" -cson (Leaderboard) how to?

Fulla

Evil Overlord
Reaction score
31
-cson

this is a command that a player can type in to display for that player ONLY:
Creep Kills: 0 Denies: 0

It then updates for amount of enemy and friendly creeps killed.
I know what hes done sort of.

the string value = Creep Kills: 0 Denies:
the integer value = 0

I tried to make it but it doesnt just remian '1 line' and the space between Denies: & 0 is enormous.
-cson.jpg
 

SFilip

Gone but not forgotten
Reaction score
633
I guess you added all players to the leaderboard...you only need one.
 

SFilip

Gone but not forgotten
Reaction score
633

Fulla

Evil Overlord
Reaction score
31
hmm I tried, but nothing happens :-(

Code:
function Trig_Creep_Stats_ON_Actions takes nothing returns nothing
    local player p = GetTriggerPlayer()
    local leaderboard l = CreateLeaderboard()
    call LeaderboardAddItem(l, "Creep Kills: 0     Denies:", 0, p)
    if GetLocalPlayer() == p then
        call LeaderboardDisplay(l, true)
    endif
endfunction

//===========================================================================
function InitTrig_Creep_Stats_ON takes nothing returns nothing
    set gg_trg_Creep_Stats_ON = CreateTrigger()
    call TriggerRegisterPlayerChatEvent(gg_trg_Creep_Stats_ON, Player(0), "-cson", true)
    call TriggerRegisterPlayerChatEvent(gg_trg_Creep_Stats_ON, Player(1), "-cson", true)
    call TriggerRegisterPlayerChatEvent(gg_trg_Creep_Stats_ON, Player(2), "-cson", true)
    call TriggerRegisterPlayerChatEvent(gg_trg_Creep_Stats_ON, Player(3), "-cson", true)
    call TriggerRegisterPlayerChatEvent(gg_trg_Creep_Stats_ON, Player(4), "-cson", true)
    call TriggerRegisterPlayerChatEvent(gg_trg_Creep_Stats_ON, Player(5), "-cson", true)
    call TriggerRegisterPlayerChatEvent(gg_trg_Creep_Stats_ON, Player(6), "-cson", true)
    call TriggerRegisterPlayerChatEvent(gg_trg_Creep_Stats_ON, Player(7), "-cson", true)
    call TriggerRegisterPlayerChatEvent(gg_trg_Creep_Stats_ON, Player(8), "-cson", true)
    call TriggerRegisterPlayerChatEvent(gg_trg_Creep_Stats_ON, Player(9), "-cson", true)
    call TriggerRegisterPlayerChatEvent(gg_trg_Creep_Stats_ON, Player(10), "-cson", true)
    call TriggerRegisterPlayerChatEvent(gg_trg_Creep_Stats_ON, Player(11), "-cson", true)
    call TriggerAddAction(gg_trg_Creep_Stats_ON, function Trig_Creep_Stats_ON_Actions)
endfunction
 
I

IKilledKEnny

Guest
I'm working on a MultiBoard for you right now, I'll see if I can get it right. By the Way just notice this:

Code:
    call LeaderboardAddItem(l, "Creep Kills: 0     Denies:[B]"[/B], 0, p)

Should be (I believe, correct me if I'm wrong)

Code:
    call LeaderboardAddItem(l, "Creep Kills: 0     Denies:0[B]"[/B] , p)

Again, I'm not 100% sure, just a wild guess.
 
I

IKilledKEnny

Guest
Ok I'm not 100% sure if it will show it only for one player, but i'm pretty sure it will. If it won't let me know, there is another slightly longer way to do it. If I made horrible mistakes also please to flame me, still learning JASS. :)

There are 3 Triggers, I left the 4th one to you, the 4th one should update that MultiBoard (yes this is a MultiBoad) when units are killed. If you don't how to do that I'll do that also, but you need to tell me when each integer should be updated. You need MultiBoard Variable (MB) with array of 12, and also 2 integer variables with the same array (Creeps, Denies).

Create Trigger named: MB Events, Convert it to text and paste:

Code:
function Trig_MB_Events_Actions takes nothing returns nothing
local integer array i // We create integer for loop
set i[1] = 0 // Starting Integer for loop
set i[2] = 11 // Ending integer for loop
loop // We start loop
    exitwhen i[1] > i[2] // Set condition to loop
    call TriggerRegisterPlayerChatEvent( gg_trg_MB_Show, ConvertedPlayer(i[1]), "-cson", true ) // Add Event to MB Show Trigger
    set i[1] = i[1] + 1 // Increase i[1] for the condition
endloop // We end loop
    
endfunction

//===========================================================================
function InitTrig_MB_Events takes nothing returns nothing
    set gg_trg_MB_Events = CreateTrigger(  )
    call TriggerAddAction( gg_trg_MB_Events, function Trig_MB_Events_Actions )
endfunction

Create Trigger Named: MB Create, convert to text and pase

Code:
function Trig_MB_Create_Actions takes nothing returns nothing
local integer array i // We create integer for loop
set i[1] = 0 // Starting integer for loop 1
set i[2] = 11 // Ending integer for loop 1
loop // We start loop 1
    exitwhen i[1] > i[2] // We set condition for loop 1
    call CreateMultiboardBJ( 2, 1, "cson" ) // We create MultiBoard
    set udg_MB[i[1]] = GetLastCreatedMultiboard() // We get the MultiBoard in variable for later use 
    set i[3] = 1 // Starting integer for loop 2
    set i[4] = 2 // Ending integer for loop 2
    loop
        exitwhen i[3] > i[4] // We set condition for loop 2
        call MultiboardSetItemStyleBJ( udg_MB[i[1]], i[3], 1, true, false ) // We disable icons
        call MultiboardSetItemWidthBJ( udg_MB[i[1]], i[3], 1, 3 ) // We set width
        set i[3] = i[3] + 1 // Incrase 1[3] for loop 2 condition
    endloop // We end loop
    call MultiboardSetItemValueBJ( udg_MB[i[1]], 1, 1, ( "Creeps: " + I2S(udg_Creeps[i[1]]) ) ) // We set text in first colum to "Creeps: 0"
    call MultiboardSetItemValueBJ( udg_MB[GetForLoopIndexA()], 2, 1, ( "Denies: " + I2S(udg_Denies[i[1]]) ) ) // We set text in second colum to "Denies: 0"
    call MultiboardDisplayBJ( false, udg_MB[i[1]] ) // We hide MultiBoard
    set i[1] = i[1] + 1 // increase i[1] for loop 1 condition
endloop // We end loop 1
endfunction

//===========================================================================
function InitTrig_MB_Create takes nothing returns nothing
    set gg_trg_MB_Create = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_MB_Create, 0.20 )
    call TriggerAddAction( gg_trg_MB_Create, function Trig_MB_Create_Actions )
endfunction

Create Trigger named: MB Show and convert it to text

Code:
function Trig_MB_Show_Actions takes nothing returns nothing
    local player mbtp = GetTriggerPlayer() // We get triggering player in variable
    local player mblp = GetLocalPlayer() // We get local player in variable
    if ( mbtp() == mblp ) then  // If triggering player is local player then Also we start if
        call MultiboardDisplay( udg_MB[GetConvertedPlayerId(mblp)], true ) // We show MultiBoard
    endif // End if
endfunction 

// **************************************************************************************************
// * Note! This might not work!! Let me know if it doesn't I'll fix it!                             *
// * I Hope it helped you!                                                                          *
// * Don't flame me if I got this all wrong, I'm still learning JASS, so I might have few mistakes. *
// **************************************************************************************************

//===========================================================================
function InitTrig_MB_Show takes nothing returns nothing
    set gg_trg_MB_Show = CreateTrigger(  )
    call TriggerAddAction( gg_trg_MB_Show, function Trig_MB_Show_Actions )
endfunction
 

Fulla

Evil Overlord
Reaction score
31
Gah, im very grateful for your help, but im not trying to make a multiboard.

I already have a multiboard in game, thats why im trying to make a seperate scoreboard.

Sorry about that, thx again thou for trying.

EDIT: Oh if your still learning, heres a good way to make a multiboard.
Took me a few days to master it, but it works very well.
(uses VJass editor)

Code:
globals
multiboard GameMultiboard
integer ClockSec = 0
integer ClockMin = 0
integer PlayerCount
integer array PlayerKills
integer array PlayerDeaths
integer array PlayerBoard
integer array PlayerMulti
integer array PlayerStreak
integer array PlayerTimer
string array PlayerText
integer array TeamKills
integer array TeamDeaths
string array TeamText
endglobals

function Multiboard_Update takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local string s = GetAttachmentTable(t)
    local multiboarditem it = null
    local integer n = 0
    local integer c = 2
    local integer i = PlayerCount
    
    set ClockSec = ClockSec + 1
    if ClockSec >= 60 then
        set ClockSec = ClockSec - 60
        set ClockMin = ClockMin + 1
    endif
    
    set it = MultiboardGetItem(GameMultiboard, i + 5, 1)
    if ClockSec<10 then
        call MultiboardSetItemValue(it, I2S(ClockMin)+":0"+I2S(ClockSec))
    else
        call MultiboardSetItemValue(it, I2S(ClockMin)+":"+I2S(ClockSec))
    endif
    
    loop
        set it = MultiboardGetItem(GameMultiboard, n, c)
        call MultiboardSetItemStyle(it, true, false)
    
        if c == 2 then
            if n != 0 and n < i + 1 then     
                call MultiboardSetItemValue(it, "|CFFFF0000" + I2S(PlayerKills[PlayerBoard[n]]))
            elseif n > i + 1 then
                if n == i + 2 then
                    call MultiboardSetItemValue(it, "|CFFFF0000" + I2S(TeamKills[1]))
                elseif n == i + 3 then
                    call MultiboardSetItemValue(it, "|CFFFF0000" + I2S(TeamKills[2]))
                endif
            endif
                   
        elseif c == 3 then           
            if n != 0 and n < i + 1 then     
                call MultiboardSetItemValue(it, "|CFF0064FF" + I2S(PlayerDeaths[PlayerBoard[n]]))
            elseif n > i + 1 then
                if n == i + 2 then
                    call MultiboardSetItemValue(it, "|CFF0064FF" + I2S(TeamDeaths[1]))                 
                elseif n == i + 3 then
                    call MultiboardSetItemValue(it, "|CFF0064FF" + I2S(TeamDeaths[2]))
                endif
            endif
        endif
                             
        set n = n + 1
        if n > i + 3 then
            set n = 0
            set c = c + 1
        endif
        exitwhen c > 3
    endloop    
    
    set it = null        
endfunction

function Trig_Multiboard_Actions takes nothing returns nothing
    local timer t = CreateTimer()
    local string s = GetAttachmentTable(t)
    
    local integer n = 0
    local integer i = 0
    local integer c = 0
    local multiboarditem it = null

    set TeamText[1] = "|CFF00E632The Sentinel"
    set TeamText[2] = "|CFFFFFF00The Scourge"
    
    loop
        exitwhen n == 12
        if GetPlayerSlotState(Player(n)) == ConvertPlayerSlotState(1) then
            if n == 0 then
                set PlayerText[i + 1] = "|c00ff0303" + GetPlayerName(Player(n))
            elseif n == 1 then
                set PlayerText[i + 1] = "|c000042ff" + GetPlayerName(Player(n))
            elseif n == 2 then
                set PlayerText[i + 1] = "|c001ce6b9" + GetPlayerName(Player(n))
            elseif n == 3 then
                set PlayerText[i + 1] = "|c00540081" + GetPlayerName(Player(n))
            elseif n == 4 then
                set PlayerText[i + 1] = "|c00fffc01" + GetPlayerName(Player(n))
            elseif n == 5 then
                set PlayerText[i + 1] = "|c00feba0e" + GetPlayerName(Player(n))
                
            elseif n == 6 then
                set PlayerText[i + 1]  = "|c0020c000" + GetPlayerName(Player(n))
            elseif n == 7 then
                set PlayerText[i + 1]  = "|c00e55bb0" + GetPlayerName(Player(n))
            elseif n == 8 then
                set PlayerText[i + 1]  = "|c00959697" + GetPlayerName(Player(n))
            elseif n == 9 then
                set PlayerText[i + 1]  = "|c007ebff1" + GetPlayerName(Player(n))
            elseif n == 10 then
                set PlayerText[i + 1]  = "|c00106246" + GetPlayerName(Player(n))
            elseif n == 11 then
                set PlayerText[i + 1]  = "|c004e2a04" + GetPlayerName(Player(n))
            endif
            set PlayerBoard[n + 1] = i + 1
            set i = i + 1
        endif
        set n = n + 1
    endloop
        
    set PlayerCount = i
    set GameMultiboard = CreateMultiboard()
    call MultiboardSetTitleText(GameMultiboard, "www.clancbs.com")
    call MultiboardSetColumnCount(GameMultiboard, 4)
    call MultiboardSetRowCount(GameMultiboard, i + 6)
    
    set n = 0
    set c = 0
    
    loop
        set it = MultiboardGetItem(GameMultiboard, n, c)
        call MultiboardSetItemStyle(it, true, false)
    
        if c == 0 then
            call MultiboardSetItemWidth(it,0.10)
            if n == 0 then
                 call MultiboardSetItemValue(it, "Players")
            elseif n < i + 1 then
                 call MultiboardSetItemValue(it, PlayerText[n])
                 call MultiboardSetItemStyle(it, true, true)
            elseif n == i + 2 then
                 call MultiboardSetItemValue(it, TeamText[1])
            elseif n == i + 3 then
                 call MultiboardSetItemValue(it, TeamText[2])
            elseif n == i + 5 then
                 call MultiboardSetItemValue(it, "Time Elapsed")                                                                        
            endif
            
        elseif c == 1 then
            call MultiboardSetItemWidth(it,0.05)
            if n == 0 then
                 call MultiboardSetItemValue(it, "Dead?")
            endif     
                    
        elseif c == 2 then
            call MultiboardSetItemWidth(it,0.03)
            if n == 0 then
                 call MultiboardSetItemValue(it, "|CFFFF0000Kills")
            elseif n < i + 1 or n == i + 2 or n == i + 3 then     
                 call MultiboardSetItemValue(it, "|CFFFF00000")
            endif
                   
        elseif c == 3 then
            call MultiboardSetItemWidth(it,0.03)        
            if n == 0 then
                 call MultiboardSetItemValue(it, "|CFF0064FFDeaths")     
            elseif n < i + 1 or n == i + 2 or n == i + 3 then     
                 call MultiboardSetItemValue(it, "|CFF0064FF0")
            endif
        endif
                             
        set n = n + 1
        if n > i + 5 then
            set n = 0
            set c = c + 1
        endif
        exitwhen c > 3
    endloop
            
    call MultiboardDisplay(GameMultiboard, true)
    set it = null
    
    call TimerStart(t, 1.00, true, function Multiboard_Update)
endfunction

//===========================================================================
function InitTrig_Multiboard_Setup takes nothing returns nothing
    set gg_trg_Multiboard_Setup = CreateTrigger()
    call TriggerRegisterTimerEventSingle(gg_trg_Multiboard_Setup, 1.00)
    call TriggerAddAction(gg_trg_Multiboard_Setup, function Trig_Multiboard_Actions)
endfunction
 
I

IKilledKEnny

Guest
Ah, I see, well the only thing I can thing of is changing 2 of the natural players' names to creeps and whatever the other thing was and then using them in the leaderboard, that however would require 2 colums. Sorry I can't help you any further!
 
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