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

[Trigger] Multiboard

Status
Not open for further replies.
Level 6
Joined
Oct 18, 2008
Messages
100
Hi,

I am trying to create 12 multiboards only 1 being visible to each player. I already searched the forums and I found out that I need to use GetLocalPlayer() but i cannot seem to get it to work.
Could somebody help me? I don't know a lot about jass.

  • Map Ini
    • Events
      • Time - Elapsed game time is 0.01 seconds
    • Conditions
    • Actions
      • -------- Var Sets --------
      • Set VariableSet uTier3[1] = Human Priest
      • Set VariableSet uTier1[1] = Footman
      • Set VariableSet uTier4[1] = Knight
      • Set VariableSet uTier2[1] = Archer
      • Set VariableSet uTier5[1] = Royal Guard
      • -------- Actions --------
      • Countdown Timer - Start tIncomeTimer as a Repeating timer that will expire in 30.00 seconds
      • Countdown Timer - Create a timer window for tIncomeTimer with title Income:
      • For each (Integer iTemp_Int) from 0 to 11, do (Actions)
        • Loop - Actions
          • -------- Player Set --------
          • Set VariableSet pPlayers[iTemp_Int] = (Player((iTemp_Int + 1)))
          • -------- Multiboard --------
          • Multiboard - Create a multiboard with 3 columns and 10 rows, titled Info:.
          • Set VariableSet Multiboard[iTemp_Int] = (Last created multiboard)
          • Set VariableSet iTemp_Integer2 = 0
          • For each (Integer i) from 1 to 3, do (Actions)
            • Loop - Actions
              • For each (Integer iTemp_Integer2) from 1 to 10, do (Actions)
                • Loop - Actions
                  • Multiboard - Set the display style for Multiboard[iTemp_Int] item in column i, row iTemp_Integer2 to Show text and Show icons
                  • Multiboard - Set the width for (Last created multiboard) item in column i, row iTemp_Integer2 to 3.00% of the total screen width
          • Multiboard - Set the text for Multiboard[iTemp_Int] item in column 1, row 1 to Spawns:
          • Multiboard - Set the text for Multiboard[iTemp_Int] item in column 1, row 2 to (String(uTier1[iTemp_Int]))
          • Multiboard - Set the text for Multiboard[iTemp_Int] item in column 1, row 3 to (String(uTier2[iTemp_Int]))
          • Multiboard - Set the text for Multiboard[iTemp_Int] item in column 1, row 4 to (String(uTier3[iTemp_Int]))
          • Multiboard - Set the text for Multiboard[iTemp_Int] item in column 1, row 5 to (String(uTier4[iTemp_Int]))
          • Multiboard - Set the text for Multiboard[iTemp_Int] item in column 1, row 6 to (String(uTier5[iTemp_Int]))
          • Multiboard - Set the text for Multiboard[iTemp_Int] item in column 1, row 7 to Income:
          • Multiboard - Set the text for Multiboard[iTemp_Int] item in column 1, row 8 to Gold:
          • Multiboard - Set the text for (Last created multiboard) item in column 2, row 8 to (String(iPlayerGoldIncome[iTemp_Int]))
          • Multiboard - Set the icon for (Last created multiboard) item in column 3, row 8 to ReplaceableTextures\CommandButtons\BTNSackOGold.blp
          • Multiboard - Set the text for Multiboard[iTemp_Int] item in column 1, row 9 to Resources
          • Multiboard - Set the text for (Last created multiboard) item in column 2, row 9 to (String(iPlayerResourceIncome[iTemp_Int]))
          • Multiboard - Set the icon for (Last created multiboard) item in column 3, row 9 to ReplaceableTextures\CommandButtons\BTNWood.blp
          • Set VariableSet i = 0
          • Set VariableSet iTemp_Integer2 = 0
          • Multiboard - Hide Multiboard[iTemp_Int]
          • Custom script: if GetLocalPlayer() == udg_pPlayers[udg_iTemp_Int] then
          • Multiboard - Show Multiboard[iTemp_Int]
          • Custom script: endif
      • Set VariableSet iTemp_Int = 0
      • Set VariableSet iTemp_Integer2 = 0
 
Last edited:
Level 10
Joined
Dec 11, 2009
Messages
234
  • Multiboard - Set the text for Multiboard[iTemp_Int] item in column 1, row 2 to (String(uTier1[iTemp_Int]))
  • Multiboard - Set the text for Multiboard[iTemp_Int] item in column 1, row 3 to (String(uTier2[iTemp_Int]))
  • Multiboard - Set the text for Multiboard[iTemp_Int] item in column 1, row 4 to (String(uTier3[iTemp_Int]))
  • Multiboard - Set the text for Multiboard[iTemp_Int] item in column 1, row 5 to (String(uTier4[iTemp_Int]))
  • Multiboard - Set the text for Multiboard[iTemp_Int] item in column 1, row 6 to (String(uTier5[iTemp_Int]))
I think this could be the problem. Only "uTier1[1]", "uTier2[1]", etc. has value, right? And this tries to access [0], [1], ... [11] elements of arrays.

As for GetLocalPlayer(), I think you need to show multiboards AFTER this loop, after all multiboards are created.
 
Last edited:
Level 6
Joined
Oct 18, 2008
Messages
100
Hi,

All arrays have values now, uTier1[1-11] etc...
I added a loop behind the multiboard creation, but it isn't showing any multiboard.

When i removed the hide multiboard, it showed me the multiboard for player 11 so all is working except the showing of 1 multiboard per player.

  • Actions
    • For each (Integer iTemp_Int2) from 0 to 11, do (Actions)
      • Loop - Actions
        • -------- Player Set --------
        • Set VariableSet pPlayers[iTemp_Int2] = (Player((iTemp_Int2 + 1)))
        • -------- Income Set --------
        • Set VariableSet ugBasePoint = (Units owned by pPlayers[iTemp_Int2] of type Base)
        • Set VariableSet ugControlPoint = (Units owned by pPlayers[iTemp_Int2] of type Control Point |cffffd700(+5)|r)
        • Set VariableSet ugGoldmine = (Units owned by pPlayers[iTemp_Int2] of type Gold Mine |cffffd700(+8)|r)
        • Set VariableSet ugLumbermill = (Units owned by pPlayers[iTemp_Int2] of type Lumber Mill)
        • Set VariableSet ugFarmLands = (Units owned by pPlayers[iTemp_Int2] of type Farm Lands)
        • Set VariableSet iTemp_Int3 = (Number of units in ugBasePoint)
        • Set VariableSet iPlayerGoldIncome[iTemp_Int2] = (iPlayerGoldIncome[iTemp_Int2] + (iGoldBA x iTemp_Int3))
        • Set VariableSet iPlayerResourceIncome[iTemp_Int2] = (iPlayerResourceIncome[iTemp_Int2] + (iResourceBA x iTemp_Int3))
        • Set VariableSet iTemp_Int3 = (Number of units in ugControlPoint)
        • Set VariableSet iPlayerGoldIncome[iTemp_Int2] = (iPlayerGoldIncome[iTemp_Int2] + (iGoldCP x iTemp_Int3))
        • Set VariableSet iPlayerResourceIncome[iTemp_Int2] = (iPlayerResourceIncome[iTemp_Int2] + (iResourceCP x iTemp_Int3))
        • Set VariableSet iTemp_Int3 = (Number of units in ugGoldmine)
        • Set VariableSet iPlayerGoldIncome[iTemp_Int2] = (iPlayerGoldIncome[iTemp_Int2] + (iGoldGM x iTemp_Int3))
        • Set VariableSet iTemp_Int3 = (Number of units in ugFarmLands)
        • Set VariableSet iPlayerGoldIncome[iTemp_Int2] = (iPlayerGoldIncome[iTemp_Int2] + (iGoldFA x iTemp_Int3))
        • Set VariableSet iPlayerResourceIncome[iTemp_Int2] = (iPlayerResourceIncome[iTemp_Int2] + (iResourceFA x iTemp_Int3))
        • Set VariableSet iTemp_Int3 = (Number of units in ugLumbermill)
        • Set VariableSet iPlayerResourceIncome[iTemp_Int2] = (iPlayerResourceIncome[iTemp_Int2] + (iResourceLM x iTemp_Int3))
        • Custom script: call DestroyGroup(udg_ugBasePoint)
        • Custom script: call DestroyGroup(udg_ugControlPoint)
        • Custom script: call DestroyGroup(udg_ugGoldmine)
        • Custom script: call DestroyGroup(udg_ugLumbermill)
        • Custom script: call DestroyGroup(udg_ugFarmLands)
        • -------- Multiboard --------
        • Multiboard - Create a multiboard with 3 columns and 10 rows, titled Info:.
        • Set VariableSet Multiboard[iTemp_Int2] = (Last created multiboard)
        • Set VariableSet iTemp_Int3 = 0
        • For each (Integer iTemp_Int) from 1 to 3, do (Actions)
          • Loop - Actions
            • For each (Integer iTemp_Int3) from 1 to 10, do (Actions)
              • Loop - Actions
                • Multiboard - Set the width for (Last created multiboard) item in column iTemp_Int, row iTemp_Int3 to 5.00% of the total screen width
                • Multiboard - Set the display style for Multiboard[iTemp_Int2] item in column iTemp_Int, row iTemp_Int3 to Show text and Hide icons
        • Multiboard - Set the text for Multiboard[iTemp_Int2] item in column 1, row 1 to Spawns:
        • Multiboard - Set the color for Multiboard[iTemp_Int2] item in column 1, row 1 to (100.00%, 80.00%, 20.00%) with 0.00% transparency
        • Multiboard - Set the text for Multiboard[iTemp_Int2] item in column 2, row 2 to (String(iTier1[iTemp_Int2]))
        • Multiboard - Set the text for Multiboard[iTemp_Int2] item in column 1, row 2 to (String(uTier1[iTemp_Int2]))
        • Multiboard - Set the text for Multiboard[iTemp_Int2] item in column 2, row 3 to (String(iTier2[iTemp_Int2]))
        • Multiboard - Set the text for Multiboard[iTemp_Int2] item in column 1, row 3 to (String(uTier2[iTemp_Int2]))
        • Multiboard - Set the text for Multiboard[iTemp_Int2] item in column 2, row 4 to (String(iTier3[iTemp_Int2]))
        • Multiboard - Set the text for Multiboard[iTemp_Int2] item in column 1, row 4 to (String(uTier3[iTemp_Int2]))
        • Multiboard - Set the text for Multiboard[iTemp_Int2] item in column 2, row 5 to (String(iTier4[iTemp_Int2]))
        • Multiboard - Set the text for Multiboard[iTemp_Int2] item in column 1, row 5 to (String(uTier4[iTemp_Int2]))
        • Multiboard - Set the text for Multiboard[iTemp_Int2] item in column 2, row 6 to (String(iTier5[iTemp_Int2]))
        • Multiboard - Set the text for Multiboard[iTemp_Int2] item in column 1, row 6 to (String(uTier5[iTemp_Int2]))
        • Multiboard - Set the text for Multiboard[iTemp_Int2] item in column 1, row 7 to Income:
        • Multiboard - Set the color for Multiboard[iTemp_Int2] item in column 1, row 7 to (100.00%, 80.00%, 20.00%) with 0.00% transparency
        • Multiboard - Set the text for Multiboard[iTemp_Int2] item in column 1, row 8 to Gold:
        • Multiboard - Set the color for Multiboard[iTemp_Int2] item in column 1, row 8 to (100.00%, 80.00%, 20.00%) with 0.00% transparency
        • Multiboard - Set the text for (Last created multiboard) item in column 2, row 8 to (String(iPlayerGoldIncome[iTemp_Int2]))
        • Multiboard - Set the display style for (Last created multiboard) item in column 3, row 8 to Hide text and Show icons
        • Multiboard - Set the icon for (Last created multiboard) item in column 3, row 8 to ReplaceableTextures\CommandButtons\BTNSackOGold.blp
        • Multiboard - Set the color for Multiboard[iTemp_Int2] item in column 1, row 9 to (100.00%, 80.00%, 20.00%) with 0.00% transparency
        • Multiboard - Set the text for Multiboard[iTemp_Int2] item in column 1, row 9 to Resources
        • Multiboard - Set the text for (Last created multiboard) item in column 2, row 9 to (String(iPlayerResourceIncome[iTemp_Int2]))
        • Multiboard - Set the display style for (Last created multiboard) item in column 3, row 9 to Hide text and Show icons
        • Multiboard - Set the icon for (Last created multiboard) item in column 3, row 9 to ReplaceableTextures\CommandButtons\BTNWood.blp
        • Multiboard - Hide Multiboard[iTemp_Int2]
        • Set VariableSet iTemp_Int = 0
        • Set VariableSet iTemp_Int3 = 0
    • For each (Integer iTemp_Int) from 1 to 11, do (Actions)
      • Loop - Actions
        • Custom script: if GetLocalPlayer() == udg_pPlayers[udg_iTemp_Int] then
        • Multiboard - Show Multiboard[iTemp_Int]
        • Custom script: endif
    • Set VariableSet iTemp_Int2 = 0
    • Set VariableSet iTemp_Int3 = 0
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,180
GUI action to create a multiboard has an implicit show multiboard function call. Since only 1 can be shown at any time this means your local display is overwritten on the next iteration of the loop when the next multiboard is created.

The solution is to use 2 separate loops that happen in sequence. First loop creates all multiboards. Second loop just shows the multiboards to the correct players.
 
Status
Not open for further replies.
Top