• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[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