meatball 25 Posted August 29, 2014 Trying to create an object name by concatenating some text with a number that will increment based on a variable. So something like this: _objectName = "text" + _numVariable; I've tried to create a test object using createvehicle using this. _objectName = "I_UAV_02_F" createvehicle (getmarkerPos "center"); Problem is, I can't use _objectName to createVehicle because _objectName now has quotes around it. I need to be able to watch for that vehicles destruction, so I'm not sure where to go next. Any ideas? Share this post Link to post Share on other sites
sxp2high 23 Posted August 29, 2014 (edited) Not very nice looking, but this should work: call (compile (format['%1 = "I_UAV_02_F" createvehicle (getmarkerPos "center");', _objectName])); Or just: call (compile (format['%1 = %2;', _objectName, _vehicle])); Or: missionNamespace setVariable [_objectName, _vehicle]; missionNamespace Edited August 29, 2014 by sxp2high 2 alternatives :) Share this post Link to post Share on other sites
maddogx 13 Posted August 29, 2014 I'm confused. Aside from the object name issue, I understand that you are creating a vehicle and want to watch for that vehicle's destruction, but how does the name factor into that? For example, why wouldn't the following code work for you: _objectName = "I_UAV_02_F" createvehicle (getmarkerPos "center"); waitUntil {!(alive _objectName)}; (Highly simplified code based on what you said you're trying to do.) Share this post Link to post Share on other sites
lappihuan 178 Posted August 29, 2014 I guess you need the format command E: dubble ninja'd :butbut: Share this post Link to post Share on other sites
meatball 25 Posted August 29, 2014 I'll test some of those, but I don't really have a problem actually creating the object, it's a matter of returning the actual objects name after creation so I can use it in other functions to watch for the destruction of the object. Share this post Link to post Share on other sites
Larrow 2822 Posted August 29, 2014 Something like.... { //Create a vehicle _Veh = createVehicle ["I_UAV_02_F", getMarkerPos "center", [], 0, "None"]; //Create a name _vehName = format[ "UAV_%1", str _x]; //Associate the vehicle with the name _veh setVehicleVarName _vehName; //Associate a global variable of name with the vehicle missionNamespace set [_vehName, _veh]; //transmit global variable to all connect computers publicVariable _vehName; }forEach [1,2,3,4,5]; Would create 5 UAV's called UAV_1 to UAV_5 and also broadcasts the name if you need a reference to it on other machines. Share this post Link to post Share on other sites
fight9 14 Posted August 29, 2014 BIS_fnc_objectVar can also give an object a global variable name from a string. https://community.bistudio.com/wiki/BIS_fnc_objectVar Share this post Link to post Share on other sites