da-ben 10 Posted May 10, 2014 I encountered a problem since 1.18 that public Variables set via player setVariable["NAME",DATA,true]; not syncing anymore for JIP players. Use this multiple times in my mission and before 1.18 never had a problem. In short setVariable for JIP players is <null> for all others its right. Share this post Link to post Share on other sites
YeY 0 Posted November 22, 2015 Sorry for pushing this old thread, but anyone got a fix for this? I am trying to setVariable foreach player on server and then read it from client, but the variable is never synced to the client. Server: { _x setVariable["myTestVar",1.0,true]; _x setVariable["myTestVar2",1.0,true]; }forEach playableUnits; Client: waitUntil{!isNil (player getVariable "myTestVar")}; diag_log("myTestVar success"); waitUntil{!isNil (player getVariable "myTestVar2")}; diag_log("myTestVar2 success"); Share this post Link to post Share on other sites
barbolani 198 Posted November 22, 2015 hi! It just seems you setVariable an object which is not the player object itself. Even when you made it for playableUnits. Try to make the check to any other object already existing before the player joined. Should work, with the latest value you added. Share this post Link to post Share on other sites
mrcurry 508 Posted November 22, 2015 Sorry for pushing this old thread, but anyone got a fix for this? I am trying to setVariable foreach player on server and then read it from client, but the variable is never synced to the client. Server: { _x setVariable["myTestVar",1.0,true]; _x setVariable["myTestVar2",1.0,true]; }forEach playableUnits; Client: waitUntil{!isNil (player getVariable "myTestVar")}; diag_log("myTestVar success"); waitUntil{!isNil (player getVariable "myTestVar2")}; diag_log("myTestVar2 success"); I see 2 things that could be the cause of the issue. 1. Depending when you execute the server code, players which haven't fully loaded yet are not included in the playableUnits array. I believe it would work if you have AI enabled for the playable slots, but otherwise the player object is created when a player connects in that slot. If that happens after you execute the server code it would not save the data because the object isn't there. As barbolani suggested, if possible use something like a gamelogic placed in editor and use that to broadcast the value to other clients. That should, if I'm not mistaken, cut down on network traffic as well. 2. isNil requires either a string or code. I wouldn't be surprised your non-JIP clients printing tons of errors in the log. Use: waitUntil{ !isNil {player getVariable "myTestVar"} }; //{} instead of () 1 Share this post Link to post Share on other sites
YeY 0 Posted November 22, 2015 2. isNil requires either a string or code. I wouldn't be surprised your non-JIP clients printing tons of errors in the log. Use: waitUntil{ !isNil {player getVariable "myTestVar"} }; //{} instead of () This solved my issue, Thank You so much. :) Share this post Link to post Share on other sites
killzone_kid 1332 Posted November 22, 2015 using -showScriptErrors would have solved it for you in no time Share this post Link to post Share on other sites