HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Why is this causing desyncs?

03-26-2010, 08:59 PM#1
PsycoMarauder
Can't figure out why this is causing desyncs. Desyncs still occur when the minimap isn't being pinged-- is the range 2600 too large?

Recruitment Center Abils
Trigger:
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Unit-type of (Casting unit)) Equal to Recruitment Center
Collapse Actions
Set ControlPanelCaster = (Casting unit)
-------- Select Nearby --------
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
(Ability being cast) Equal to Select Nearby Tents 2
Collapse Then - Actions
Cinematic - Ping minimap for (All players matching ((Owner of ControlPanelCaster) Equal to (Matching player))) at (Position of ControlPanelCaster) for 1.00 seconds, using a Simple ping of color (40.00%, 100.00%, 40.00%)
Selection - Clear selection for (Owner of ControlPanelCaster)
Set RecruitmentCenterAbil = (Units within 2600.00 of (Position of ControlPanelCaster) matching (((Unit-type of (Matching unit)) Equal to Recruitment Center) and ((Owner of (Matching unit)) Equal to (Owner of ControlPanelCaster))))
Selection - Select RecruitmentCenterAbil for (Owner of ControlPanelCaster)
Collapse Unit Group - Pick every unit in (Units currently selected by (Owner of ControlPanelCaster)) and do (Actions)
Collapse Loop - Actions
Cinematic - Ping minimap for (Player group((Owner of ControlPanelCaster))) at (Position of (Picked unit)) for 1.00 seconds, using a Simple ping of color (40.00%, 100.00%, 40.00%)
Else - Actions
03-26-2010, 09:03 PM#2
Anachron
Remove everything except the cinematic stuff. I think it desyncs there.
03-26-2010, 10:23 PM#3
PsycoMarauder
I'm sorry, are you saying that you think it is or isn't in the cinematic stuff? Also, this is an annoying little trigger to try and debug, since I can only test it online. -.-
03-26-2010, 10:47 PM#4
Krysho
Friend of mine had issues with GUI selections causing desyncs as well.

In the worst case, change your group creation and selection to native JASS and the desync might go away.
03-31-2010, 06:15 AM#5
PsycoMarauder
Eh, still kinda need help with this. Bump.
03-31-2010, 10:54 AM#6
Krysho
Alright, decided to dig into the issue again.

The last time I was looking into this, I speculated that the desync was caused by the Blizzard code for the "select unit group for player," which happened to use a ForGroup inside of a GetLocalPlayer if-block.

Here is a test trigger that desyncs:
Trigger:
Untitled Trigger 001
Collapse Events
Player - Player 1 (Red) Selects a unit
Collapse Conditions
(Unit-type of (Triggering unit)) Equal to í’‹맨
Collapse Actions
Set agroup = (Units within 2600.00 of (Position of (Triggering unit)) matching (((Owner of (Matching unit)) Equal to (Triggering player)) and ((Unit-type of (Matching unit)) Not equal to (Unit-type of (Triggering unit)))))
Selection - Select agroup for (Triggering player)

The "Selection - Select agroup for (Triggering player)" uses the ForGroup I mentioned. Thus, an equivalent trigger would be this:
Trigger:
Untitled Trigger 001 Copy
Collapse Events
Player - Player 1 (Red) Selects a unit
Collapse Conditions
(Unit-type of (Triggering unit)) Equal to í’‹맨
Collapse Actions
Set agroup = (Units within 2600.00 of (Position of (Triggering unit)) matching (((Owner of (Matching unit)) Equal to (Triggering player)) and ((Unit-type of (Matching unit)) Not equal to (Unit-type of (Triggering unit)))))
Custom script: if (GetTriggerPlayer() == GetLocalPlayer()) then
Custom script: call ClearSelection()
Custom script: call ForGroup(udg_agroup, function SelectGroupBJEnum)
Custom script: endif

Which also desyncs. If it is ForGroup causing issues, the obvious fix would be to iterate through the group such that every player is aware of the iterations... like so:
Trigger:
Untitled Trigger 001 Copy Copy
Collapse Events
Player - Player 1 (Red) Selects a unit
Collapse Conditions
(Unit-type of (Triggering unit)) Equal to í’‹맨
Collapse Actions
Custom script: local unit u
Trigger - Turn off (This trigger)
Set agroup = (Units within 2600.00 of (Position of (Triggering unit)) matching (((Owner of (Matching unit)) Equal to (Triggering player)) and ((Unit-type of (Matching unit)) Not equal to (Unit-type of (Triggering unit)))))
Custom script: if (GetTriggerPlayer() == GetLocalPlayer()) then
Custom script: call ClearSelection()
Custom script: endif
Custom script: loop
Custom script: set u = FirstOfGroup(udg_agroup)
Custom script: exitwhen (u == null)
Custom script: if (GetTriggerPlayer() == GetLocalPlayer()) then
Custom script: call SelectUnit(u, true)
Custom script: endif
Custom script: call GroupRemoveUnit(udg_agroup, u)
Custom script: endloop
Wait 3.00 game-time seconds
Trigger - Turn on (This trigger)

That last trigger does not desync. Feel free to take that as you will. Also, the forum parsed out my spaces to format those script actions.