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

[General] Different Multiboard for Different Players

Status
Not open for further replies.
Level 12
Joined
Nov 3, 2013
Messages
989
I had a similar problem (but dialog instead of multiboard), what I ended up doing is change the text that show on the item for local player, then even though it's the same dialog with the same buttons it will say different things for each player.

Otherwise, depending on your needs, you could create one multiboard per player, and hide all but one for each player.


In both cases you'll need to use
  • custom script: if GetLocalPlayer() == yourPlayer then
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
Death Adder forgot the 'endif' line. In general it's best only to change variables locally and then do the multiboard setting OUTSIDE the local block. Like this:

  • Set StringVar = "This text displays for all players"
  • Set YourPlayerVariable = (Triggering Player)
  • Custom script: if GetLocalPlayer() == udg_YourPlayerVariable then //leave the udg_ but keep change the YourPlayerVariable to match the name of your variable
  • -------- Only do variable setting stuff in here like this: --------
  • Set StringVar = "This text only shows up for the Triggering Player, whomever that was"
  • Custom script: endif
  • -------- Now set the multiboard, but the string is different for each player!
  • Multiboard - Set the text in row 2, column 1 to StringVar
If you do the wrong stuff inside the GetLocalPlayer() block it will desync your game and drop players instantly whenever that bit of code executes.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,287
It's a global that gets set locally...?
Is it? It looks like a constant that gets referenced locally. If that constant is in the string table or its own separate table I do not know. What I do know was the desyncs in the past were reported around setting special effect model path locally and did exactly what you showed above.

The solution is to have global variables that are set to the string in an initialization trigger. This populates the string table with those strings for all clients and hence one can reference them locally without risk of desync.

In case there is confusion, the term "locally" is in reference to a specific client doing something different from all other clients and not anything related to global/local variables.
 
Level 45
Joined
Feb 27, 2007
Messages
5,578
constant that gets referenced locally
I definitely forgot the string table was a thing. You mean because it's doing something like this internally, the lookup of TRIGSTR_002 vs TRIGSTR_001 causes some sort of local state change and desyncs?
JASS:
globals
  constant string TRIGSTR_001 = "This text displays for all players"
  constant string TRIGSTR_002 = "This text only shows up for the Triggering Player, whomever that was"
  //Or maybe they aren't even put into a globals block anywhere but are accessed some other way

  string udg_StringVar
endglobals

//later
set udg_StringVar = TRIGSTR_001 //does it point to this location in memory but not take its value, or is udg_StringVar actually set here?
set udg_YourPlayerVariable = GetTriggerPlayer()
if GetLocalPlayer() == udg_YourPlayerVariable then
  set udg_StringVar = TRIGSTR_002 //same question here
endif
call MultiboardFuncWhatever(udg_StringVar)
I'm not sure how setting a variable on map init gets around this; ultimately you end up back in the same situation referencing different TRIGSTR_s, don't you? Maybe I just don't understand how the string table works. It also seems to me you could only pre-initialize a value if you knew which player(s) would need to see the local version later on, since you can only do it "once" at map init. For some situations this can be fine, but in others it definitely would not. What about dynamic local text? Perhaps to better help me understand, could you write a short example of the 'right' way to do this?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,287
I'm not sure how setting a variable on map init gets around this; ultimately you end up back in the same situation referencing different TRIGSTR_s, don't you?
Trigger strings in GUI are resolved from an external file. However they will resolve to a string already loaded in the table if they were loaded before. I believe the desync was caused by the JASS string tables getting out of sync but people were not very clear. It is pretty much one of those cases one has to manually test and see if it breaks.
 
Status
Not open for further replies.
Top