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

[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