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!
I haven't tested it out yet, but this is my guess:
The native to select a unit is:
JASS:
native SelectUnit takes unit whichUnit, boolean flag returns nothing
Note that it doesn't have a player field.
JASS:
function SelectUnitAddForPlayer takes unit whichUnit, player whichPlayer returns nothing
if (GetLocalPlayer() == whichPlayer) then
// Use only local code (no net traffic) within this block to avoid desyncs.
call SelectUnit(whichUnit, true)
endif
endfunction
Note that the SelectUnit() is within a GetLocalPlayer() block. That means that IsUnitSelected() will likely return true for one player, but will return false for others. That may cause things to go out of sync. e.g. if you group the units selected, the group will contain different units for each player.
I'm guessing SyncSelections() makes it so that those functions will work properly (IsUnitSelected and GroupEnumUnitsSelected).
That doesn't make sense, by nature, even without any trigger, selections are already local stuff.
EDIT : But meh maybe you're right after all, but then i think it would be better to use a "system" which would use the unit event selected/deselected instead.
I haven't tested it out yet, but this is my guess:
The native to select a unit is:
JASS:
native SelectUnit takes unit whichUnit, boolean flag returns nothing
Note that it doesn't have a player field.
JASS:
function SelectUnitAddForPlayer takes unit whichUnit, player whichPlayer returns nothing
if (GetLocalPlayer() == whichPlayer) then
// Use only local code (no net traffic) within this block to avoid desyncs.
call SelectUnit(whichUnit, true)
endif
endfunction
Note that the SelectUnit() is within a GetLocalPlayer() block. That means that IsUnitSelected() will likely return true for one player, but will return false for others. That may cause things to go out of sync. e.g. if you group the units selected, the group will contain different units for each player.
I'm guessing SyncSelections() makes it so that those functions will work properly (IsUnitSelected and GroupEnumUnitsSelected).
That doesn't make sense, by nature, even without any trigger, selections are already local stuff.
EDIT : But meh maybe you're right after all, but then i think it would be better to use a "system" which would use the unit event selected/deselected instead.
By "system" i mean a code which use the select/deselect events and then have custom functions instead of the native ones (IsUnitSelected, GroupEnumUnitsSelected).
Because if what PurgeandFire said is true, then SyncSelections would work like a wait.
Now it's just a theory, and a such code wouldn't be hard to make.
By "system" i mean a code which use the select/deselect events and then have custom functions instead of the native ones (IsUnitSelected, GroupEnumUnitsSelected).
Because if what PurgeandFire said is true, then SyncSelections would work like a wait.
Now it's just a theory, and a such code wouldn't be hard to make.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.