• 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] Very Un-Known MultiBoard Problem Trigger

Status
Not open for further replies.
Level 13
Joined
Mar 24, 2010
Messages
950
JASS:
function Trig_Open_Close_Copy_2_Func001C takes nothing returns boolean
    if ( not ( IsMultiboardDisplayed(udg_Menu_Inventory) == true ) ) then
        return false
    endif
    return true
endfunction

function Trig_Open_Close_Copy_2_Actions takes nothing returns nothing
    if ( Trig_Open_Close_Copy_2_Func001C() ) then
        call MultiboardDisplayBJ( true, udg_Menu_Inventory )
        call MultiboardMinimizeBJ( false, udg_Menu_Inventory )
        call SetCameraTargetControllerNoZForPlayer( GetTriggerPlayer(), udg_Player_Hero_Array[GetConvertedPlayerId(GetTriggerPlayer())], 0, 0, false )
        call DisplayTimedTextToForce( GetForceOfPlayer(GetTriggerPlayer()), 0.10, "TRIGSTR_4306" )
        call PlaySoundBJ( gg_snd_OOT_PauseMenu_Open_Mono )
        call KillSoundWhenDoneBJ( GetLastPlayedSound() )
    else
        call MultiboardMinimizeBJ( true, udg_Menu_Inventory )
        call PlaySoundBJ( gg_snd_OOT_PauseMenu_Close_Mono )
        call KillSoundWhenDoneBJ( GetLastPlayedSound() )
    endif
endfunction

//===========================================================================
function InitTrig_Open_Close_Copy_2 takes nothing returns nothing
    set gg_trg_Open_Close_Copy_2 = CreateTrigger(  )
    call DisableTrigger( gg_trg_Open_Close_Copy_2 )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Open_Close_Copy_2, Player(0) )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Open_Close_Copy_2, Player(1) )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Open_Close_Copy_2, Player(2) )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Open_Close_Copy_2, Player(3) )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Open_Close_Copy_2, Player(4) )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Open_Close_Copy_2, Player(5) )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Open_Close_Copy_2, Player(6) )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Open_Close_Copy_2, Player(7) )
    call TriggerAddAction( gg_trg_Open_Close_Copy_2, function Trig_Open_Close_Copy_2_Actions )
endfunction

Thats part of my trigger when a player presses Esc it checks if its open or not, if it is then it closes it else it opens it.
This works fine in single player..

In multi-player it also works fine UNTIL 1 player uses their mouse to open the multiboard and the other player presses Esc it drops all players that had their multiboard open while the player pressing Esc had it closed. The if-the-else messed it up i think..

Anyone have this problem before and found a fix?

ps. i could post this in GUI too but no idea how to copy gui as text from W.E. and past it in here and then after of corse wrap it in the gui BB code.. lol
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
You must not be very familiar with loops.

JASS:
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Open_Close_Copy_2, Player(0) )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Open_Close_Copy_2, Player(1) )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Open_Close_Copy_2, Player(2) )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Open_Close_Copy_2, Player(3) )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Open_Close_Copy_2, Player(4) )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Open_Close_Copy_2, Player(5) )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Open_Close_Copy_2, Player(6) )
    call TriggerRegisterPlayerEventEndCinematic( gg_trg_Open_Close_Copy_2, Player(7) )

Can be reduced to:

JASS:
local integer i = 0
loop
    exitwhen i == 8
    call TriggerRegisterPlayerEvent(gg_trg_Open_Close_Copy_2, Player(i), EVENT_PLAYER_END_CINEMATIC)
    set i = i + 1
endloop

In multi-player it also works fine UNTIL 1 player uses their mouse to open the multiboard and the other player presses Esc it drops all players that had their multiboard open while the player pressing Esc had it closed. The if-the-else messed it up i think..

Well you're only using one multiboard, so if you're trying to maximize it every player that has that multiboard visible will experience those actions. In order to only apply it for an individual player, you need to use a local block as follows:

JASS:
if GetLocalPlayer() == GetTriggerPlayer() then
    call MultiboardMinimizeBJ(false, udg_Menu_Inventory)
endif

ps. i could post this in GUI too but no idea how to copy gui as text from W.E. and past it in here and then after of corse wrap it in the gui BB code.. lol

I told you how to do it in the other thread. Just refer to that once you read this (if you haven't already figured it out).

By the way the reason it works fine in Single Player is because there is no input from any user other than you.
 
Level 13
Joined
Mar 24, 2010
Messages
950
Thanks never noticed that before, could be very useful :D

I'll test some things out and let you know how it goes

For this:
JASS:
local integer i = 0
loop
    exitwhen i == 8
    call TriggerRegisterPlayerEvent(gg_trg_Open_Close_Copy_2, Player(i), EVENT_PLAYER_END_CINEMATIC)
    set i = i + 1
endloop

I most often use gui when i can so not familiar how to do that in gui.. this is the only way i know of in gui anyway..

  • 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


Also i always assumed you could only use 1 multiboard because it shows it to all players at any given time is it possible for each player to have their own and only show their own board to that player? now that i think about it with that custom script i think it may be possible..





Edit:

I use this and it still seems to disconnect the other player, but now worse, regardless of the circumstances the other player drops almost immediately after.

The GUI Multiboard statements in the trigger are disabled, so only scripts are making it work.
  • Open Close
    • 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
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Menu_Inventory is minimized) Equal to True
        • Then - Actions
          • Game - Display to (All players) the text: NOW OPEN
          • Multiboard - Show Menu_Inventory
          • Multiboard - Maximize Menu_Inventory
          • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
          • Custom script: call MultiboardMinimizeBJ(false, udg_Menu_Inventory)
          • Custom script: endif
          • Game - Display to (Player group((Triggering player))) for 0.10 seconds the text: Menu Open!
        • Else - Actions
          • Game - Display to (All players) the text: NOW CLOSED
          • Multiboard - Minimize Menu_Inventory
          • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
          • Custom script: call MultiboardMinimizeBJ(true, udg_Menu_Inventory)
          • Custom script: endif
      • Wait 0.10 seconds
      • Trigger - Turn on (This trigger)
 
Last edited:
Level 18
Joined
Jan 21, 2006
Messages
2,552
Ah shit sorry, I screwed up. You'll need to define a custom boolean variable and change it within the local block. Then, outside of the local block, minimize it using the boolean value so that the function is executed for all players, though it will be executed differently.

The reason it was disconnecting is because you can't call a function within a local block. Altering a boolean is perfectly acceptable though.

It would be something like this:

JASS:
set udg_BoolVar = false
if GetLocalPlayer() == GetTriggerPlayer() then
    set udg_BoolVar = true
endif
call MultiboardMinimizeBJ(udg_BoolVar, udg_Menu_Inventory)

By the way, in your local if-statement block you can use the GUI version of "Set Variable" if you want. You can also use custom script to do it. Either way will work.
 
Level 13
Joined
Mar 24, 2010
Messages
950
Ok so heres the issue..

This actually makes the problem worse because it opens the menu only for the triggering player and no one else.. And thats what makes people drop..

When i have mine open and someone elses is closed and i press Esc they drop. The only way this works is when everyone's does the same thing Everyones needs to be open and everyones needs to be closed at all times.

Problem is when i open it and its my turn to use it other people might click it shut with their mouse and then when i go to close it everyone that already has their shut (becuz of mouse clicking it shut) drops.
Is there a way i can maybe not allow it to be shut or opened with a mouse clicking it? that would solve my problems too. i need No mouse interaction with my multiboard.. lol

I can send you my testing map if you would like? do you have more than 1 computer you could test it to see what i'm talking about on your LAN?


  • Open Close 2
    • 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
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Menu_Inventory is minimized) Equal to True
        • Then - Actions
          • Game - Display to (All players) for 0.10 seconds the text: NOW OPEN
          • Custom script: set udg_BoolVar = true
          • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
          • Custom script: set udg_BoolVar = false
          • Custom script: endif
          • Custom script: call MultiboardMinimizeBJ(udg_BoolVar, udg_Menu_Inventory)
        • Else - Actions
          • Game - Display to (All players) for 0.10 seconds the text: NOW CLOSED
          • Custom script: set udg_BoolVar = false
          • Custom script: if GetLocalPlayer() == GetTriggerPlayer() then
          • Custom script: set udg_BoolVar = true
          • Custom script: endif
          • Custom script: call MultiboardMinimizeBJ(udg_BoolVar, udg_Menu_Inventory)
      • Wait 0.10 seconds
      • Trigger - Turn on (This trigger)
This is my init of the M.B.

Melee Initialization
  • Events
    • Map initialization
  • Conditions
  • Actions
    • Melee Game - Use melee time of day (for all players)
    • Melee Game - Limit Heroes to 1 per Hero-type (for all players)
    • Melee Game - Give trained Heroes a Scroll of Town Portal (for all players)
    • Melee Game - Set starting resources (for all players)
    • Melee Game - Remove creeps and critters from used start locations (for all players)
    • Melee Game - Create starting units (for all players)
    • Wait 0.10 seconds
    • Multiboard - Create a multiboard with 3 columns and 12 rows, titled Test
    • Multiboard - Set the width for (Last created multiboard) item in column 1, row 1 to 3.00% of the total screen width
    • Set Menu_Inventory = (Last created multiboard)
    • Multiboard - Show (Last created multiboard)
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Send me a test-map, because I'm certain that this is possible. It may be some mechanical errors with the way you are doing it in GUI. I never use GUI.

By the way you do have a global boolean variable named "BoolVar", right?

What about something like this, does this cause a desync?

JASS:
    local boolean b = IsMultiboardDisplayed(udg_Menu_Inventory)

    if GetLocalPlayer() == GetTriggerUnit() then
        set b = not b
    endif
    call MultiboardDisplay(udg_Menu_Inventory, b)
 
Level 13
Joined
Mar 24, 2010
Messages
950
Heres my testing map:

http://www.mediafire.com/?nylyyiwkwzb

Try to keep it as much in GUI as ya can i'm not super JASS savvy ;)


Edit:
K i tried that, couldnt get it to work.. i made a boolean var called b just because i saw one used.. is that correct?
was getting errors..
I only know enough about jass to edit it somewhat not enough to make it or use it really, is there a way i can just use scripts and then i can easily add the other stuff i have it do later?

  • Actions
    • Trigger - Turn off (This trigger)
    • Custom script: local boolean b = IsMultiboardDisplayed(udg_Menu_Inventory)
    • Custom script: if GetLocalPlayer() == GetTriggerUnit() then
    • Custom script: set b = not b
    • Custom script: endif
    • Custom script: call MultiboardDisplay(udg_Menu_Inventory, b)
    • Trigger - Turn on (This trigger)
Didnt work this way..wouldn't even save.. :/
 
Last edited:
Status
Not open for further replies.
Top