• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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,208
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,208
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