blasturbator 10 Posted April 14, 2014 (edited) would this work to make 8 things that have numbered names i.e. name1, name2, name3, etc and have a public variable for each also named name1, name2, name3, etc? for "_i" from 0 to 8 step 1 do { call compile format ["_name = 'name%1'", _i]; obj createVehicle [the createVehicle stuff]; obj setVehicleVarName _name; obj call compile format ["%1=_This ; PublicVariable '%1'",_name]; }; Also is there any way to retrieve the name of a unit? like getVehicleVarName or some magic. edit: found the answer to second question, still wondering if first would work. Edited April 14, 2014 by Blasturbator Share this post Link to post Share on other sites
Johnson11B2P 3 Posted April 15, 2014 Use publicVariable command for your first question. Share this post Link to post Share on other sites
blasturbator 10 Posted April 15, 2014 That... doesn't quite answer my question or show that you even read the script snippet. Share this post Link to post Share on other sites
brians200 51 Posted April 15, 2014 I think you are taking the hard way for "_i" from 1 to 8 step 1 do { call compile format["name%1 = 'classname' createvehicle stuff; publicVariable 'name%1';", _i]; }; Check for syntax errors, as I didn't get a chance to run it. Share this post Link to post Share on other sites
blasturbator 10 Posted April 15, 2014 Yeah i got this working hours ago, but thanks for replying. The hard way was necessary because i also needed to give the vehicle a varName for use as string storage so i could delete and recreate it in a function with the same name and public variable by calling on the varName to define both. Was a pain to get going but it works now :) Share this post Link to post Share on other sites
Larrow 2823 Posted April 15, 2014 This is an alternative option without having to call compile stuff for "_i" from 0 to 8 step 1 do { _name = format["name%1", _i]; _obj createVehicle [the createVehicle stuff]; _obj setVehicleVarName _name; missionNamespace setVariable [_name, _obj, true]; }; The true in setVariable broadcasts the value without having to use PublicVariable. Share this post Link to post Share on other sites