HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Trigger synching.

12-18-2010, 04:19 AM#1
rogueteddybear
I was wondering about the consequences of not registering a trigger for all players, and instead registering it only for the GetLocalPlayer().

For example say I have this:
Hidden information:
Collapse JASS:
local trigger trg_LearnAbility = CreateTrigger(  )


    
call TriggerAddAction( trg_LearnAbility, function LearnAbility )
call TriggerAddCondition( trg_LearnAbility, function LearnAbilityCondition )
call TriggerRegisterPlayerUnitEvent(trg_LearnAbility, GetLocalPlayer(),  EVENT_PLAYER_UNIT_USE_ITEM, null)


The point of this would be to allow player to learn spells from books. So when the local player uses a spell book, he gets that spell.

So just using this, would there be synching issues as opposed to if I looped through player id's and registered the trigger for all of them?
12-18-2010, 05:14 AM#2
Ammorth
I would say yes, as each player will only execute the trigger (add the spell to a unit) when it is their unit. Therefore you would have some players think it doesn't have a spell, while the owning player does; desync.
12-18-2010, 10:27 AM#3
Anitarf
There are even more basic issues here: trigger events are handles so creating them for only one player would probably cause a game desync on its own. Furthermore, as Ammorth pointed out, game-affecting stuff like adding abilities to units will always cause a desync when only done for a local player instead of for every player in the game.
12-18-2010, 04:41 PM#4
Ammorth
Quote:
Originally Posted by Anitarf
There are even more basic issues here: trigger events are handles so creating them for only one player would probably cause a game desync on its own.

However, creating one handle locally for every player will keep the handle stack the same. Therefore it won't necessarily desync right away (due to the handle stack and your next handle creation) but via the actions of the trigger.