• 🏆 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!

letterbox only one player?

Status
Not open for further replies.
Level 23
Joined
Apr 16, 2012
Messages
4,041
by letterbox you mean dialog with buttons?

Create it, attach buttons to it, and then write Custom Script: if GetLocalPlayer() == yourPlayer then, add a GUI action: Show dialog and then after that Custom Script "endif".

If there is GUI Show Dialog for player, then use that instead, it will be safer
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,196
by letterbox you mean dialog with buttons?
No he means letterbox cinematic mode. I do agree that it is kind of a weird term in this day and age however it is still used (even commercially) so is something worth remembering.

how to show letterbox only for one player with getlocalplayer()?
Use GetLocalPlayer to run the actions to enter and exit letterbox cinematic mode only for certain players. Do not run any other actions.

GetLocalPlayer returns the player who's client executes it. Since all clients in a multiplayer game execute it in parallel, it will return a different value for each client. When tested against another player or if inside a force you can get a boolean which can be used in a flow control statement to execute code locally. Since all clients deterministic states must match (same stuff happens across all clients in parallel) you can only run non-deterministic calls locally for a client otherwise the host server will eventually detect an out of synchronization between the clients and either split them to separate sessions or drop them with the "You have been Disconnected" error.

For logical reasons computer players, empty slots or neutral players will never be returned by GetLocalPlayer. This is because they have no client for them. It is also pointless to run script locally for them as they have no "local" state as they have no client.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
For logical reasons computer players, empty slots or neutral players will never be returned by GetLocalPlayer. This is because they have no client for them. It is also pointless to run script locally for them as they have no "local" state as they have no client.

That moment when you think you created nice code...
JASS:
        if GetPlayerSlotState(p) == PLAYER_SLOT_STATE_PLAYING and GetPlayerController(p) == MAP_CONTROL_USER then
            if GetLocalPlayer() == p then
 
Level 3
Joined
Jul 27, 2012
Messages
33
i've done with cinematic, i place it outside the local player bcause when inside it will be error, but now i want the quest take only once so the cinematic only show once when i click questgiver, i use integer in condition but is desync, how to do it? tx

  • Qget
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 2 (Blue) Selects a unit
      • Player - Player 3 (Teal) Selects a unit
      • Player - Player 4 (Purple) Selects a unit
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Triggering unit) Equal to Chansey 0038 <gen>
          • (Triggering unit) Equal to Chansey 0053 <gen>
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to Chansey 0038 <gen>
        • Then - Actions
          • Set Qnumber = 1
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to Chansey 0053 <gen>
        • Then - Actions
          • Set Qnumber = 2
        • Else - Actions
      • Set QEffect = <Empty String>
      • Set QText[0] = <Empty String>
      • Set QText[1] = <Empty String>
      • Set QText[2] = <Empty String>
      • Set QText[3] = QTalk3[Qnumber]
      • Set QSound[0] = No sound
      • Set QSound[1] = No sound
      • Custom script: set udg_LocalPlayer = GetLocalPlayer()
      • Unit Group - Pick every unit in (Units owned by (Triggering player) matching (((Matching unit) is selected by (Triggering player)) Equal to True)) and do (Actions)
        • Loop - Actions
          • Set QPickUnit = (Picked unit)
      • Unit Group - Pick every unit in (Units owned by LocalPlayer matching (((Matching unit) is selected by LocalPlayer) Equal to True)) and do (Actions)
        • Loop - Actions
          • Set QPickUnitLocal = (Picked unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • LocalPlayer Equal to Player 1 (Red)
              • LocalPlayer Equal to Player 2 (Blue)
              • LocalPlayer Equal to Player 3 (Teal)
              • LocalPlayer Equal to Player 4 (Purple)
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • QXint[Qnumber] Equal to 0
                  • ((Region centered at (Position of QGiver[Qnumber]) with size (400.00, 400.00)) contains QPickUnitLocal) Equal to True
            • Then - Actions
              • Set QXint[Qnumber] = 1
              • Set QEffect = Objects\RandomObject\RandomObject.mdl
              • Set QText[0] = |cff00ff00-NEW QUEST-|r
              • Set QText[1] = QTalk2[Qnumber]
              • Set QText[3] = QTalk1[Qnumber]
              • Set QSound[0] = QuestNew <gen>
              • Set QSound[1] = Hint <gen>
              • Quest - Enable Qquest[Qnumber]
              • Selection - Select QPickUnitLocal for LocalPlayer
            • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • ((Region centered at (Position of QGiver[Qnumber]) with size (400.00, 400.00)) contains QPickUnit) Equal to True
        • Then - Actions
          • Unit - Order QPickUnit to Hold Position
          • Unit - Make QPickUnit face QGiver[Qnumber] over 0.30 seconds
          • Sound - Play QSound[0] at 100.00% volume, attached to QGiver[Qnumber]
          • Cinematic - Turn on letterbox mode (hide interface) for (Player group((Triggering player))): fade out over 0.00 seconds
          • Cinematic - Send transmission to (Player group((Triggering player))) from QGiver[Qnumber] named Chansey: Play No sound and display QText[3]. Modify duration: Add 0.00 seconds and Wait
          • Game - Display to (Player group((Triggering player))) for 5.00 seconds the text: QText[0]
          • Game - Display to (Player group((Triggering player))) for 5.00 seconds the text: QText[1]
          • Cinematic - Turn off letterbox mode (show interface) for (Player group((Triggering player))): fade in over 0.00 seconds
          • Sound - Play QSound[1] at 100.00% volume, attached to QGiver[Qnumber]
        • Else - Actions
      • Special Effect - Create a special effect attached to the overhead of QGiver[Qnumber] using QEffect
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,196
i place it outside the local player bcause when inside it will be error
Would be a syntax error I guess.

What you are doing will probably desync people for the reasons I explained earlier. Perform the actual selection logic (who/what to affect) globally and once you have a specific player that you want to show only certain graphics to then you use GetLocalPlayer to run it locally.

GetLocalPlayer is not a toy. It should not be used for most logic and only used to run some very specific actions locally.
 
Status
Not open for further replies.
Top