• 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.

Question about SyncStored...X

Status
Not open for further replies.
When you use SyncStoredInteger/Real/Boolean/etc. what exactly is there to be synced?

For example I want to give an integer to each player id, locally, and then sync it.

JASS:
    call StoreInteger(gc, "-", I2S(i), IntegerTertiaryOp(GetLocalPlayer() == Player(i), 1, 0))
    call SyncStoredInteger(gc, "-", I2S(i))
...
call TriggerSyncReady()

Anyone know which value will be synced? Will it be the 1 or the 0? Would it be better if I just only stored an integer for the local player and stored nothing for the others?
 
Level 9
Joined
Apr 26, 2011
Messages
403
StoreInteger() is the function mainly for single player compaign, and :
- if you use them wrong, you will never get replay anywhere (eg, save replay button is disable, auto saved never work)
- it can cause decyns because replay's data on everyone should be same, else it decyns.

The post below can help you understand how SyncStoredInteger work (eg, understand normal condition, if everyone sync their own value, then only host's value is stored )
http://www.wc3jass.com/viewtopic.php?t=2713
 
Level 13
Joined
Sep 13, 2010
Messages
550
JASS:
if GetLocalPlayer( ) == SomePlayer then
    call StoreInteger( sync , SomeId , MoreId , input )
endif
call TriggerSyncStart( )
if GetLocalPlayer( ) == SomePlayer then
    call SyncStoredInteger( sync , SomeId , MoreId )
endif
call TriggerSyncReady( )
//... Get the value, it should be same as others
With this way that value will be synced what the GetLocalPlayer has
 
Status
Not open for further replies.
Top