• 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] Showing Multiboards to specific users.

Status
Not open for further replies.
Level 7
Joined
Dec 8, 2008
Messages
243
Would this work?

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Then - Actions
      • Custom script: if (GetLocalPlayer() == udg_All_Players[1]) then
      • Multiboard - Show MainMultiboard
      • Custom script: endif
    • Else - Actions
Difficult to test it with friends at this time of night, and again, my greatest appreciation.
 
Level 9
Joined
Nov 28, 2008
Messages
704
Do you have a variable called All_Players that is an array?

If you want player red, in the custom script do:

if GetLocalPlayer() == Player(0) then

In JASS (custom script), players start from 0, not 1.
 
Level 7
Joined
Dec 8, 2008
Messages
243
I do have a variable called all_players and yes, it's an array :) Thanks for the tip, but just out of curiosity, would my earlier post work?

I've just tried this...

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Owner of (Triggering unit)) Equal to Player 1 (Red)
    • Then - Actions
      • Custom script: if (GetLocalPlayer() == Player(0)) then
      • Multiboard - Show MainMultiboard
      • Custom script: endif
    • Else - Actions
...which doesn't seem to work.
 
Level 7
Joined
Dec 8, 2008
Messages
243
Never mind, it was because I had the trigger initially off. Silly me. Thanks, both of you. I'll now hang my head in shame and start learning JASS.
 
No problem, just an advice:
GetLocalPlayer() always returns the player, on which computer the code is evaluated, meaning, on the computer of red this returns Player(0), for blue (Player(1) ... so that this if is true on some computers and on others it doesn't, thats why this multiboard is only shown to one player. However, this local if statement can cause desyncs, if you create anything inside that influences the game. For example, if you create a unit and someone clicks it, the game desyncs, because on his computer the unit is clicked, on others it doesn't even exist, so he can't click it (can be avoided via locust).
Be sure only to "show" and "hide" stuff that has normaly an option to be "shown" or "hidden" for all players.
 
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
  • If - Conditions
    • (Owner of (Triggering unit)) Equal to Player 1 (Red)
  • Then - Actions
    • Custom script: if (GetLocalPlayer() == Player(0)) then
    • Multiboard - Show MainMultiboard
    • Custom script: endif
  • Else - Actions
This trigger already checks for the Player 1 (Red) in the custom script, you don't have to add a GUI condition. It says: "if GetLocalPlayer() == Player(0) then". You see that "if" and "then"? That is the GUI condition in Jass.

So, to get what you want, use this:
  • Trigger
  • Events
    • Unit - A unit acquires an item
  • Conditions
  • Actions
    • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
    • Multiboard - Show (MainMultiboard)
    • Custom script: endif
 
Status
Not open for further replies.
Top