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

[Trigger] Immediately Disconnected!

Status
Not open for further replies.
Level 5
Joined
Sep 21, 2012
Messages
68
Hi, i was making a quest for each player can do it separately. The problem is once they started to do it then all of them got instantly disconnected from my host (only me left in that host) and i don't what's wrong... Here the triggers, hopefully someone can solve my problem. The triggers work properly when i was playing alone myself.

I forgot how to post the triggers separately so sorry for a little bit messy.


  • This is the trigger that players go accepting quests, nothing is going wrong here, i think it works properly.
  • Peasant Quest Receive
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Item-type of (Sold Item)) Equal to NhËn NhiÖm Vô
          • (Triggering unit) Equal to Peasant Greenforst 1 0309 <gen>
    • Actions
      • Set PQuests_Player = (Owner of (Buying unit))
      • Set PQuests_Integer = (Player number of (Owner of (Buying unit)))
      • Set PQuests_Player = (Owner of (Buying unit))
      • Set PQuests_Index = ((PQuests_Integer x 1000) + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PQuests_ZGreenforst_NguoiDan[PQuests_Integer] Equal to 0
        • Then - Actions
          • Set ZPlayer_Force = (Player group((Owner of (Buying unit))))
          • Set PQuests_ZGreenforst_NguoiDan[PQuests_Integer] = 1
          • Set PQuests_Unit = Peasant Greenforst 1 0309 <gen>
          • Set PQuests_String = <Empty String>
          • Set PQuests_Reward_1[PQuests_Index] = 300
          • Set PQuests_Reward_2[PQuests_Index] = 150
          • Set PQuests_Reward_3[PQuests_Index] = 225
          • Set PQuests_Reward_4[PQuests_Index] = 3
          • Set PQuests_TalkStart = Chµo c¸c chiÕn sÃœ, ta lµ mét ngÂêi d©n sinh sèng ë khu rõng nµy nhÂng mµ nã ®· bÞ bän Undead x©m chiÕm. Ta cÇn c¸c ng¬i ®i lÊy cho ta 10 bã lóa m×. Ruéng cña ta n»m ë phÝa B¾c cña khu rõng nµy.
          • Set PQuests_TalkStart2 = Thu ho¹ch cho ngÂêi n«ng d©n n÷ ®ã 12 bã lóa m×. §ång ruéng cña c« ta n»m ë phÝa B¾c cña khu rõng Greenforst.|n
          • Set PQuests_Name = Lóa M×
          • Set PQuests_QuestsIcon = ReplaceableTextures\CommandButtons\BTNVillagerWoman.blp
          • Trigger - Run Quests Start Generator <gen> (ignoring conditions)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PQuests_ZGreenforst_NguoiDan[PQuests_Integer] Equal to 2
        • Then - Actions
          • Set PQuests_Unit = Peasant Greenforst 1 0309 <gen>
          • Set ZPlayer_Force = (Player group((Owner of (Buying unit))))
          • Set PQuests_ZGreenforst_NguoiDan[PQuests_Integer] = 3
          • Set PQuests_Continue = False
          • Trigger - Run Quests End Generator <gen> (ignoring conditions)
        • Else - Actions
  • Here is the quest Start Generator i done myself for my map. It helps creating quest for each player can do it alone themself.
  • Quests Start Generator
    • Events
    • Conditions
    • Actions
      • Special Effect - Destroy PQuests_Effect[PQuests_Index]
      • Game - Display to ZPlayer_Force for 15.00 seconds the text: PQuests_TalkStart
      • Game - Display to ZPlayer_Force for 15.00 seconds the text: PhÇn ThÂëng:
      • Game - Display to ZPlayer_Force for 15.00 seconds the text: ((|cffff80ff + (String(PQuests_Reward_1[PQuests_Index]))) + §iÓm kinh nghiÖm)
      • Game - Display to ZPlayer_Force for 15.00 seconds the text: ((|cffff80ff + (String(PQuests_Reward_2[PQuests_Index]))) + §iÓm kinh nghiÖm cña ®å)
      • Game - Display to ZPlayer_Force for 15.00 seconds the text: ((|cffffff00 + (String(PQuests_Reward_3[PQuests_Index]))) + Vµng)
      • Game - Display to ZPlayer_Force for 15.00 seconds the text: ((|cffff8000 + (String(PQuests_Reward_4[PQuests_Index]))) + §iÓm SVP)
      • Custom script: call DestroyForce(udg_ZPlayer_Force)
      • Quest - Create a Optional quest titled (|cff80ff00 + (PQuests_Name + |r)) with the description (PQuests_TalkStart2 + (PhÇn ThÂëng:|n + (((|cffff80ff + (String(PQuests_Reward_1[PQuests_Index]))) + §iÓm kinh nghiÖm|r|n) + (((|cffff80ff + (String(PQuests_Reward_2[PQuests_Index]))) + §iÓm kinh nghiÖm cña ®å|r|n) + (((|cffffff00 + (String(PQue, using icon path PQuests_QuestsIcon
      • Quest - Disable (Last created quest)
      • Set PQuests_Quests[PQuests_Index] = (Last created quest)
      • Custom script: if GetLocalPlayer( ) == udg_PQuests_Player then
      • Sound - Play QuestNew <gen>
      • Set PQuests_String = Objects\RandomObject\RandomObject.mdl
      • Quest - Enable (Last created quest)
      • Custom script: endif
      • Special Effect - Create a special effect attached to the overhead of PQuests_Unit using PQuests_String
      • Set PQuests_Effect[PQuests_Index] = (Last created special effect)
  • Here is the quest End Generator.
  • Quests End Generator
    • Events
    • Conditions
    • Actions
      • Special Effect - Destroy PQuests_Effect[PQuests_Index]
      • Quest - Mark PQuests_Quests[PQuests_Index] as Completed
      • Game - Display to ZPlayer_Force for 15.00 seconds the text: PQuests_TalkEnd[(Random integer number between 1 and 7)]
      • Game - Display to ZPlayer_Force for 15.00 seconds the text: PhÇn ThÂëng:
      • Game - Display to ZPlayer_Force for 15.00 seconds the text: ((|cffff80ff + (String(PQuests_Reward_1[PQuests_Index]))) + §iÓm kinh nghiÖm)
      • Game - Display to ZPlayer_Force for 15.00 seconds the text: ((|cffff80ff + (String(PQuests_Reward_2[PQuests_Index]))) + §iÓm kinh nghiÖm cña ®å)
      • Game - Display to ZPlayer_Force for 15.00 seconds the text: ((|cffffff00 + (String(PQuests_Reward_3[PQuests_Index]))) + Vµng)
      • Game - Display to ZPlayer_Force for 15.00 seconds the text: ((|cffff8000 + (String(PQuests_Reward_4[PQuests_Index]))) + §iÓm SVP)
      • Custom script: call DestroyForce(udg_ZPlayer_Force)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Hero level of Game_Hero[PQuests_Integer]) Greater than or equal to ((PQuests_Reward_1[PQuests_Index] - (PQuests_Reward_1[PQuests_Index] mod 100)) / 100)
        • Then - Actions
          • Hero - Add PQuests_Reward_1[PQuests_Index] experience to Game_Hero[PQuests_Integer], Show level-up graphics
        • Else - Actions
          • Hero - Add ((Hero level of Game_Hero[PQuests_Integer]) x 100) experience to Game_Hero[PQuests_Integer], Show level-up graphics
      • Set Hero_ItemExp[PQuests_Integer] = (Hero_ItemExp[PQuests_Integer] + PQuests_Reward_2[PQuests_Index])
      • Player - Add PQuests_Reward_3[PQuests_Index] to (Player(PQuests_Integer)) Current gold
      • Set Game_SVP[PQuests_Integer] = (Game_SVP[PQuests_Integer] + PQuests_Reward_4[PQuests_Index])
      • Custom script: if GetLocalPlayer( ) == udg_PQuests_Player then
      • Sound - Play GoodJob <gen>
      • Custom script: endif
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PQuests_Continue Equal to True
        • Then - Actions
          • Custom script: if GetLocalPlayer( ) == udg_PQuests_Player then
          • Set PQuests_String = Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
          • Custom script: endif
          • Special Effect - Create a special effect attached to the overhead of PQuests_Unit using PQuests_String
          • Set PQuests_Effect[PQuests_Index] = (Last created special effect)
        • Else - Actions
  • Here is the trigger i think that has to be something wrong with it, players get immediately disconnected when this trigger is first time working, i mean when you pick up an item that listed in this trigger (Wheat).
  • Peasant Quest - Doing Part
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • Set PQuests_Player = (Owner of (Triggering unit))
      • Set PQuests_Integer = (Player number of (Owner of (Triggering unit)))
      • Set PQuests_Index = ((PQuests_Integer x 1000) + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • PQuests_ZGreenforst_NguoiDan[PQuests_Integer] Equal to 1
          • (PQuests_Quests[PQuests_Index] is enabled) Equal to True
          • (Item-type of (Item being manipulated)) Equal to Wheat
        • Then - Actions
          • Item - Remove (Item being manipulated)
          • Set PQuests_Count[PQuests_Index] = (PQuests_Count[PQuests_Index] + 1)
          • Quest - Change the description of PQuests_Quests[PQuests_Index] to (NhiÖm vô cña b¹n ®ang lµm lµ nhÆt + ((String(PQuests_Count[PQuests_Index])) + (/ + (12 + ( bã lóa m×.|n + (PhÇn ThÂëng:|n + (((|cffff80ff + (String(PQuests_Reward_1[PQuests_Index]))) + §iÓm kinh nghiÖm|n) + (((|cffff80ff + (String(PQuests_
          • Set ZPlayer_Force = (Player group((Owner of (Triggering unit))))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • PQuests_Count[PQuests_Index] Greater than or equal to 12
            • Then - Actions
              • Set PQuests_ZGreenforst_NguoiDan[PQuests_Integer] = 2
              • Special Effect - Destroy PQuests_Effect[PQuests_Index]
              • Set Quests_Point = (Position of Peasant Greenforst 1 0309 <gen>)
              • Cinematic - Ping minimap for ZPlayer_Force at Quests_Point for 10.00 seconds
              • Game - Display to ZPlayer_Force for 3.00 seconds the text: NhiÖm vô Thu ho¹...
              • Custom script: call RemoveLocation(udg_Quests_Point)
              • Set PQuests_Unit = Peasant Greenforst 1 0309 <gen>
              • Set PQuests_String = <Empty String>
              • Custom script: if GetLocalPlayer( ) == udg_PQuests_Player then
              • Set PQuests_String = Abilities\Spells\Other\TalkToMe\TalkToMe.mdl
              • Custom script: endif
              • Special Effect - Create a special effect attached to the overhead of PQuests_Unit using PQuests_String
              • Set PQuests_Effect[PQuests_Index] = (Last created special effect)
            • Else - Actions
              • Game - Display to ZPlayer_Force for 2.00 seconds the text: (NhiÖm vô Thu ho¹ch lóa m×: §· nhÆt ®Âîc + ((String(PQuests_Count[PQuests_Index])) + (/ + (12 + bã lóa m×.))))
          • Custom script: call DestroyForce(udg_ZPlayer_Force)
        • Else - Actions
 
Last edited:
I think this could be the problem (jassified)

JASS:
if GetLocalPlayer() == udg_PQuests_Player then
    set udg_PQuests_String = "Abilities\\Spells\\Other\\TalkToMe\\TalkToMe.mdl"
endif
.. handle creation

This might cause a desync with other players since the string table will not have the same string handles or indices for said string handles. A proper fix would be: (in jass, but I hope you can catch on)

JASS:
set udg_PQuests_String = "Abilities\\Spells\\Other\\TalkToMe\\TalkToMe.mdl"
if GetLocalPlayer() != udg_PQuests_Player then
    set udg_PQuests_String = ""
endif
.. handle creation
 
Level 5
Joined
Sep 21, 2012
Messages
68
I have a little bit don't understand... why the "Quests Start Generator" trigger didn't cause a desync (it also has GetLocalPlayer action in it) but a trigger (Peasant Quest - Doing Part) running after it caused desync?
 
When looking at a script, these functions are prone to desyncs:

  • Wait 2.00 seconds of real-time
JASS:
    native GetLocalPlayer takes nothing returns player

When you do things inside a GetLocalPlayer() condition, you have to make sure that you don't create handles that are required by the game to be synced (e.g. units, regions, points, special effects). Strings have their own table, but behave like handles as described earlier.

With that being said, I recommend checking out for those two in your triggers for possible desyncs. After that has been checked out, the possibility of other triggers causing the desync become more likely.
 
Level 5
Joined
Sep 21, 2012
Messages
68
It's weird that even i deleted the GetLocalPlayer function, the game still caused desync. I'm trying to delete every single line of the trigger and test the map 1 by 1 to see where was the problem (Completely delete the "Peasant Quest - Doing Part" trigger will cause no more desync).
 
Level 5
Joined
Sep 21, 2012
Messages
68
Thank you for helping me. I understand and don't understand at the same time why the desync occured right that condition part.... If you have some clues what is going wrong then you can teach me then... Have a nice day!
 
Status
Not open for further replies.
Top