• 🏆 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 Example ?

Status
Not open for further replies.
Level 11
Joined
Jan 2, 2016
Messages
472
Can someone provide me a simple multiboard example or help me get this working lol ?

It would be great if i were to dynamically add rows.

JASS:
function Trig_MainMultiboard_Actions takes nothing returns nothing
    set heroMultiboard = CreateMultiboard()
    call MultiboardSetColumnCount(heroMultiboard, 5)
    //call MultiboardSetRowCount(heroMultiboard, 12)
    call MultiboardSetTitleText(heroMultiboard, "Statistics")
  
    call ForGroup(udg_HeroesF1, function AddHeroOnLeaderboard)
    call ForGroup(udg_HeroesF2, function AddHeroOnLeaderboard)
  
    call MultiboardDisplay(heroMultiboard, true)
endfunction

JASS:
function AddHeroOnLeaderboard takes nothing returns nothing
    local unit u = GetEnumUnit()
    local player p = GetOwningPlayer(u)
    local integer playerID = GetPlayerId(p)
  
    //call MultiboardSetRowCount(heroMultiboard, idx)

    set heroIcon[playerID] = MultiboardGetItem(heroMultiboard, idx, 0)
    set playerNames[playerID] = MultiboardGetItem(heroMultiboard, idx, 1)
    set kills[playerID] = MultiboardGetItem(heroMultiboard, idx, 2)
    set deaths[playerID] = MultiboardGetItem(heroMultiboard, idx, 3)
    set coinsGathered[playerID] = MultiboardGetItem(heroMultiboard, idx, 4)
  
    call MultiboardSetItemStyle(heroIcon[playerID],false, true)
    call MultiboardSetItemIcon(heroIcon[playerID], GenerateIcon(u))
    call MultiboardReleaseItem(heroIcon[playerID])
  
    call MultiboardSetItemStyle(playerNames[playerID], true, false)
    call MultiboardSetItemWidth(playerNames[playerID], 5)
    call MultiboardSetItemValue(playerNames[playerID], GetPlayerName(p))
    call MultiboardReleaseItem(playerNames[playerID])
  
  
    call MultiboardSetItemStyle(kills[playerID], true, false)
    call MultiboardSetItemWidth(kills[playerID], 5)
    call MultiboardSetItemValue(kills[playerID], "Hello")
    call MultiboardReleaseItem(kills[playerID])
  
    call MultiboardSetItemStyle(deaths[playerID], true, false)
    call MultiboardSetItemWidth(deaths[playerID], 5)
    call MultiboardSetItemValue(deaths[playerID],"World")
    call MultiboardReleaseItem(deaths[playerID])
  
    call MultiboardSetItemStyle(coinsGathered[playerID], true, false)
    call MultiboardSetItemWidth(coinsGathered[playerID], 5)
    call MultiboardSetItemValue(coinsGathered[playerID], "Nope")
    call MultiboardReleaseItem(coinsGathered[playerID])
  
    set idx = idx + 1
  
    set p = null
    set u = null
endfunction
 
Level 13
Joined
Oct 12, 2016
Messages
769
Here's how I went about adding players to a multiboard based on the number of users playing.
The variable "PlayerColor" is a string array with a color code for each player I stored at map initialisation.
Storing that global integer "PlayerRow" comes in REAL handy for updating the multiboard.
The other variables are just part of me map's thing.

Add more players to that if/then/else statement depending on the number of maximum players possible in the map:
  • Multiboard Init
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • Set TempForce = (All players controlled by a User player)
      • Player Group - Pick every player in TempForce and do (Actions)
        • Loop - Actions
          • Set PlayerCount = (PlayerCount + 1)
      • Custom script: call DestroyForce(udg_TempForce)
      • -------- Multiboard Setup --------
      • Multiboard - Create a multiboard with 4 columns and (PlayerCount + 1) rows, titled (Player Status - + GameMode)
      • Set Multiboard = (Last created multiboard)
      • Multiboard - Set the display style for Multiboard item in column 0, row 0 to Show text and Hide icons
      • Multiboard - Set the width for Multiboard item in column 1, row 1 to 10.00% of the total screen width
      • Multiboard - Set the width for Multiboard item in column 2, row 1 to 6.00% of the total screen width
      • Multiboard - Set the width for Multiboard item in column 3, row 1 to 6.00% of the total screen width
      • Multiboard - Set the width for Multiboard item in column 4, row 1 to 6.00% of the total screen width
      • Multiboard - Set the text for Multiboard item in column 1, row 1 to Player
      • Multiboard - Set the text for Multiboard item in column 2, row 1 to Status
      • Multiboard - Set the text for Multiboard item in column 3, row 1 to Reputation
      • Multiboard - Set the text for Multiboard item in column 4, row 1 to Alignment
      • For each (Integer A) from 1 to PlayerCount, do (Actions)
        • Loop - Actions
          • Set MultiboardPlaceCheck = False
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • MultiboardPlaceCheck Equal to False
              • MultiboardPlayer[1] Equal to False
              • (Player 1 (Red) slot status) Equal to Is playing
            • Then - Actions
              • Set MultiboardPlayer[1] = True
              • Set PlayerRow[1] = ((Integer A) + 1)
              • Set TempInt = 1
              • Set MultiboardPlaceCheck = True
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • MultiboardPlaceCheck Equal to False
                  • MultiboardPlayer[2] Equal to False
                  • (Player 2 (Blue) slot status) Equal to Is playing
                • Then - Actions
                  • Set MultiboardPlayer[2] = True
                  • Set PlayerRow[2] = ((Integer A) + 1)
                  • Set TempInt = 2
                  • Set MultiboardPlaceCheck = True
                • Else - Actions
          • Multiboard - Set the width for Multiboard item in column 1, row ((Integer A) + 1) to 10.00% of the total screen width
          • Multiboard - Set the width for Multiboard item in column 2, row ((Integer A) + 1) to 6.00% of the total screen width
          • Multiboard - Set the width for Multiboard item in column 3, row ((Integer A) + 1) to 6.00% of the total screen width
          • Multiboard - Set the width for Multiboard item in column 4, row ((Integer A) + 1) to 6.00% of the total screen width
          • Multiboard - Set the text for Multiboard item in column 1, row ((Integer A) + 1) to ((PlayerColor[TempInt] + (Name of (Player(TempInt)))) + |r)
          • Multiboard - Set the text for Multiboard item in column 2, row ((Integer A) + 1) to PlayerStatus[TempInt]
          • Multiboard - Set the text for Multiboard item in column 3, row ((Integer A) + 1) to (String(Reputation[TempInt]))
          • Multiboard - Set the text for Multiboard item in column 4, row ((Integer A) + 1) to PlayerAlignment[TempInt]
      • Multiboard - Maximize Multiboard
      • Multiboard - Minimize Multiboard
 
Last edited:
Status
Not open for further replies.
Top