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

[vJASS] Syncing Data

Status
Not open for further replies.
I just want to check if I'm doing this right. I want to store real values in local code and then sync it to all players:

JASS:
        if p = GetLocalPlayer() then
            // do stuff
            call StoreReal(gcSM, k, I2S(GetPlayerId(p)), value)
            call SyncStoredReal(gcSM, k, I2S(GetPlayerId(p)))
            // do more stuff
        endif

Is it really this simple?
edit: seems to be working in a quick lan test

edit: can data from any player be synced at any time from anywhere? or does it need to be synced within the respective player's local code?

i.e. can I do something like this?
JASS:
function storestuff takes player p, real value returns nothing
        if p = GetLocalPlayer() then
            call StoreReal(gcSM, k, I2S(GetPlayerId(p)), value)
        endif
endfunction

function loadstuff takes player p returns real
        call SyncStoredReal(gcSM, k, I2S(GetPlayerId(p)))
        return GetStoredReal(gcSM, k, I2S(GetPlayerId(p)))
endfunction

joining lan games for my test map is constantly failing so it's hard for me to test this :(
 
Last edited:
Status
Not open for further replies.
Top