• 🏆 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!

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 8
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