cds1984 10 Posted September 29, 2013 Hi, I had a search through the forums and found quite a few strangely formatted posts from a previous game(OFP) about this and couldn't quite understand so... here is the question. I have a dynamically generated array of strings which are dynamically generated objects. _o = 0; OBJECTS = []; while {_o <= 2} do { _position = randomlygenerated position; _object = nearestObject [_position, "somethingorother"]; missionNamespace setVariable [format ["OBJECT%1",_o],_object]; publicVariable format ["OBJECT%1",_o]; _objects1 = OBJECTS; _objects2 = [format ["OBJECT%1",_o]]; OBJECTS = _objects1 + _objects2; _o = _o + 1; }; now i want to test them and make sure they are present before carrying on, waitUntil {count OBJECTS == 3}; { waitUntil {!isNull _x}; hint format ["%1 is present",_x]; } forEach OBJECTS; at the 'isNull' test i need to have an object and not a string and this is why I want to covert or just remove the quotation marks before I put the value into the array originally... I need to have the object name(variable) instead of a string for a bunch of other functions too. [PURPOSE]; I am trying to remove the manual creation of the arrays so I can alter the mission parameters with ease. I think I'm just missing some fundamental concept... heres hoping! Thanks in advance for any help! Share this post Link to post Share on other sites
squeeze 22 Posted September 29, 2013 (edited) not sure what you are trying to do because you say "dynamically generated objects" while there is no "createVehicle" in your code... see if the below makes any sense. missionNamespace setVariable [format ["OBJECT%1",_o],_object]; publicVariable format ["OBJECT%1",_o]; _objects1 = OBJECTS; _objects2 = [format ["OBJECT%1",_o]]; OBJECTS = _objects1 + _objects2; should be missionNamespace setVariable [format ["OBJECT%1",_o],_object]; OBJECTS = _OBJECTS + [(format ["OBJECT%1",_o])]; waitUntil {!isNull _x}; hint format ["%1 is present",_x]; should be _obj = missionNamespace getVariable _x; //_obj should be the object while _x will be the string hint format ["%1 is present",_x]; Edited September 29, 2013 by Squeeze Share this post Link to post Share on other sites
cds1984 10 Posted September 29, 2013 Hi Squeeze, Perfect! An object produced from a random choice within an array of object classes is dynamically generated in random positions (nearestObject [_randomposition, "house"])within a radius from a marker. (server init script) then, this randomly chooses an object from the array of object classes and pushes an addaction out via bs_fnc_mp to all the clients (ie Gather Intel). To make it happen I add a marker to the map and the amount of intel to be gathered and thats that and run the script at the beginning of that task. Different each time. Very cool. (from my perspective of course.) Thanks again for your help. Share this post Link to post Share on other sites