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

Disconnecing from custom scripts

Status
Not open for further replies.
  • Zoomin
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to (==) Zoom (Neutral Hostile 1)
    • Actions
      • Set PN = (Player number of (Owner of (Triggering unit)))
      • Custom script: if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Zoomed[PN] Equal to (==) False
          • Then - Actions
            • Set Zoomed[PN] = True
            • Set shootpoint = ((Position of PlayerHero[PN]) offset by 1500.00 towards (Facing of PlayerHero[PN]) degrees)
            • Unit - Create 1 Dummy Bullet for (Player(PN)) at shootpoint facing (Facing of PlayerHero[PN]) degrees
            • Animation - Change (Last created unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
            • Set Shot[PN] = (Last created unit)
            • Custom script: call RemoveLocation(udg_shootpoint)
            • Custom script: call SetCameraUnit(GetLastCreatedUnit())
            • Custom script: call SetMovementUnit(GetLastCreatedUnit(),GetOwningPlayer(GetLastCreatedUnit()),5)
            • Cinematic - Fade out and back in over 1.00 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
            • Cinematic - Apply a filter over 0.00 seconds using Normal blending on texture war3mapImported\ScopeFilter.blp, starting with color (100.00%, 100.00%, 100.00%) and 100.00% transparency and ending with color (0.00%, 0.00%, 0.00%) and 0.00% transparency
          • Else - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • Zoomed[PN] Equal to (==) True
              • Then - Actions
                • Set Zoomed[PN] = False
                • Unit - Remove Shot[PN] from the game
                • Custom script: call SetCameraUnit(GetTriggerUnit())
                • Custom script: call SetMovementUnit(GetTriggerUnit(),GetOwningPlayer(GetTriggerUnit()),5)
                • Cinematic - Fade out and back in over 1.00 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
                • Cinematic - Hide filter
              • Else - Actions
      • Custom script: endif
 
Level 10
Joined
Mar 31, 2009
Messages
732
Just looked over the code, if you use locals instead of globals it should work. I'm not 100% on whether modifying a local will cause a desync though.

Since Blizzard changed it a while back, so we can't override a global anymore, you would need to convert that trigger to JASS and change the globals PN, Zoomed, PlayerHero, and Shot to locals.
 
  • Set Zoomed[PN] = True
That right there will be causing your disconnect. I didn't even look past that.
You cannot do anything that will be broadcasted and confirmed with the other clients in a multiplayer game, within a GetLocalPlayer() block.

This is not necessarily true. It doesn't disconnect for modifying variables. (Except in specific cases) Creating handles, random seeds, using a string for the first time, etc. causes disconnections in the map. =)

There are a few things that'd cause your disconnect in the code.
  • Unit - Create 1 Dummy Bullet for (Player(PN)) at shootpoint facing (Facing of PlayerHero[PN]) degrees
First and foremost, creating normally allocated handles (eg: unit) causes disconnects in maps. So, you'd need to find a workaround to that^.

  • Cinematic - Fade out and back in over 1.00 seconds using texture Black Mask and color (0.00%, 0.00%, 0.00%) with 0.00% transparency
  • Cinematic - Apply a filter over 0.00 seconds using Normal blending on texture war3mapImported\ScopeFilter.blp, starting with color (100.00%, 100.00%, 100.00%) and 100.00% transparency and ending with color (0.00%, 0.00%, 0.00%) and 0.00% transparency
These disconnect because they destroy timers (and some of the functions create new timers). This is a problem since they are normally allocated handles. You'd need to find a work around to this as well. =(

Generally, doing things in large blocks for a local player is like a "Disconnect Me" sign. :grin: Here is a tutorial that might shine some light on GetLocalPlayer() for those curious:
GetLocalPlayer() Tutorial

Basically, you have to use a series of hide/show usages, and modifications of arguments to make things actually work for a single player. Usually it is pretty dangerous, especially when dealing with things like units.
 
Status
Not open for further replies.
Top