• 🏆 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 minimizes/maximizes during multiplayer games only

Status
Not open for further replies.
Level 14
Joined
Aug 30, 2004
Messages
909
I am updating Battle for Tatooine. In it, each player has a multiboard that demonstrates their ship's statistics. The multiboard is made with these triggers:

  • For each (Integer A) from 1 to 10, do (Actions)
    • Loop - Actions
      • Multiboard - Create a multiboard with 2 columns and 7 rows, titled Dashboard
      • Multiboard - Set the text for (Last created multiboard) item in column 1, row 1 to Lasers
      • ...
      • Multiboard - Set the text for (Last created multiboard) item in column 1, row 7 to Shields
      • For each (Integer B) from 1 to 7, do (Actions)
        • Loop - Actions
          • Multiboard - Set the width for (Last created multiboard) item in column 1, row (Integer B) to 8.00% of the total screen width
        • ...
      • Multiboard - Set the icon for (Last created multiboard) item in column 1, row 7 to ReplaceableTextures\CommandButtons\BTNNeutralManaShield.blp
      • Multiboard - Minimize (Last created multiboard)
      • Set MultiBoard[(Integer A)] = (Last created multiboard)
  • For each (Integer A) from 1 to 10, do (Actions)
    • Loop - Actions
      • Set Show = False
      • Set MBint = ((Integer A) - 1)
      • Custom script: if GetLocalPlayer() == Player(udg_MBint) then
      • Set Show = True
      • Multiboard - Show MultiBoard[(Integer A)]
      • Custom script: endif
I do not understand the second trigger (the custom script doesn't make sense to me), but I was given it by the helpful people here at the Hive, and it's worked great so far. In theory, and in actuality, it makes 10 multiboards and makes it so that each player can only see their own multiboard.

Here is the problem, at various times during multiplayer play (but never single player) my multiboard will minimize or maximize without me doing anything. There are triggers that open or close the multiboards. Here they are a few examples:

  • Multiboard ESC
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
      • Player - Player 2 (Blue) skips a cinematic sequence
      • Player - Player 3 (Teal) skips a cinematic sequence
      • Player - Player 4 (Purple) skips a cinematic sequence
      • Player - Player 5 (Yellow) skips a cinematic sequence
      • Player - Player 6 (Orange) skips a cinematic sequence
      • Player - Player 7 (Green) skips a cinematic sequence
      • Player - Player 8 (Pink) skips a cinematic sequence
      • Player - Player 9 (Gray) skips a cinematic sequence
      • Player - Player 10 (Light Blue) skips a cinematic sequence
    • Conditions
    • Actions
      • Set tempInteger = (Player number of (Triggering player))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (MultiBoard[tempInteger] is minimized) Equal to True
          • defaultSelection[tempInteger] Equal to Fliers[tempInteger]
        • Then - Actions
          • Multiboard - Maximize MultiBoard[tempInteger]
        • Else - Actions
          • Multiboard - Minimize MultiBoard[tempInteger]
  • Ship dies
    • Events
      • Unit - A unit Dies
    • Conditions
    • Actions
      • Set DeadUnit = (Triggering unit)
      • ...
      • Set deathInteger = (Custom value of DeadUnit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • deathInteger Less than or equal to 10
        • Then - Actions
          • Multiboard - Set the text for MultiBoard[deathInteger] item in column 2, row 5 to none
          • ...
          • Multiboard - Minimize MultiBoard[deathInteger]
From what I can tell, when commands come to minimize or maximize a leaderboard, it's somehow issuing those commands to multiple players. This isn't a coding error, e.g. deathInteger in the above trigger is correct, and it does work perfectly in single player mode no matter what player slot I'm using.

I assume before each of these "minimize MultiBoard" commands I need a kind of custom script to detect the local player or something... I'm afraid I don't know JASS at all, so I'll need something fairly specific. I think given that there are so many different times that I call for minimizing and maximizing the MultiBoard I should just have 1 trigger that I call to minimize and 1 trigger to maximize the MultiBoard for player tempPlayer, with player number tempPlayerInteger.. Could someone write that trigger for me please?

Thank you all.
 
Level 5
Joined
Mar 6, 2015
Messages
130
why not use a specific Multiboard for each players? as you did by storing Multiboards in Arrays I suggest you to use this trigger to display their own Multiboard to each player you`ll need a little jass

  • Multiboard Hider
    • Events
      • Time - Elapsed game time is 2.00 seconds
    • Conditions
    • Actions
      • Multiboard - Hide Multiboard
      • Custom script: if ( GetLocalPlayer() == Player(0) ) then
      • Multiboard - Show Multiboard
      • Custom script: endif
in this case player(0) means player 1 and player(1) means player 2 and so on
 
Level 14
Joined
Aug 30, 2004
Messages
909
I'm not entirely sure I'm following you, sorry. But my second trigger does something like that. Each player only sees one multiboard. I never have trouble with that. The problem is that a player's multiboard will minimize or maximize at odd times during multiplayer games.

So player 6 has Multiboard[6] displayed on his screen. he never sees anyone else's multiboard. But if player[2] maximizes his, sometimes player 6's will maximize as well.
 
Level 18
Joined
Nov 21, 2012
Messages
835
Maybe it would be good idea to call function to update multibard for given player, but I'm not sure how you currently making this. I think you update mb field when some event fires (like 'unit dies' you show us). My sugestion is to update values only and then call update mb function.
Example: if your field Shields in multiboard is integer then do:
set Shields[playerNumber] = Shields[playerNumber] + 1
when you want to increase.

If you do that this way then in all triggers when you updating mb you have to update your variables only and make 1 call.
Such a function is simple, and if you give me more info I can write it for you. I need info for all 7 variable types used in multiboard. Is it string, integer each one.
It will be then more readable and easy for debug.
 
Level 14
Joined
Aug 30, 2004
Messages
909
ZiBitheWand3r3r,

I think I've done something like that, but it's been cobbled together from a variety of sources. For example, I have an "update shields and flux" trigger that I call whenever the ship's shields are reduced or they adjust their flux ability. This then recomputes the variables and sets the MultiBoard accordingly.

I'm not sure I'm communicating the problem effectively though. The problem is never with the variables in the multiboard itself. Those are always accurate. The problem is the minimizing or maximizing of the multiboard. For example, I have a trigger (linked in the first post) that minimizes or maximizes your multiboard if you press ESC. If your ship blows up I minimize your multi-board as well, and a few other times. These always work in 1-player mode, so I don't think the triggers have errors in them. But in multiplayer mode sometimes a player's multiboard will minimize or maximize seemingly without reason.

It reminded me of an error I had earlier when whole leaderboards would be replaced by other player's leaderboards. This error was fixed by a wise person on the forums who suggested this code:

  • For each (Integer A) from 1 to 10, do (Actions)
    • Loop - Actions
      • Set Show = False
      • Set MBint = ((Integer A) - 1)
      • Custom script: if GetLocalPlayer() == Player(udg_MBint) then
      • Set Show = True
      • Multiboard - Show MultiBoard[(Integer A)]
      • Custom script: endif
I think that trigger made it so that each player's computer only generates 1 multiboard. That worked great, except for this minimize maximize error. Here's what I think the solution might be:

Before calling every "minimize/maximize" multiboard action, I check to see if the LocalPlayer is the one who needs it minimized or maximized. If not, I don't issue the action. If so, I issue it. Something like:

  • Custom script: if GetLocalPlayer() == Player(udg_MBint) then
    • Multiboard - Minimize MultiBoard[udg_MBint]
    • Custom script: endif
I suppose I can try it like that. Does this make sense? Sorry, perhaps I should have just tried it myself, but I'm really lost on what that code is doing.
 
Level 5
Joined
Mar 6, 2015
Messages
130
I'm not entirely sure I'm following you, sorry. But my second trigger does something like that. Each player only sees one multiboard. I never have trouble with that. The problem is that a player's multiboard will minimize or maximize at odd times during multiplayer games.

So player 6 has Multiboard[6] displayed on his screen. he never sees anyone else's multiboard. But if player[2] maximizes his, sometimes player 6's will maximize as well.

I`m not sure thats possible or i`v never encountered such a bug like this but if you use Multiboard[1] all of the players will see multiboard[1] because there is no option in GUI to indicate which player allowed to see a specific multiboard so multiboard[6] and others wont work and vice versa , in general purposes like showing the number of kills , scores , deaths etc you`ll need only one multiboard but if you want a more advanced Multiboard to show private datas that you don`t want to be seen by enemy players you can use multiple Multiboards and use my trigger to hide them its easy to create you can use a Loop and GetLocalplayer(integerA-1) like what you did in your trigger
 
Level 14
Joined
Aug 30, 2004
Messages
909
Thanks and + rep. I used that loop like you said. I think it's working now, but I'm waiting on a good play test from some friends.


EDIT:

Play test successful. If future readers have a problem like this, just do something like:

  • Maximize Dashboard
    • Events
    • Conditions
    • Actions
      • Set MBint = (MBint - 1)
      • Custom script: if GetLocalPlayer() == Player(udg_MBint) then
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (MultiBoard[(MBint + 1)] is minimized) Equal to True
        • Then - Actions
          • Multiboard - Maximize MultiBoard[(MBint + 1)]
        • Else - Actions
      • Custom script: endif
and set MBint (an integer variable) equal to the player number of the person whose multiboard you want minimized or maximized.
 
Last edited:
Status
Not open for further replies.
Top