• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Jass Multiboard unique to each player

Status
Not open for further replies.
Level 4
Joined
May 1, 2008
Messages
72
Hello, I am having an issue getting a multiboard working so that each player has a unique multiboard. The multiboard for player 1 loads, then when I have the one load for player 2, the multiboard for player 1 disappears. I have tested this as player 2, and that multiboard does appear after 10 seconds.

Multiboard code
  • Quest Multiboard Copy
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Set VariableSet unit[0] = "working"
      • Set VariableSet unit[1] = not working
      • Multiboard - Create a multiboard with 2 columns and 2 rows, titled Test.
      • Set VariableSet QuestMultiboard_P1 = (Last created multiboard)
      • Multiboard - Hide QuestMultiboard_P1
      • Multiboard - Set the display style for QuestMultiboard_P1 item in column 1, row 1 to Show text and Hide icons
      • Multiboard - Set the text for QuestMultiboard_P1 item in column 1, row 1 to unit[0]
      • Multiboard - Create a multiboard with 2 columns and 2 rows, titled Test.
      • Set VariableSet QuestMultiboard_P2 = (Last created multiboard)
      • Multiboard - Hide QuestMultiboard_P2
      • Multiboard - Set the display style for QuestMultiboard_P2 item in column 1, row 1 to Show text and Hide icons
      • Multiboard - Set the text for QuestMultiboard_P2 item in column 1, row 1 to unit[1]
Player 1 Multiboard code

JASS:
function Trig_Show_for_player_1_Copy_Actions takes nothing returns nothing
    local boolean show = false
    if ( GetLocalPlayer() == Player(0) ) then
         set show = true
    endif
    call MultiboardDisplay(udg_QuestMultiboard_P1,show)
endfunction

//===========================================================================
function InitTrig_Show_for_player_1_Copy takes nothing returns nothing
    set gg_trg_Show_for_player_1_Copy = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_Show_for_player_1_Copy, 5 )
    call TriggerAddAction( gg_trg_Show_for_player_1_Copy, function Trig_Show_for_player_1_Copy_Actions )
endfunction

Player 2 Multiboard code

JASS:
function Trig_Show_for_player_2_Copy_Actions takes nothing returns nothing
    local boolean show = false
    if ( GetLocalPlayer() == Player(1) ) then
         set show = true
    endif
    call MultiboardDisplay(udg_QuestMultiboard_P2,show)
endfunction

//===========================================================================
function InitTrig_Show_for_player_2_Copy takes nothing returns nothing
    set gg_trg_Show_for_player_2_Copy = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_Show_for_player_2_Copy, 10 )
    call TriggerAddAction( gg_trg_Show_for_player_2_Copy, function Trig_Show_for_player_2_Copy_Actions )
endfunction
 
+1 to what Wrda said. It should be safe to use MultiboardDisplay for a single player (locally). I'm guessing if you call that function globally, it might do some weird side-effects that cause the current multiboard to disappear.

Here's how you'd adjust your triggers:
JASS:
function Trig_Show_for_player_1_Copy_Actions takes nothing returns nothing
    if ( GetLocalPlayer() == Player(0) ) then
        call MultiboardDisplay(udg_QuestMultiboard_P1, true)
    endif
endfunction

//===========================================================================
function InitTrig_Show_for_player_1_Copy takes nothing returns nothing
    set gg_trg_Show_for_player_1_Copy = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_Show_for_player_1_Copy, 5 )
    call TriggerAddAction( gg_trg_Show_for_player_1_Copy, function Trig_Show_for_player_1_Copy_Actions )
endfunction

JASS:
function Trig_Show_for_player_2_Copy_Actions takes nothing returns nothing
    if ( GetLocalPlayer() == Player(1) ) then
        call MultiboardDisplay(udg_QuestMultiboard_P2, true)
    endif
endfunction

//===========================================================================
function InitTrig_Show_for_player_2_Copy takes nothing returns nothing
    set gg_trg_Show_for_player_2_Copy = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_Show_for_player_2_Copy, 10 )
    call TriggerAddAction( gg_trg_Show_for_player_2_Copy, function Trig_Show_for_player_2_Copy_Actions )
endfunction
 
Status
Not open for further replies.
Top