void SyncVariable(int tid, num value)
Synchronizes an arbitrary numeric variable from server to all clients using an unused tid. The synchronized value can be read clientside using GetSyncVar and GetSyncVarDefault.
SyncVariable optimizes network traffic to only send packets if the synchronized variable is different.
This function works by spawning an undetectable indestructible actor the first time it's called and using its Speed property to synchronize the value.
This function is intended to be used every tic in a single serverside OPEN script:
script "SyncVariables" OPEN { SyncVariable(TID_LIVESCOUNT, Lives); SyncVariable(TID_LIVINGMONSTERCOUNT, LivingMonsterCount()); SyncVariable(TID_LIFEGAIN, GainedLives); Delay(1); restart; }
This makes property synchronization immediate and efficient (no net traffic when no property changes happen).