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

Player disconnects after another player's hero is revived

Status
Not open for further replies.
Level 14
Joined
Aug 30, 2004
Messages
909
I have a lot of experience programming a campaign, but I am now working on my first BattleNet game; a dog-fighting game set in the star wars universe.

I have a bug that I just discovered playing on a LAN.

When my hero dies (Player 1), a trigger revives him after 20 seconds at his spawn point. When that happens, Player 2 (my friend sitting next to me) disconnects. Here is the death trigger (I've added explanations after // )

  • Hero Repawn
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • ((Owner of (Triggering unit)) controller) Equal to User
    • Actions
      • Unit - Kill Fliers[(Player number of (Owner of (Triggering unit)))]
  • //blows up the hero's ship
    • -------- -----------Kill shuttle --------
  • //Fixes a bug where a shuttle would be going to pick up the hero who died
    • For each (Integer FlareHeroDeathCounter) from 1 to 11, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Triggering unit) Equal to FlareHero[FlareHeroDeathCounter]
          • Then - Actions
            • Unit - Kill FlareShuttle[FlareHeroDeathCounter]
            • Set FlareHero[FlareHeroDeathCounter] = No unit
            • Set FlareShuttle[FlareHeroDeathCounter] = No unit
            • Set HeroInSomething[FlareHeroDeathCounter] = False
          • Else - Actions
    • -------- ------------------ --------
    • -------- --------fix Aimed shot----------- --------
    • -------- ------------------ --------
  • //fixes bugs if an enemy sniper is using aimed shot on him when he dies
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Triggering unit) Equal to aimedShotShooter[1]
      • Then - Actions
        • Trigger - Run Aimed Shot Cancel <gen> (ignoring conditions)
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Triggering unit) Equal to aimedShotShooter[2]
      • Then - Actions
        • Trigger - Run Aimed Shot Cancel 2 <gen> (ignoring conditions)
      • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Triggering unit) Equal to aimedShotShooter[3]
      • Then - Actions
        • Trigger - Run Aimed Shot Cancel 3 <gen> (ignoring conditions)
      • Else - Actions
    • -------- ------------------ --------
    • Camera - Reset camera for (Owner of (Triggering unit)) to standard game-view over 0.00 seconds
    • Camera - Set (Owner of (Triggering unit))'s camera Distance to target to 3800.00 over 0.00 seconds
    • Camera - Set (Owner of (Triggering unit))'s camera Far Z to 9500.00 over 0.00 seconds
    • Set tempPlayerGroup = (Player group((Owner of (Triggering unit))))
    • Game - Display to tempPlayerGroup the text: |c0066ff66HINT|r - ...
    • Custom script: call DestroyForce(udg_tempPlayerGroup)
    • Wait 20.00 game-time seconds
  • //if the game is over this trigger is turned off for ending cinematic
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • ((This trigger) is on) Equal to False
      • Then - Actions
        • Skip remaining actions
      • Else - Actions
    • Camera - Reset camera for (Owner of (Triggering unit)) to standard game-view over 0.00 seconds
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • ((Triggering unit) belongs to an ally of Player 11 (Dark Green)) Equal to True
      • Then - Actions
        • Camera - Pan camera as necessary for (Owner of (Triggering unit)) to HeroSpawnPointRebel over 2.50 seconds
        • Hero - Instantly revive (Triggering unit) at HeroSpawnPointRebel, Hide revival graphics
      • Else - Actions
        • Camera - Pan camera as necessary for (Owner of (Triggering unit)) to HeroSpawnPointEmpire over 2.50 seconds
        • Hero - Instantly revive (Triggering unit) at HeroSpawnPointEmpire, Hide revival graphics

As far as I can tell, the trigger works fine. The hero dies. Twenty seconds later he respawns at the appropriate point (HeroSpawnPointRebel). My camera zooms to my hero and I can keep playing, but player 2 is disconnected.

I've never done a Bnet map before, so I have no idea what could cause a disconnect!
 
Level 14
Joined
Aug 30, 2004
Messages
909
Never use "Pan camera as necessary" as it only causes problems (such as the disconnect you have been experiencing).
Replace it with the "Camera - Pan Camera (Timed)".

Wow, nice job! I had just gotten done enabling and disabling everything to isolate the line of code that was causing the problem. I thought it must have something to do with the "owner of triggering unit" bit and was scared as all hell that it would be a disconnect for many other triggers as well.

Thank you very much for your help! +rep of course, and feel better about yourself for having helped a fellow lowly primate.

Darwin
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
Out of Sync disconnects (or splits) can also occur with incorrect usage of GetLocalPlayer() to run play modifying code for only some clients.

You can also cause them by using terrain deformations (in any way) in a game with mixed mac and window users as the mac client does not handle them the same as the windows client.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
Out of Sync disconnects (or splits) can also occur with incorrect usage of GetLocalPlayer() to run play modifying code for only some clients.

You can also cause them by using terrain deformations (in any way) in a game with mixed mac and window users as the mac client does not handle them the same as the windows client.

Just an urban legend or something experimented by yourself ?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,202
The GetLocalPlayer() splits I described are obvious. If 1 player ownes a unit for one client yet another for another client and it is in combat, the combat results will be different and thus the player must be thrown out of sync. You can use it for non gameplay affecting code though like player specific multiboards, effects or floating text.

The mac split described has been reported numberous times and was a major problem at some stage in the map SWAT aftermath (where I learned of it). Although no experience first hand it is clear that it does cause splits.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
Ofc i was talking about the mac issue, i thought it was fixed since many patchs.

Oh and btw the last time i tried to create a mbitem locally it desynced, but giving a different value for each player should be fine, and ofc display/hide a multiboard locally is safe.
I say that because this split is not that obvious even if a multiboarditem is an handle, it's something visual, like a texttag, and you can create texttags locally, it's even recommended because of the internal limit of 100 (if you have the need ofc)
 
Status
Not open for further replies.
Top