Hank Hill 0 Posted September 2, 2014 I am trying to figure out if there is a way to retrieve all variables attached to unit. This is so I can save them and reapply them using the setVariable command with iniDBI. The trouble i'm having is that getVariable requires you to know specifically the variable you are querying. I am interesting in setting up a script that is capable of determining all variables attached to a given unit from a list of units (such as allmissionobjects). If anyone can assist I would be very grateful! Share this post Link to post Share on other sites
Larrow 2818 Posted September 2, 2014 Not possible im affraid. As you have said you need to know what the variable name is. I have asked for this functionality several times as it would make debugging and tracing BIS functionality so much easier, not just an object KV pairs but also namespace KV would be awesome. Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted September 2, 2014 (edited) You can build a workaround by storing all variable names you add to the object in an array. You add this array as a variable to every object you create and you should ALWAYS give it the same name on every object, you add it to, like "allVariables". Now, whenever you add a variable to an object, call "allVariables", add the variable name to the array and set the updated "allVariables" again. But it still needs discipline, because you must not forget to add that "allVariables" to every unit/object you are adding variables to. You may even want to setup a custom "myCreateVehicle" function which calls the actual "createVehicle" and does the job concering "allVariables". That way, you can get every variable by getting the "allVariables" and then iterating through them using a forEach loop: _allVariables = player getVariable "allVariables"; { _variable = player getVariable _x; //do whatever you want here } forEach _allVariables; Regards, Johnny Edited September 2, 2014 by waltenberg Share this post Link to post Share on other sites
Hank Hill 0 Posted September 2, 2014 Thanks waltenberg, thats a good idea. Share this post Link to post Share on other sites
Heeeere's johnny! 51 Posted September 2, 2014 You're welcome. ^_^ Share this post Link to post Share on other sites
Guest Posted June 17, 2016 https://community.bistudio.com/wiki/allVariables This command (allVariables) can now get all the variables of many "things", including an object (a unit, a vehicle). Share this post Link to post Share on other sites