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

[General] How to fix the custom camera of every player in multiplayer without crash?

Status
Not open for further replies.
hey, player 6-10 are supposed to have an upside down camera, and there is this trigger that will fix their camera if the scroll. But this causes desync because players disconnect.

Ideas how to improve?

  • Camera for Team 2 Fix
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 6 to 10, do (Actions)
        • Loop - Actions
          • Set TempPlayer = (Player((Integer A)))
          • Custom script: if GetLocalPlayer() == udg_TempPlayer then
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Angle of attack of the current camera view) Not equal to 304.00
                  • (Rotation of the current camera view) Not equal to 270.00
                  • (Distance to target of the current camera view) Not equal to 1650.00
                  • (Field of view of the current camera view) Not equal to 70.00
                  • (Roll of the current camera view) Not equal to 0.00
                  • (Height Offset of the current camera view) Not equal to 0.00
            • Then - Actions
              • Set TempPForCamera = (Target of current camera view)
              • Camera - Apply Camera Team 2 <gen> for TempPlayer over 0.00 seconds
              • Camera - Pan camera for TempPlayer to TempPForCamera over 0.00 seconds
            • Else - Actions
          • Custom script: endif
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
Store your active Players in a Player Group at the start of the game. Then when they leave the game, remove them from the Player Group.

Then instead of using a For Loop, use Pick every Player in Group.

  • Add Team2
    • Events
      • Time - Elapsed game time is 0.50 seconds
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) slot status) Equal to Is playing
              • Or - Any (Conditions) are true
                • Conditions
                  • (Picked player) Equal to Player 6 (Orange)
                  • (Picked player) Equal to Player 7 (Green)
                  • (Picked player) Equal to Player 8 (Pink)
                  • (Picked player) Equal to Player 9 (Gray)
                  • (Picked player) Equal to Player 10 (Light Blue)
            • Then - Actions
              • Player Group - Add (Picked player) to Team2
            • Else - Actions
  • Leave Team2
    • Events
      • Player - Player 6 (Orange) leaves the game
      • Player - Player 7 (Green) leaves the game
      • Player - Player 8 (Pink) leaves the game
      • Player - Player 9 (Gray) leaves the game
      • Player - Player 10 (Light Blue) leaves the game
    • Conditions
    • Actions
      • Player Group - Remove (Triggering player) from Team2.
  • Camera Fix
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Player Group - Pick every player in Team2 and do (Actions)
        • Loop - Actions
          • -------- do camera stuff --------
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
I'm not sure what exactly causes the Desync, but it doesn't sound very safe to run code for non-existing Players. It's also not efficient.

These probably desync as well since they're inside of the GetLocalPlayer() block:
  • Set TempPForCamera = (Target of current camera view)
  • Camera - Apply Camera Team 2 <gen> for TempPlayer over 0.00 seconds
  • Camera - Pan camera for TempPlayer to TempPForCamera over 0.00 seconds
Not sure though.
 
Status
Not open for further replies.
Top