• 🏆 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!

Multiboard Shows for One Only

Status
Not open for further replies.
Level 6
Joined
Sep 11, 2006
Messages
172
I have a multiboard set to display for all players. Sometimes it displays for player 1 and sometimes it displays for player 2 when testing with more than one. Player 1 or player 2, only one of them gets to see the board.

  • For each (Integer LoopIndex[1]) from 1 to 11, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Player[LoopIndex[1]] slot status) Equal to Is playing
        • Then - Actions
          • Multiboard - Create a multiboard with 5 columns and 2 rows, titled (PlayerColors[LoopIndex[1]] + Stats)
          • Set Multi[LoopIndex[1]] = (Last created multiboard)
          • Multiboard - Set the width for (Last created multiboard) item in column 1, row 1 to 10.00% of the total screen width
          • Multiboard - Set the width for (Last created multiboard) item in column 2, row 1 to 8.00% of the total screen width
          • Multiboard - Set the width for (Last created multiboard) item in column 4, row 1 to 8.00% of the total screen width
          • Multiboard - Set the width for (Last created multiboard) item in column 1, row 2 to 10.00% of the total screen width
          • Multiboard - Set the width for (Last created multiboard) item in column 2, row 2 to 8.00% of the total screen width
          • Multiboard - Set the width for (Last created multiboard) item in column 4, row 2 to 8.00% of the total screen width
          • Multiboard - Set the text for (Last created multiboard) item in column 1, row 2 to PlayerColors[LoopIndex[1]]
          • Multiboard - Set the text for (Last created multiboard) item in column 2, row 2 to 0
          • Multiboard - Set the icon for (Last created multiboard) item in column 3, row 1 to ReplaceableTextures\CommandButtons\BTNFireBolt.blp
          • Multiboard - Set the text for (Last created multiboard) item in column 4, row 2 to 0
          • Multiboard - Set the icon for (Last created multiboard) item in column 5, row 1 to ReplaceableTextures\PassiveButtons\PASBTNHumanArtilleryUpOne.blp
          • Multiboard - Set the text for (Last created multiboard) item in column 1, row 1 to Player
          • Multiboard - Set the text for (Last created multiboard) item in column 2, row 1 to Body Temp
          • Multiboard - Set the text for (Last created multiboard) item in column 4, row 1 to Ammo
          • 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 2, row 1 to Show text and Hide icons
          • Multiboard - Set the display style for (Last created multiboard) item in column 3, row 1 to Hide text and Show icons
          • Multiboard - Set the display style for (Last created multiboard) item in column 4, row 1 to Show text and Hide icons
          • Multiboard - Set the display style for (Last created multiboard) item in column 5, row 1 to Hide text and Show icons
          • Multiboard - Set the display style for (Last created multiboard) item in column 1, row 2 to Show text and Hide icons
          • Multiboard - Set the display style for (Last created multiboard) item in column 2, row 2 to Show text and Hide icons
          • Multiboard - Set the display style for (Last created multiboard) item in column 3, row 2 to Hide text and Hide icons
          • Multiboard - Set the display style for (Last created multiboard) item in column 4, row 2 to Show text and Hide icons
          • Multiboard - Set the display style for (Last created multiboard) item in column 5, row 2 to Hide text and Hide icons
          • Multiboard - Minimize (Last created multiboard)
          • Multiboard - Maximize (Last created multiboard)
          • Multiboard - Hide (Last created multiboard)
          • Custom script: if ( GetLocalPlayer() == udg_Player[udg_LoopIndex[1]] ) then
          • Multiboard - Show (Last created multiboard)
          • Custom script: endif
        • Else - Actions
 
Level 12
Joined
Feb 22, 2010
Messages
1,115
If both player 1 and player 2 are in game, it will only show for player 2.Remove these 4 lines at the bottom.

Multiboard - Hide (Last created multiboard)
Custom script: if ( GetLocalPlayer() == udg_Player[udg_LoopIndex[1]] ) then
Multiboard - Show (Last created multiboard)
Custom script: endif
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Multiboard - Create a multiboard with 5 columns and 2 rows, titled (PlayerColors[LoopIndex[1]] + Stats)
If we look at the BJ it calls...

JASS:
function CreateMultiboardBJ takes integer cols,integer rows,string title returns multiboard
    set bj_lastCreatedMultiboard = CreateMultiboard()
    call MultiboardSetRowCount(bj_lastCreatedMultiboard, rows)
    call MultiboardSetColumnCount(bj_lastCreatedMultiboard, cols)
    call MultiboardSetTitleText(bj_lastCreatedMultiboard, title)
    call MultiboardDisplay(bj_lastCreatedMultiboard, true)
    return bj_lastCreatedMultiboard
endfunction

Or more importantly
JASS:
    call MultiboardDisplay(bj_lastCreatedMultiboard, true)

You can see that it automatically shows the board as it is created. This means any previous show operation is overwritten so...

Multiboard - Hide (Last created multiboard)
Custom script: if ( GetLocalPlayer() == udg_Player[udg_LoopIndex[1]] ) then
Multiboard - Show (Last created multiboard)
Custom script: endif
Might as well be placed outside the loop as it will only affect the very last created multiboard.

You need two separate loops...
Loop 1 -> Creates the multiboards, hiding them after creation.
Loop 2 -> Shows the multiboards only to the appropriate players.

If you use JASS to directly create the multiboards using this native...
JASS:
native CreateMultiboard takes nothing returns multiboard
Then you can do it in a single loop as I recall multiboards defaulting to not visible.
 
Status
Not open for further replies.
Top