• 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.

[Trigger] Multiboard Problem

Status
Not open for further replies.
Level 3
Joined
Sep 3, 2007
Messages
4
Hey, I've got a problem with my multiboard...

What it does: it displays the player names and current ressources of all players.

Problem: If I close e.g. playerslot 1 , 2 and I play in slot 3, ressources and names won't show up correct ingame anymore.


Here is my trigger code:

  • Multiboard Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set players_playing = (All players matching (((Matching player) slot status) Equal to Is playing))
      • -------- Gold colour --------
      • Set cc_players[0] = |cffffcc00
      • -------- Player colours. --------
      • Set cc_players[1] = |c00ff0303
      • Set cc_players[2] = |c000042ff
      • Set cc_players[3] = |c001ce6b9
      • Set cc_players[4] = |c00540081
      • Set cc_players[5] = |c00fffc01
      • Set cc_players[6] = |c00feba0e
      • Set cc_players[7] = |c0020c000
      • Set cc_players[8] = |c00e55bb0
      • Set cc_endtag = |r

  • Multiboard Flag
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Multiboard - Create a multiboard with 3 columns and (1 + (Number of players in players_playing)) rows, titled test
      • Set multiboard_flag = (Last created multiboard)
      • -------- row 1, colum 1, 2. --------
      • Multiboard - Set the text for multiboard_flag item in column 2, row 1 to |CFFFFCC00Gold:|R
      • Multiboard - Set the text for multiboard_flag item in column 3, row 1 to |CFFFFCC00Lumber:|R
      • -------- loop part. --------
      • For each (Integer A) from 1 to (1 + (Number of players in players_playing)), do (Actions)
        • Loop - Actions
          • -------- Multiboard style. --------
          • 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 Show text and Hide icons
          • Multiboard - Set the display style for (Last created multiboard) item in column 1, row (Integer A) to Show text and Hide icons
          • Multiboard - Set the display style for (Last created multiboard) item in column 2, row (Integer A) to Show text and Show icons
          • Multiboard - Set the display style for (Last created multiboard) item in column 3, row (Integer A) to Show text and Show icons
          • -------- set the icon images... --------
          • Multiboard - Set the icon for (Last created multiboard) item in column 2, row player_row to UI\Feedback\Resources\ResourceGold.blp
          • Multiboard - Set the icon for (Last created multiboard) item in column 3, row player_row to UI\Feedback\Resources\ResourceLumber.blp
          • -------- Multiboard width. --------
          • Multiboard - Set the width for multiboard_flag item in column 1, row (Integer A) to 8.00% of the total screen width
          • Multiboard - Set the width for multiboard_flag item in column 2, row (Integer A) to 4.00% of the total screen width
          • Multiboard - Set the width for multiboard_flag item in column 3, row (Integer A) to 4.00% of the total screen width
          • -------- Player adding part. --------
          • -------- Player name. --------
          • Set player_row = (player_row + 1)
          • Set player_colour = (player_colour + 1)
          • Multiboard - Set the text for multiboard_flag item in column 1, row player_row to (cc_players[player_colour] + ((Name of (Player(player_colour))) + cc_endtag))
          • -------- Player name. --------
          • Player Group - Pick every player in (All players matching ((((Matching player) slot status) Equal to Is playing) and (((Matching player) controller) Equal to User))) and do (Actions)
            • Loop - Actions
              • Set Gold[(Player number of (Picked player))] = ((Picked player) Current gold)
              • Set lumber[(Player number of (Picked player))] = ((Picked player) Current lumber)
              • Multiboard - Set the text for multiboard_flag item in column 2, row player_row to (String(Gold[(Player number of (Picked player))]))
              • Multiboard - Set the text for multiboard_flag item in column 3, row player_row to (String(lumber[(Player number of (Picked player))]))
      • Multiboard - Show multiboard_flag

  • Update Multiboard
    • Events
      • Player - Player 1 (Red)'s Current gold becomes Greater than or equal to 0.00
      • Player - Player 1 (Red)'s Current lumber becomes Greater than or equal to 0.00
      • Player - Player 2 (Blue)'s Current gold becomes Greater than or equal to 0.00
      • Player - Player 2 (Blue)'s Current lumber becomes Greater than or equal to 0.00
      • Player - Player 3 (Teal)'s Current gold becomes Greater than or equal to 0.00
      • Player - Player 3 (Teal)'s Current lumber becomes Greater than or equal to 0.00
      • Player - Player 4 (Purple)'s Current gold becomes Greater than or equal to 0.00
      • Player - Player 4 (Purple)'s Current lumber becomes Greater than or equal to 0.00
      • Player - Player 5 (Yellow)'s Current gold becomes Greater than or equal to 0.00
      • Player - Player 5 (Yellow)'s Current lumber becomes Greater than or equal to 0.00
      • Player - Player 6 (Orange)'s Current gold becomes Greater than or equal to 0.00
      • Player - Player 6 (Orange)'s Current lumber becomes Greater than or equal to 0.00
    • Conditions
    • Actions
      • Set Gold[(Player number of (Triggering player))] = ((Triggering player) Current gold)
      • Multiboard - Set the text for multiboard_flag item in column 2, row ((Player number of (Triggering player)) + 1) to (String(Gold[(Player number of (Triggering player))]))
      • Set lumber[(Player number of (Triggering player))] = ((Triggering player) Current lumber)
      • Multiboard - Set the text for multiboard_flag item in column 3, row ((Player number of (Triggering player)) + 1) to (String(lumber[(Player number of (Triggering player))]))

I think the problem is located at "Update Multiboard"...


Thank you for your help ;)
Buetz.
 
Level 1
Joined
Feb 28, 2006
Messages
3
I think the problem is actually in Multiboard Flag. Specifically:
  • For each (Integer A) from 1 to (1 + (Number of players in players_playing)), do (Actions)
If you're playing as Player 3, this loop won't know that. It'll only know that there's only one player playing, and so it'll do stuff with row 2 of your multiboard (which I presume corresponds to Player 1).

Also, probably not actually the cause of your problem, but worth looking at from a trigger cleanup point of view:
  • 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 Show text and Hide icons
You're doing stuff with row 1 here, but then it'll do the same action again the first time it goes through the loop. You might want to move this to before the loop, and then change the loop so it starts from 2.
 
Level 5
Joined
Jan 15, 2007
Messages
199
Thank you for your reply.

Alright, yeah i think this is actually the problem, but how do I solve it?
An example code would be nice.

you could do this:
create the variables
Integer I & Integer Array [12] PlayerIndex then
  • Untitled Trigger 001
    • Events
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) slot status) Equal to Is playing
            • Then - Actions
              • Set I = (I + 1)
              • Set PlayerIndex[I] = (Integer A)
            • Else - Actions
      • For each (Integer A) from 1 to I, do (Actions)
        • Loop - Actions
          • -------- Your actions here --------
 
Level 5
Joined
Jan 15, 2007
Messages
199
Unless 'players_playing' is not initialized, I see no reason for that line not to work.
It wont work because if say there are red, blue, orange, and green, it will loop for red, then blue, then teal, then purple, it needs to know what player number the players are, thats what the PlayerIndex thing i posted was
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
It wont work because if say there are red, blue, orange, and green, it will loop for red, then blue, then teal, then purple, it needs to know what player number the players are, thats what the PlayerIndex thing i posted was
... that's just defining how many rows the multiboard has.

EDIT: Lmao, I was talking about a different line than you guys were. Sorry bout that. I was talking about...

  • Multiboard - Create a multiboard with 3 columns and (1 + (Number of players in players_playing)) rows, titled test
 
Status
Not open for further replies.
Top