1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  4. Travel to distant realms and encounter scenes unknown to the common folk. The Greatest of Adventures is upon us with the 8th Cinematic Contest. Join in on a fun ride.
    Dismiss Notice
  5. The 18th Icon Contest is ON! Choose any ingame unit and give him/her Hero abilities. Good luck to all.
    Dismiss Notice
  6. Contestants are to create a scene set in the Stone Age. Come and see what you can come up with. We wish you the best of luck!
    Dismiss Notice
  7. Colour outside the lines! Techtree Contest #13 is a go. The contest is optionally paired.
    Dismiss Notice
  8. Greetings cerebrates, our Swarm needs new spawners that will have numerous children. Join the HIVE's 31st Modeling Contest - Spawners and Spawned! The contest is optionally paired.
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Strange unit group desync?!

Discussion in 'Triggers & Scripts' started by CoLd Bon3, Jun 8, 2013.

  1. CoLd Bon3

    CoLd Bon3

    Joined:
    Aug 8, 2010
    Messages:
    948
    Resources:
    4
    Spells:
    4
    Resources:
    4
    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 :
    Desync 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: :
    DesyncLESS 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)
        • 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:
     
  2. EmoBrother

    EmoBrother

    Joined:
    Dec 15, 2012
    Messages:
    554
    Resources:
    0
    Resources:
    0
    Try to Select UnitGroup for (owner of (Buying unit)) before you destroy the point variable --- Location and then c it still desync or not o.0
     
  3. Doomlord

    Doomlord

    Joined:
    Dec 15, 2011
    Messages:
    1,150
    Resources:
    14
    Spells:
    12
    JASS:
    2
    Resources:
    14
  4. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,609
    Resources:
    18
    Maps:
    1
    Spells:
    11
    Tutorials:
    6
    Resources:
    18
    I don't think a unit a building can be selected at the same time?


    In this case the unit group contains the selling unit and the buying unit
     
  5. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,476
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Are there any triggers that run on unit selection (unit is selected event)?
     
  6. CoLd Bon3

    CoLd Bon3

    Joined:
    Aug 8, 2010
    Messages:
    948
    Resources:
    4
    Spells:
    4
    Resources:
    4
    @Dr Super Good - nope.
     
  7. EmoBrother

    EmoBrother

    Joined:
    Dec 15, 2012
    Messages:
    554
    Resources:
    0
    Resources:
    0
    @ 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
     
  8. Doomlord

    Doomlord

    Joined:
    Dec 15, 2011
    Messages:
    1,150
    Resources:
    14
    Spells:
    12
    JASS:
    2
    Resources:
    14
    If the Location is destroyed beforehand, it will simply return the default one (i.e Center of map).
     
  9. EmoBrother

    EmoBrother

    Joined:
    Dec 15, 2012
    Messages:
    554
    Resources:
    0
    Resources:
    0
    Oh yeah ? -.- But it hasn't ne nulled.
     
  10. Doomlord

    Doomlord

    Joined:
    Dec 15, 2011
    Messages:
    1,150
    Resources:
    14
    Spells:
    12
    JASS:
    2
    Resources:
    14
    What do you mean? If you don't buy it, test it out and see for yourself.

    Btw I find your emo and Oh yeah strangely disturbing. Guess it is just me.
     
  11. CoLd Bon3

    CoLd Bon3

    Joined:
    Aug 8, 2010
    Messages:
    948
    Resources:
    4
    Spells:
    4
    Resources:
    4
    Uhm, guys. I don't think the location is the problem. I mean, the script works perfectly for the player running it. Just.. the others get disconnected. Nevermind, though. I am using the working script anyways.
    Thanks a lot with the help! :)
     
  12. EmoBrother

    EmoBrother

    Joined:
    Dec 15, 2012
    Messages:
    554
    Resources:
    0
    Resources:
    0
    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.
     
  13. Doomlord

    Doomlord

    Joined:
    Dec 15, 2011
    Messages:
    1,150
    Resources:
    14
    Spells:
    12
    JASS:
    2
    Resources:
    14
    Yeah well. It is alright. I did say that maybe it is just me after all :)
     
  14. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,476
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    Code (vJASS):

    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.
     
  15. Doomlord

    Doomlord

    Joined:
    Dec 15, 2011
    Messages:
    1,150
    Resources:
    14
    Spells:
    12
    JASS:
    2
    Resources:
    14
    Aha. I was correct =))

    Btw Doc, can you show me how to see the code for the natives and the BJs like that? Thanks in advance :)
     
  16. Imp Midna

    Imp Midna

    Joined:
    May 6, 2013
    Messages:
    125
    Resources:
    0
    Resources:
    0
    Code (vJASS):
    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?
     
  17. Dr Super Good

    Dr Super Good

    Spell Reviewer

    Joined:
    Jan 18, 2005
    Messages:
    25,476
    Resources:
    3
    Maps:
    1
    Spells:
    2
    Resources:
    3
    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.
     
  18. CoLd Bon3

    CoLd Bon3

    Joined:
    Aug 8, 2010
    Messages:
    948
    Resources:
    4
    Spells:
    4
    Resources:
    4
    Thanks, Doc! I am using the other script now and everything is smooth.
    Thanks to all of you! :)
    PROBLEM SOLVED!
     
  19. Zwiebelchen

    Zwiebelchen

    Joined:
    Sep 17, 2009
    Messages:
    6,791
    Resources:
    12
    Models:
    5
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    JASS:
    4
    Resources:
    12
    I think the problem with the script is that "picked unit" retrieves a different value on different machines after this enumeration locally.

    You just need to use "Picked unit" at the wrong place and you will have a desync.