Local Multiboard isn't working

Nexor

...
Reaction score
74
I want multiboards for each player and modify their lines whenever is needed.
I know the usage of GetLocalPlayer() in this case, I only have to use it at the Multiboard showing part. I can't test it multiplayer atm, but in singleplayer it isn't working. The multiboard appears, but there is only the maximize/minimize button.

Here are the codes:

JASS:
globals
    string array MULTIBOARD_STRING
endglobals

function Trig_Statistics_Actions takes nothing returns nothing
    local integer index = 0
    local integer i = 1
    local player p
    local boolean b = true
    
    
    set MULTIBOARD_STRING[1] = "|cff1e90ffBase damage: |r"
    set MULTIBOARD_STRING[2] = "|cff1e90ffItem bonus: |r"
    set MULTIBOARD_STRING[3] = "|cff1e90ffChance to critical: |r"
    set MULTIBOARD_STRING[4] = "|cff1e90ffCritical multiplier: |r"
    set MULTIBOARD_STRING[5] = "|cff1e90ffCooldown: |r"
    set MULTIBOARD_STRING[6] = "|cff1e90ffAverage damage: |r"
    set MULTIBOARD_STRING[7] = "|cff1e90ffDrop chance: |r"
    set MULTIBOARD_STRING[8] = "|cff1e90ffRare drop chance: |r"
    set MULTIBOARD_STRING[9] = "|cff1e90ffMagic drop chance: |r"
    set MULTIBOARD_STRING[10] = "|cff1e90ffCommon drop chance: |r"
    set MULTIBOARD_STRING[11] = "|cff1e90ffNumber of attacks: |r"
    set MULTIBOARD_STRING[12] = "|cff1e90ffHit rate:  |r"
    set MULTIBOARD_STRING[13] = "|cff1e90ffLast miss chance:  |r"
    set MULTIBOARD_STRING[14] = "|cff1e90ffLast dodge chance:  |r"
    set MULTIBOARD_STRING[15] = "|cff1e90ffBlock chance:  |r"
    set MULTIBOARD_STRING[16] = "|cff1e90ffBlock rate:  |r"
    set MULTIBOARD_STRING[17] = "|cff1e90ffCreeps killed:  |r"
    
    loop
        exitwhen index > bj_MAX_PLAYERS
    
            call MultiboardSetItemStyleBJ( MULTIBOARD[index], 0, 0, true, false )
            call MultiboardSetItemWidthBJ( MULTIBOARD[index], 0, 0, 15 )
            call MultiboardSetItemValueBJ( MULTIBOARD[index], 1, 19, "|cff1e90ffGame Time:|r" )
    
    loop
        exitwhen i > 17
        call MultiboardSetItemValueBJ(MULTIBOARD[index], 1, i, MULTIBOARD_STRING<i> )
        set i = i + 1
    endloop
        
        set p = Player(index)
        if GetLocalPlayer() == p then
            call MultiboardDisplayBJ(b,MULTIBOARD[index])
        endif
        
        set index = index + 1
    endloop
endfunction

//===========================================================================
function InitTrig_Statistics takes nothing returns nothing
    set gg_trg_Statistics = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_Statistics, 0.2 )
    call TriggerAddAction( gg_trg_Statistics, function Trig_Statistics_Actions )
endfunction

</i>


And the other, setting trigger:

JASS:
library MultiBoard initializer InitTrig_Multiboard_update

globals
    multiboard array MULTIBOARD
endglobals

function MultiBoard takes nothing returns nothing
    local integer str
    local integer agi
    local integer int
    local real dmg 
    local real hitrate = 0
    local integer i = 1
    local integer index = 0
    local real misschance
    local real dodgechance
    local player p
    local boolean b = true
    
    loop
        exitwhen index &gt; bj_MAX_PLAYERS
        set str = GetHeroStr(HERO[index],true)
        set agi = GetHeroAgi(HERO[index],true)
        set int = GetHeroInt(HERO[index],true)
        set dmg = (I2R(str)*STR_MULTI + I2R(agi)*AGI_MULTI + I2R(int)*INT_MULTI)/2
        set misschance = MISS_CHANCE[index]
        set dodgechance = DODGE_CHANCE[index]
    
        
        
    if misschance &lt; 0 then
        set misschance = 0
    endif
    
    if dodgechance &lt; 0 then
        set dodgechance = 0
    endif

    set MULTIBOARD_STRING[1] = R2SW(dmg,2,2)
    set MULTIBOARD_STRING[2] = R2SW(ITEM_bonus[index],2,2)
    set MULTIBOARD_STRING[3] = R2SW(CRIT_chance[index],2,2)
    set MULTIBOARD_STRING[4] = R2SW(CRIT_multi[index],2,2)
    set MULTIBOARD_STRING[5] = R2SW(COOLDOWN[index],2,2)
    set MULTIBOARD_STRING[6] = R2S( (dmg+ITEM_bonus[index])/COOLDOWN[index])
    set MULTIBOARD_STRING[7] = R2SW( DROP_CHANCE[index],2,1)
    set MULTIBOARD_STRING[8] = R2SW( RARE_CHANCE[index],2,1) + &quot;%&quot;
    set MULTIBOARD_STRING[9] = R2SW( MAGIC_CHANCE[index],2,1) + &quot;%&quot;
    set MULTIBOARD_STRING[10] = R2SW( COMMON_CHANCE[index],2,1) + &quot;%&quot;
    set MULTIBOARD_STRING[11] = I2S( NUMBER_OF_ATTACKS[index])
    set MULTIBOARD_STRING[12] = &quot;&quot;
    set MULTIBOARD_STRING[13] = R2SW(misschance,2,2) + &quot;%&quot;
    set MULTIBOARD_STRING[14] = R2SW(dodgechance,2,2) + &quot;%&quot;
    set MULTIBOARD_STRING[15] = R2SW(BLOCK_CHANCE[index],2,2) + &quot;%&quot;
    set MULTIBOARD_STRING[16] = R2SW(BLOCK_MOD[index],2,2) + &quot;%&quot;
    set MULTIBOARD_STRING[17] = I2S(NUMBER_OF_KILLS[index])
    
    if NUMBER_OF_ATTACKS[index] &gt; 0 and NUMBER_OF_HITS[index] &gt; 0 then
        set hitrate = 100*I2R(NUMBER_OF_HITS[index]) /I2R(NUMBER_OF_ATTACKS[index])
    endif

    if hitrate &gt; 0 then
        set MULTIBOARD_STRING[12] = MULTIBOARD_STRING[12] + R2S(hitrate) + &quot;%&quot;
    else
        set MULTIBOARD_STRING[12] = MULTIBOARD_STRING[12] + &quot;0%&quot;
    endif
        
    
    loop
        exitwhen i &gt; 17

            call MultiboardSetItemValueBJ( MULTIBOARD[index], 2, i, MULTIBOARD_STRING<i> )

        set i = i + 1
    endloop
    
    
    endloop
endfunction

//===========================================================================
function InitTrig_Multiboard_update takes nothing returns nothing
    set gg_trg_Multiboard_update = CreateTrigger(  )
    call TriggerRegisterTimerEvent( gg_trg_Multiboard_update, 0.50,false )
    call TriggerAddAction( gg_trg_Multiboard_update, function MultiBoard )
endfunction

endlibrary</i>


+rep for any good tips
 

Nexor

...
Reaction score
74
Tom Jones, you are my Hero!
I looked through the initialization triggers, there were the multiboard creations.

I moved them to the first multiboard trigger and voila :) it's working now! thanks to you :)
 
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