• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Strange unit group desync?!

Status
Not open for further replies.
Level 14
Joined
Aug 8, 2010
Messages
1,022
Sup, guys! I have a really small problem here. I have a desync in a trigger that doesn't even use local player... :eekani: It's related to my shop category system (for my map).
Here is the trigger :
  • Shop Cancel
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • (Unit-type of (Sold unit)) Equal to Cancel
    • Actions
      • Unit - Remove (Sold unit) from the game
      • Set Location = (Position of (Selling unit))
      • Set UnitGroup = (Units within 50.00 of Location matching ((Level of Select Hero [Arrow] for (Matching unit)) Not equal to 0))
      • Custom script: call RemoveLocation(udg_Location)
      • Selection - Select UnitGroup for (Owner of (Buying unit))
      • Custom script: call DestroyGroup(udg_UnitGroup)
The funny thing is that this trigger does not desync :hohum: :
  • Shop Cancel
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • (Unit-type of (Sold unit)) Equal to Cancel
    • Actions
      • Unit - Remove (Sold unit) from the game
      • Set Location = (Position of (Selling unit))
      • Set UnitGroup = (Units within 50.00 of Location matching ((Level of Select Hero [Arrow] for (Matching unit)) Not equal to 0))
      • Custom script: call RemoveLocation(udg_Location)
      • Unit Group - Pick every unit in UnitGroup and do (Actions)
        • Loop - Actions
          • Selection - Select (Picked unit) for (Owner of (Buying unit))
      • Custom script: call DestroyGroup(udg_UnitGroup)
Can someone explain or anything? :thumbs_up:
 
Level 10
Joined
Dec 15, 2012
Messages
650
@ CoLD Bon3, did you tried my way ?
If it works that way then that means UnitGroup stored the details of Location. If you destroy Location before you select UnitGroup then Location's details break and UnitGroup can't get any detail of Location so it desync.
IF IT WORKS THAT WAY
 
Level 16
Joined
Dec 15, 2011
Messages
1,423
@ CoLD Bon3, did you tried my way ?
If it works that way then that means UnitGroup stored the details of Location. If you destroy Location before you select UnitGroup then Location's details break and UnitGroup can't get any detail of Location so it desync.
IF IT WORKS THAT WAY

If the Location is destroyed beforehand, it will simply return the default one (i.e Center of map).
 
Level 10
Joined
Dec 15, 2012
Messages
650
Btw I find your emo and Oh yeah strangely disturbing. Guess it is just me.
The strange person is you, man. You say everything yourself, I didn't said that you're suspicious.
"Oh yeah ?" is my emo when I'm surprised. Everyone can put the icon they desired to let people know their emo. Somebody is crying and he/she put a :ogre_haosis:. What do you think about this ?
I can put ":ogre_icwydt:" or "arghhhhh" if you don't like a "Oh yeah ?"
:ash:I'm sorry about this if I have let you felt that you're suspected by someone.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
JASS:
function SelectGroupForPlayerBJ takes group g,player whichPlayer returns nothing
    if (GetLocalPlayer() == whichPlayer) then
        call ClearSelection()
        call ForGroup( g, function SelectGroupBJEnum )
    endif
endfunction

You lied about the no "GetLocalPlayer" part... Shame on you.

It executes entire series of code for a specific player, no wonder it desyncs. The entire for group is done locally (and is the cause of the problem).

The other does not desynchronize because you execute the for group synchronously for all players.
 
Level 5
Joined
May 6, 2013
Messages
125
JASS:
function SelectGroupBJEnum takes nothing returns nothing
    call SelectUnit( GetEnumUnit(), true )
endfunction
So, all it does is clearing the selection and then adding the units to the players selection. Selections are not synced unless you manually sinc them, aren't they? So, how come it desyncs at all? More over, how come a BJ that is not commented to desync anything can do that? The only thing i could imagine is a trigger with a selection event suddenly fireing locally only. I really don't get that desync. Somebody mind explaining?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
So, how come it desyncs at all?
Probably something to do with how the game engine processes ForGroup loops which results in game states deviating. A simple explanation could be persistent internal JASS structures that are used during a ForGroup loop which have results that influence the execution of other JASS code. An example could be a change of order in how units are processed by the game so everyone should be A->B->C but someone goes C->A->B which produces different results.
 
Status
Not open for further replies.
Top