wowanno 1 Posted August 13, 2013 (edited) I have a file which executes on clients only via init.sqf using if(!isDedicated) then {execVM "clienttest.sqf";}. In this file, I run the following: player setVariable["myTestVar", 1, true]; (I tried using false here as well, just to see what happens). On startup, server executes a file called servertest.sqf. In this file, the following loop is executed: { ... _x setVariable["myTestVar2", 1, true]; ... }foreach playableUnits; Server also executes one more file, this time using the following: if(isPlayer (_x)) then ... ... _result= _x getVariable "myTestVar"; _result2= _x getVariable "myTestVar2"; Question: This works sometimes. Sometimes nothing is loaded, sometimes everything is loaded, sometimes only 1 variable is loaded. Why? What I want to do here is assign variables to player objects via setVariable. Later on, I want to access these variables from the server by calling getVariable (hardcoded names) on every client. Further, I want the server to be able to overwrite these variables (again, names hardcoded) via setVariable. Is such thing possible? If so, what is the proper way to go about it? Edited August 13, 2013 by wowanno formatting Share this post Link to post Share on other sites
xxanimusxx 2 Posted August 13, 2013 If one of your scripts is dependant on a set variable to any object, you should check if the variable was set already as it could take some time until the variable value is synchronized with every client. Using a default value and waitUntil, you can cook together something like this: _myObject setVariable ["myVariable", 10, true]; waitUntil {_myObject getVariable ["myVariable", -1] != -1}; _value = _myObject getVariable "myVariable"; Share this post Link to post Share on other sites
wowanno 1 Posted August 14, 2013 Thank you for your reply XxAnimusxX. This seems like a good idea. Cheers! Share this post Link to post Share on other sites