• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Help with multiboard

Status
Not open for further replies.
Hello Hive dwellers :D

I've got a problem when making a multiboard for each player. It will show kills/deaths and resistances to 6 damage types.
However I have a problem when there are more than one player. See the trigger (if you have patience :p)

  • Initialize Multiboard
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Player Group - Pick every player in Players and do (Actions)
        • Loop - Actions
          • Set p = (Picked player)
          • Set i = (Player number of p)
          • Game - Display to (All players) the text: (Creating multiboard + (String(i)))
          • Custom script: if udg_p == GetLocalPlayer() then
          • Game - Display to (All players) the text: (Local player = + (Name of p))
          • Multiboard - Create a multiboard with 3 columns and 1 rows, titled Player Status
          • Multiboard - Set the icon for Multiboard[i] item in column 2, row 1 to ReplaceableTextures\CommandButtons\BTNSteelMelee.blp
          • Multiboard - Set the icon for Multiboard[i] item in column 3, row 1 to ReplaceableTextures\CommandButtons\BTNAnimateDead.blp
          • Set Multiboard[i] = (Last created multiboard)
          • Multiboard - Set the icon for Multiboard[i] item in column 1, row 1 to Textures\Black32.blp
          • Multiboard - Set the icon for Multiboard[i] item in column 2, row 1 to ReplaceableTextures\CommandButtons\BTNSteelMelee.blp
          • Multiboard - Set the icon for Multiboard[i] item in column 3, row 1 to ReplaceableTextures\CommandButtons\BTNAnimateDead.blp
          • -------- Add players --------
          • Set tmpRow = 2
          • Player Group - Pick every player in Players and do (Actions)
            • Loop - Actions
              • Set p2 = (Picked player)
              • Set i2 = (Player number of p2)
              • Multiboard - Change the number of rows for Multiboard[i] to tmpRow
              • Multiboard - Set the text for Multiboard[i] item in column 1, row tmpRow to (Name of p2)
              • Game - Display to (All players) the text: (Adding + ((Name of p2) + ( row + (((String(tmpRow)) + ( mb + (String(i)))) + <Empty String>))))
              • Custom script: set udg_PlayerRowIndex[ Tab(udg_i2, udg_i) ] = udg_tmpRow
              • Set tmpRow = (tmpRow + 1)
          • -------- An empty row to separate --------
          • Multiboard - Change the number of rows for Multiboard[i] to tmpRow
          • Multiboard - Set the display style for Multiboard[i] item in column 0, row 0 to Show text and Hide icons
          • Multiboard - Set the display style for Multiboard[i] item in column 0, row tmpRow to Hide text and Hide icons
          • Multiboard - Set the display style for Multiboard[i] item in column 0, row 1 to Hide text and Show icons
          • -------- Add resistances --------
          • For each (Integer A) from 0 to 5, do (Actions)
            • Loop - Actions
              • Set tmpRow = (tmpRow + 1)
              • Multiboard - Change the number of rows for Multiboard[i] to tmpRow
              • Multiboard - Set the text for Multiboard[i] item in column 1, row tmpRow to (ResistColors[(Integer A)] + (ResistNames[(Integer A)] + resistance|r))
              • Game - Display to (All players) the text: (Adding + (ResistNames[(Integer A)] + ( row + (((String(tmpRow)) + ( mb + (String(i)))) + <Empty String>))))
              • Multiboard - Set the display style for Multiboard[i] item in column 0, row tmpRow to Show text and Hide icons
              • Multiboard - Set the display style for Multiboard[i] item in column 2, row tmpRow to Hide text and Hide icons
          • Multiboard - Set the width for Multiboard[i] item in column 1, row 0 to 11.00% of the total screen width
          • Multiboard - Set the width for Multiboard[i] item in column 2, row (Integer A) to 3.00% of the total screen width
          • Multiboard - Set the width for Multiboard[i] item in column 3, row (Integer A) to 3.00% of the total screen width
          • Multiboard - Set the text for Multiboard[i] item in column 2, row 0 to 0
          • Multiboard - Set the text for Multiboard[i] item in column 3, row 0 to 0
          • Multiboard - Hide Multiboard[i]
          • Multiboard - Show Multiboard[i]
          • Custom script: endif
But here's the result, when there are two players.
attachment.php


Thanks in advance!
Hossoi
 

Attachments

  • Multiboard.jpg
    Multiboard.jpg
    34.5 KB · Views: 171
Level 10
Joined
Jun 16, 2007
Messages
415
You have two Pick Every Player In Players loops, this could lead to errors, I suggest using a For Loop Integer A loop instead and then an Integer B loop, then check whether Player(Integer A) is in Players and do actions, prevents bugs and makes more sense. It could be that when you say "Picked Player", that it overwrites the first Picked Player, thus creating a bug when using more than one picked player in the first loop.

Basically, using For Loop Integer X loops would be a lot safer and might solve your problem, just try it.
 
Level 10
Joined
Jun 16, 2007
Messages
415
The message "Creating multiboard 2" appears cause you set it to show to all players. Now you wonder, why the other messages that should show to all players don't show. It is because they are between the "if udg_p == GetLocalPlayer()" and the "endif", which means that any code between these two lines will only be executed by the local player. I suggest removing those lines and instead putting them at the very end, outside of your other loops, like this:

  • For each (Integer A) from 1 to 12, do (Actions)
    • Loop - Actions
      • Custom script: if Player(bj_forLoopAIndex-1) == GetLocalPlayer() then
      • Multiboard - Show Multiboard[(Integer A)]
      • Custom script: endif
This way, the multiboard exists on all machines, preventing desyncs and bugs, and the only difference is, that this loop would show a different multiboard to each player.
 
Status
Not open for further replies.
Top