• 🏆 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 per player not displaying

Status
Not open for further replies.
Level 5
Joined
Jun 24, 2012
Messages
112
This trigger is supposed to create a multiboard for every player but only show 1 specific multiboard to a specific player. For some reason, only Player 1 gets a multiboard. I've tried it many different ways, but haven't managed to make it work.

  • MB GP Create 1
    • Events
    • Conditions
    • Actions
      • Player Group - Pick every player in DL_Force and do (Actions)
        • Loop - Actions
          • Multiboard - Create a multiboard with 2 columns and ((Number of players in DL_Force) + 1) rows, titled (R) The True Death ...
          • Set GP_Board1[(Player number of (Picked player))] = (Last created multiboard)
          • Multiboard - Maximize (Last created multiboard)
          • Multiboard - Hide (Last created multiboard)
          • Multiboard - Set the display style for (Last created multiboard) item in column 1, row 0 to Hide text and Hide icons
          • Multiboard - Set the display style for (Last created multiboard) item in column 2, row 0 to Show text and Hide icons
          • Multiboard - Set the width for (Last created multiboard) item in column 1, row 0 to 1.50% of the total screen width
          • Multiboard - Set the width for (Last created multiboard) item in column 2, row 0 to 8.50% of the total screen width
          • Multiboard - Set the text for (Last created multiboard) item in column 2, row 1 to (|cffa8a8a8Kills:|r + ((String(GP_Kills[(Player number of (Picked player))])) + /10))
          • Multiboard - Set the text for (Last created multiboard) item in column 2, row 2 to |cffa8a8a8Players l...
          • Set GP_Integer[0] = 2
          • Hashtable - Save True as (520 + (Player number of (Picked player))) of (Player number of (Picked player)) in (Last created hashtable)
          • For each (Integer A) from 1 to 10, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Player((Integer A))) is an enemy of (Picked player)) Equal to True
                  • ((Player((Integer A))) is in DL_Force) Equal to True
                • Then - Actions
                  • Set GP_Integer[0] = (GP_Integer[0] + 1)
                  • Hashtable - Save GP_Integer[0] as (500 + (Integer A)) of (Player number of (Picked player)) in (Last created hashtable)
                  • Hashtable - Save False as (520 + (Integer A)) of (Player number of (Picked player)) in (Last created hashtable)
                  • Multiboard - Set the icon for (Last created multiboard) item in column 1, row GP_Integer[0] to ReplaceableTextures\CommandButtons\BTNSkeletonMage.blp
                  • Multiboard - Set the text for (Last created multiboard) item in column 2, row GP_Integer[0] to (FN_PlayerColor[(Integer A)] + ((Name of (Player((Integer A)))) + |r))
                  • Multiboard - Set the display style for (Last created multiboard) item in column 1, row GP_Integer[0] to Hide text and Show icons
                • Else - Actions
          • Custom script: if GetLocalPlayer() == GetEnumPlayer() then
          • Multiboard - Show GP_Board1[(Player number of (Picked player))]
          • Custom script: endif
(I realize there is no event but the trigger is ran through another trigger and the multiboard is created just fine.)
 
Level 3
Joined
Apr 4, 2006
Messages
33
which players are in DL_Force, did you check that?
if you are alone, add some computers to DL_Force and run the trigger again.
 
Level 13
Joined
Sep 13, 2010
Messages
550
  • Multiboard - Create a multiboard with 2 columns and 4 rows, titled Hero Picking
The problem is with this one.

- Why?
- Here comes ugly Jass.

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
- Ok, but where is the problem?
- In this BJ everything is nice and fine except... this: call MultiboardDisplay(bj_lastCreatedMultiboard, true)

- And this why causes me problems?
- Let me explain. You have a loop for two player, on the first time it creates the board, also displays it, then hides for all, in the end displays for Player Red. Everything is fine, Red has multiboard, Blue doesn't.
Now comes the second period for Blue player. Creates a multiboard, displaying for player Blue, and ALSO displays for Red, hides it for both, and displays for Blue. Now Blue has board, Red doesn't. If you went for 3 players Red nor Blue would have a table.

- Ok ok I have read your badly written shit, can you give a solution??
- Yes, there is several solution. But the easiest:
Replace this line of code:

  • Multiboard - Create a multiboard with 2 columns and 4 rows, titled Hero Picking
With these:

  • Custom script: set bj_lastCreatedMultiboard = CreateMultiboard( ) // Or use "set udg_Picking_MultiBoard[udg_Player_Number] = CreateMultiboard( )" and you won't need the next line :>
  • Set Picking_MultiBoard[Player_Number] = (Last created multiboard)
  • Multiboard - Change the number of rows for Picking_MultiBoard[Player_Number] to 4
  • Multiboard - Change the number of columns for Picking_MultiBoard[Player_Number] to 2
  • Multiboard - Change the title of Picking_MultiBoard[Player_Number] to Hero Picking
Ok this should solve the problem. If not then I am an asshole who haven't checked it out.

There. Hmm.. It only displays to player red? Strange. However the solution is still can be the same.
 
Level 5
Joined
Jun 24, 2012
Messages
112
There. Hmm.. It only displays to player red? Strange. However the solution is still can be the same.

Yea I actually saw your reply in another thread and tried it but it still didn't work. Here are 2 things I tried:

  • MB GP Create 1
    • Events
    • Conditions
    • Actions
      • Player Group - Pick every player in DL_Force and do (Actions)
        • Loop - Actions
          • Multiboard - Create a multiboard with 2 columns and ((Number of players in DL_Force) + 1) rows, titled (R) The True Death ...
          • Set MB_Board1[(Player number of (Picked player))] = (Last created multiboard)
          • Multiboard - Hide MB_Board1[(Player number of (Picked player))]
          • Multiboard - Set the display style for MB_Board1[(Player number of (Picked player))] item in column 1, row 0 to Hide text and Hide icons
          • Multiboard - Set the display style for MB_Board1[(Player number of (Picked player))] item in column 2, row 0 to Show text and Hide icons
          • Multiboard - Set the width for MB_Board1[(Player number of (Picked player))] item in column 1, row 0 to 1.50% of the total screen width
          • Multiboard - Set the width for MB_Board1[(Player number of (Picked player))] item in column 2, row 0 to 8.50% of the total screen width
          • Multiboard - Set the text for MB_Board1[(Player number of (Picked player))] item in column 2, row 1 to (|cffa8a8a8Kills:|r + ((String(GP_Kills[(Player number of (Picked player))])) + /10))
          • Multiboard - Set the text for MB_Board1[(Player number of (Picked player))] item in column 2, row 2 to |cffa8a8a8Players l...
          • Set MB_Integer[0] = 2
          • Hashtable - Save True as (520 + (Player number of (Picked player))) of (Player number of (Picked player)) in (Last created hashtable)
          • For each (Integer A) from 1 to 10, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Player((Integer A))) is an enemy of (Picked player)) Equal to True
                  • ((Player((Integer A))) is in DL_Force) Equal to True
                • Then - Actions
                  • Set MB_Integer[0] = (MB_Integer[0] + 1)
                  • Hashtable - Save MB_Integer[0] as (500 + (Integer A)) of (Player number of (Picked player)) in (Last created hashtable)
                  • Hashtable - Save False as (520 + (Integer A)) of (Player number of (Picked player)) in (Last created hashtable)
                  • Multiboard - Set the icon for MB_Board1[(Player number of (Picked player))] item in column 1, row MB_Integer[0] to ReplaceableTextures\CommandButtons\BTNSkeletonMage.blp
                  • Multiboard - Set the text for MB_Board1[(Player number of (Picked player))] item in column 2, row MB_Integer[0] to (FN_PlayerColor[(Integer A)] + ((Name of (Player((Integer A)))) + |r))
                  • Multiboard - Set the display style for MB_Board1[(Player number of (Picked player))] item in column 1, row MB_Integer[0] to Hide text and Show icons
                • Else - Actions
      • Multiboard - Hide all multiboards
      • Player Group - Pick every player in DL_Force and do (Actions)
        • Loop - Actions
          • Custom script: if GetLocalPlayer() == GetEnumPlayer() then
          • Multiboard - Show MB_Board1[(Player number of (Picked player))]
          • Multiboard - Maximize MB_Board1[(Player number of (Picked player))]
          • Custom script: endif
I think the above should have worked, but didn't so I also tried this:

  • MB GP Create 1
    • Events
    • Conditions
    • Actions
      • Player Group - Pick every player in DL_Force and do (Actions)
        • Loop - Actions
          • Custom script: set udg_MB_Board1[GetConvertedPlayerId(GetEnumPlayer())] = CreateMultiboard()
          • Multiboard - Change the number of rows for MB_Board1[(Player number of (Picked player))] to ((Number of players in DL_Force) + 1)
          • Multiboard - Change the number of columns for MB_Board1[(Player number of (Picked player))] to 2
          • Multiboard - Change the title of MB_Board1[(Player number of (Picked player))] to (R) The True Death ...
          • Multiboard - Set the display style for MB_Board1[(Player number of (Picked player))] item in column 1, row 0 to Hide text and Hide icons
          • Multiboard - Set the display style for MB_Board1[(Player number of (Picked player))] item in column 2, row 0 to Show text and Hide icons
          • Multiboard - Set the width for MB_Board1[(Player number of (Picked player))] item in column 1, row 0 to 1.50% of the total screen width
          • Multiboard - Set the width for MB_Board1[(Player number of (Picked player))] item in column 2, row 0 to 8.50% of the total screen width
          • Multiboard - Set the text for MB_Board1[(Player number of (Picked player))] item in column 2, row 1 to (|cffa8a8a8Kills:|r + ((String(GP_Kills[(Player number of (Picked player))])) + /10))
          • Multiboard - Set the text for MB_Board1[(Player number of (Picked player))] item in column 2, row 2 to |cffa8a8a8Players l...
          • Set MB_Integer[0] = 2
          • Hashtable - Save True as (520 + (Player number of (Picked player))) of (Player number of (Picked player)) in (Last created hashtable)
          • For each (Integer A) from 1 to 10, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Player((Integer A))) is an enemy of (Picked player)) Equal to True
                  • ((Player((Integer A))) is in DL_Force) Equal to True
                • Then - Actions
                  • Set MB_Integer[0] = (MB_Integer[0] + 1)
                  • Hashtable - Save MB_Integer[0] as (500 + (Integer A)) of (Player number of (Picked player)) in (Last created hashtable)
                  • Hashtable - Save False as (520 + (Integer A)) of (Player number of (Picked player)) in (Last created hashtable)
                  • Multiboard - Set the icon for MB_Board1[(Player number of (Picked player))] item in column 1, row MB_Integer[0] to ReplaceableTextures\CommandButtons\BTNSkeletonMage.blp
                  • Multiboard - Set the text for MB_Board1[(Player number of (Picked player))] item in column 2, row MB_Integer[0] to (FN_PlayerColor[(Integer A)] + ((Name of (Player((Integer A)))) + |r))
                  • Multiboard - Set the display style for MB_Board1[(Player number of (Picked player))] item in column 1, row MB_Integer[0] to Hide text and Show icons
                • Else - Actions
          • Custom script: if GetLocalPlayer() == GetEnumPlayer() then
          • Multiboard - Show MB_Board1[(Player number of (Picked player))]
          • Multiboard - Maximize MB_Board1[(Player number of (Picked player))]
          • Custom script: endif
Didn't work either. At first, it just created a tiny multiboard with no columns/rows, then I added "change title/rows/columns" and it did not work anymore.
 
Level 13
Joined
Sep 13, 2010
Messages
550
Ewwwz. Thats just bad. I can't spot any errors. However as I see you are calling one more row than you have. Dunno if its true, and if that would create an error.

My suggestion:
Step 1: Add a Display Text to the end of the script to see if your code crashed or not.
Step 2: If it didn't show up, disable the Integer A loop completely. ( leave text display at the end )
Step 3: If it shows up without the A integer loop, try with changing this:
  • Multiboard - Create a multiboard with 2 columns and ((Number of players in DL_Force) + 2) rows, titled (R) The True Death ...
( changed +1 to +2 ). Also enable your loop stuff. If it shows up, it works, if not, it needs further investigations.

EDIT: Just checked, it won't work.
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
do you know that in GUI it starts as 1, so your GetLocalPlayer() is 0 and your picked player is 1?
try this:
  • Custom script: local integer i = 0
  • Custom script: loop
  • Custom script: if GetLocalPlayer() == Player(i) then
  • Custom script: call MultiboardDisplay(udg_MB_Board1(i),true)
  • Custom script: call MultiboardMinimize(udg_MB_Board1(i),false)
  • Custom script: endif
  • Custom script: set i = i+1
  • Custom script: exitwhen i==12
  • Custom script: endloop
 
Level 5
Joined
Jun 24, 2012
Messages
112
Ewwwz. Thats just bad. I can't spot any errors. However as I see you are calling one more row than you have. Dunno if its true, and if that would create an error.

My suggestion:
Step 1: Add a Display Text to the end of the script to see if your code crashed or not.

Interadasting... I don't know why I didn't try this before... but it didn't worked. I added a text message "convert integer to string (player # of picked player) at the end of the Pick Every Player function, and it only displayed #1. I also added the message "done" at the very end of the trigger, which, however, displayed correctly. I'm uncertain as to why it would only pick player 1, then stop picking every player and resume the trigger.

Still no idea how to fix it as of now :(

edit:


do you know that in GUI it starts as 1, so your GetLocalPlayer() is 0 and your picked player is 1?
try this:
  • Custom script: local integer i = 0
  • Custom script: loop
  • Custom script: if GetLocalPlayer() == Player(i) then
  • Custom script: call MultiboardDisplay(udg_MB_Board1(i),true)
  • Custom script: call MultiboardMinimize(udg_MB_Board1(i),false)
  • Custom script: endif
  • Custom script: set i = i+1
  • Custom script: exitwhen i==12
  • Custom script: endloop

Not sure why it would matter since I'm not using using a players number but the picked player. But I will try anyway.
Edit: Didn't work.
 
Level 13
Joined
Sep 13, 2010
Messages
550
do you know that in GUI it starts as 1, so your GetLocalPlayer() is 0 and your picked player is 1?
try this:
  • Custom script: local integer i = 0
  • Custom script: loop
  • Custom script: if GetLocalPlayer() == Player(i) then
  • Custom script: call MultiboardDisplay(udg_MB_Board1(i),true)
  • Custom script: call MultiboardMinimize(udg_MB_Board1(i),false)
  • Custom script: endif
  • Custom script: set i = i+1
  • Custom script: exitwhen i==12
  • Custom script: endloop

I don't know why would this be a problem, since he was using "GetConvertedPlayerId" which uses the 1 based stuff. Anyways I don't really get what have you tried to say.

If it only show for player red, then the problem is not here. Show the trigger where you initialized the DL_Force.
 
Level 5
Joined
Jun 24, 2012
Messages
112
Here's the trigger where players are added to DL_Force. Note that I use DL_Force in a variety of other triggers, all of which work correctly (like messages, etc).

  • FN Game Settings
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, 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
              • Player Group - Add (Player((Integer A))) to DL_Force
              • Player - Set (Player((Integer A))) Current gold to 1000
              • Player - Set (Player((Integer A))) Current lumber to 3
              • Visibility - Create an initially Enabled visibility modifier for (Player((Integer A))) emitting Visibility across Entire Map <gen>
              • Visibility - Destroy (Last created visibility modifier)
              • Trigger - Add to FN Esc <gen> the event (Player - (Player((Integer A))) skips a cinematic sequence)
              • Trigger - Add to FN CamDist <gen> the event (Player - (Player((Integer A))) types a chat message containing -setcam as A substring)
              • Trigger - Add to FN Player Leaves <gen> the event (Player - (Player((Integer A))) leaves the game)
              • Trigger - Add to DL Stats Cancel <gen> the event (Player - (Player((Integer A)))'s Current lumber becomes Equal to 0.00)
              • Trigger - Add to DL Recovery <gen> the event (Time - DL_RecoveryTimer[(Integer A)] expires)
              • Hashtable - Save 1.00 as 200 of (Integer A) in (Last created hashtable)
              • Hashtable - Save 100 as 201 of (Integer A) in (Last created hashtable)
              • Hashtable - Save 1 as 202 of (Integer A) in (Last created hashtable)
              • Camera - Set (Player((Integer A)))'s camera Distance to target to FN_CamDist[(Integer A)] over 0.00 seconds
            • Else - Actions
      • Set FN_Point[0] = (Center of (Playable map area))
      • Set ES_PlayableArea = (Region centered at FN_Point[0] with size ((1126.40 x (Real((Number of players in DL_Force)))), (819.20 x (Real((Number of players in DL_Force))))))
      • Camera - Change camera smoothing factor to 25.00
      • Cinematic - Turn on letterbox mode (hide interface) for DL_Force: fade out over 0.00 seconds
      • Cinematic - Fade out over 0.00 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
      • Cinematic - Disable user control for DL_Force
      • Game - Set game speed to Fastest
      • Game - Lock the game speed
      • Game - Set Visibility - Map Explored to On
      • Game - Set the time of day to 24.00
      • Game - Turn the day/night cycle Off
      • Game - Enable ally color button and Disable creep camp button
      • Game - Disable selection and deselection functionality (Enable selection circles)
      • Game - Disable drag-selection functionality (Disable drag-selection box)
      • Quest - Create a Required quest titled Controls with the description |cff32cd32TIPS:|r ..., using icon path ReplaceableTextures\CommandButtons\BTNSkillz.blp
      • Quest - Create a quest requirement for (Last created quest) with the description Use |Cfffed312Q W E...
      • Quest - Create a Required quest titled The Basics with the description |cff32cd32TIPS:|r ..., using icon path ReplaceableTextures\CommandButtons\BTNSelectHeroOn.blp
      • Quest - Create a quest requirement for (Last created quest) with the description |cffff0000Complete ...
      • Quest - Create a quest requirement for (Last created quest) with the description Use your spells to ...
      • Quest - Create a Required quest titled Tips & Tricks with the description |cff32cd32TIPS:|r ..., using icon path ReplaceableTextures\CommandButtons\BTNDevotion.blp
      • Quest - Create a Required quest titled Changelog with the description No changelog to dis..., using icon path ReplaceableTextures\CommandButtons\BTNNecromancerMaster.blp
      • Quest - Create a Required quest titled Credits with the description Dark Hunter1357: Co..., using icon path ReplaceableTextures\CommandButtons\BTNMassTeleport.blp
      • Quest - Create a quest requirement for (Last created quest) with the description |Cfffed312SupremeGr...
      • Quest - Create a Required quest titled Contact with the description Suggestions? Questi..., using icon path ReplaceableTextures\CommandButtons\BTNBansheeAdept.blp
      • Quest - Create a quest requirement for (Last created quest) with the description |cCF0041FFsupremegr...
      • Quest - Create a Optional quest titled (R) The True Death ... with the description To obtain absolute ..., using icon path ReplaceableTextures\CommandButtons\BTNUnholyAura.blp
      • Quest - Mark (Last created quest) as Undiscovered
      • Quest - Create a quest requirement for (Last created quest) with the description |cffff0000Required ...
      • Quest - Create a quest requirement for (Last created quest) with the description Obtain 10 Kills.
      • Quest - Create a quest requirement for (Last created quest) with the description Defeat all the Deat...
      • Set FN_PlayerColor[1] = |cCFFF0202
      • Set FN_PlayerColor[2] = |cCF0041FF
      • Set FN_PlayerColor[3] = |cCF1BE5B8
      • Set FN_PlayerColor[4] = |cCF530080
      • Set FN_PlayerColor[5] = |cCFFFFC00
      • Set FN_PlayerColor[6] = |cCFFE890D
      • Set FN_PlayerColor[7] = |cCF1FBF00
      • Set FN_PlayerColor[8] = |cCFE45AAF
      • Set FN_PlayerColor[9] = |cCF949596
      • Set FN_PlayerColor[10] = |cCF7DBEF1
      • Hashtable - Create a hashtable
      • Unit - Create 1 Death Lord for Neutral Hostile at FN_Point[0] facing (Random angle) degrees
      • Unit - Remove (Last created unit) from the game
      • Custom script: call RemoveLocation(udg_FN_Point[0])
      • Custom script: call DestroyTrigger(GetTriggeringTrigger())
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
IDK why it doesnt work for you, my tests works;
  • MB TEST
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Custom script: local integer id = GetPlayerId(GetLocalPlayer())
      • Custom script: local integer i = 0
      • -------- displays 0 --------
      • Custom script: call BJDebugMsg(I2S(id))
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • -------- displays 1 --------
          • Set MIndex = ((Player number of (Picked player)) - 1)
          • Game - Display to (All players) the text: (String((Player number of (Picked player))))
          • Multiboard - Create a multiboard with 3 columns and 1 rows, titled (Player + (String(MIndex)))
          • Set Mul[MIndex] = (Last created multiboard)
          • Multiboard - Show Mul[MIndex]
      • Custom script: loop
      • Custom script: if GetLocalPlayer() == Player(i) then
      • Custom script: call MultiboardDisplay(udg_Mul[i],true)
      • Custom script: call MultiboardMinimize(udg_Mul[i],true)
      • Custom script: endif
      • Custom script: set i = i+1
      • Custom script: exitwhen i==12
      • Custom script: endloop
 
Level 5
Joined
Jun 24, 2012
Messages
112
Fixed it by doing 2 things. Although I have no idea why those things fixed it, so if anyone cared to shed some light on it, they'd be very welcome.

1) The trigger was crashing after picking player 1. I fixed it by assigning "(Count Players in DL_Force +1)" to a variable outside the "Pick Players" loop, as setting the MB to have rows equal to the number of Players in DL_Force +1 caused it to crash. No idea why that was. Still, the MBs were not displaying but the trigger was running fine, so I had to...

2) Remove "Hide all multiboards" don't know why this one was a problem, but once I removed it, everything worked & displayed perfectly. (Only applicable to the 1st trg I posted.)
 
Status
Not open for further replies.
Top