twakkie 57 Posted February 22, 2016 Good day We are trying to create a array of items which enable or disable simulation for the specific item type across the map. We have tried the following but keep on getting an error: _campArray = [ "Land_CampingTable_small_F", "Land_CampingTable_F", "Land_CampingChair_V1_F", "Land_CampingChair_V1_folded_F", "Land_CampingChair_V2_F"]; {_x enableSimulationGlobal false; _x allowDamage false} foreach _campArray; I suspect we are defining the object wrong. Since the error we get is in the lines of enableSimulationGlobal requires object not string. How would you then call up the objects? Any help would be appreciated. Regards C Share this post Link to post Share on other sites
nikiller 18 Posted February 22, 2016 hi, Execute a script for each object. _campArray = ["Land_CampingTable_small_F", "Land_CampingTable_F", "Land_CampingChair_V1_F", "Land_CampingChair_V1_folded_F", "Land_CampingChair_V2_F"]; {[_x] execVM "myscript.sqf"} forEach _campArray; myscript.sqf _object = _this select 0; _object enableSimulationGlobal false; _object allowDamage false; cya. Nikiller. 1 Share this post Link to post Share on other sites
twakkie 57 Posted February 22, 2016 hi, Execute a script for each object. _campArray = ["Land_CampingTable_small_F", "Land_CampingTable_F", "Land_CampingChair_V1_F", "Land_CampingChair_V1_folded_F", "Land_CampingChair_V2_F"]; {[_x] execVM "myscript.sqf"} forEach _campArray; myscript.sqf _object = _this select 0; _object enableSimulationGlobal false; _object allowDamage false; cya. Nikiller. Thanks will try tonight. Share this post Link to post Share on other sites
Lala14 135 Posted February 22, 2016 Those both will not work, why make a script file when the code is less than 5 lines??? Instead what needs to be done is a search in all items (or in this case use vehicles) (or as well entities or allMissionObjects) to find the objects e.g. _campArray = [ "Land_CampingTable_small_F", "Land_CampingTable_F", "Land_CampingChair_V1_F", "Land_CampingChair_V1_folded_F", "Land_CampingChair_V2_F"]; {if (typeOf _x in _campArray) then { _x enableSimulationGlobal false; _x allowDamage false; };} forEach vehicles; _campArray = [ "Land_CampingTable_small_F", "Land_CampingTable_F", "Land_CampingChair_V1_F", "Land_CampingChair_V1_folded_F", "Land_CampingChair_V2_F"]; { { _x enableSimulationGlobal false; _x allowDamage false; }forEach (enitites _x)} forEach _campArray; 1 Share this post Link to post Share on other sites
twakkie 57 Posted February 22, 2016 Those both will not work, why make a script file when the code is less than 5 lines??? Instead what needs to be done is a search in all items (or in this case use vehicles) (or as well entities or allMissionObjects) to find the objects e.g. _campArray = [ "Land_CampingTable_small_F", "Land_CampingTable_F", "Land_CampingChair_V1_F", "Land_CampingChair_V1_folded_F", "Land_CampingChair_V2_F"]; {if (typeOf _x in _campArray) then { _x enableSimulationGlobal false; _x allowDamage false; };} forEach vehicles; _campArray = [ "Land_CampingTable_small_F", "Land_CampingTable_F", "Land_CampingChair_V1_F", "Land_CampingChair_V1_folded_F", "Land_CampingChair_V2_F"]; { { _x enableSimulationGlobal false; _x allowDamage false; }forEach (enitites _x)} forEach _campArray; Brilliant! Thanks 1 Share this post Link to post Share on other sites
twakkie 57 Posted February 22, 2016 Those both will not work, why make a script file when the code is less than 5 lines??? Instead what needs to be done is a search in all items (or in this case use vehicles) (or as well entities or allMissionObjects) to find the objects e.g. _campArray = [ "Land_CampingTable_small_F", "Land_CampingTable_F", "Land_CampingChair_V1_F", "Land_CampingChair_V1_folded_F", "Land_CampingChair_V2_F"]; {if (typeOf _x in _campArray) then { _x enableSimulationGlobal false; _x allowDamage false; };} forEach vehicles; _campArray = [ "Land_CampingTable_small_F", "Land_CampingTable_F", "Land_CampingChair_V1_F", "Land_CampingChair_V1_folded_F", "Land_CampingChair_V2_F"]; { { _x enableSimulationGlobal false; _x allowDamage false; }forEach (enitites _x)} forEach _campArray; Se we just tried this: { { _x enableSimulationGlobal false; _x allowDamage false; }forEach (enitites _x)} forEach _campArray; But got the following rpt log errors: 10:33:25 Error in expression <x allowDamage false; }forEach (enitites _x)} forEach _campArray; {{ _x enableS> 10:33:25 Error position: <_x)} forEach _campArray; {{ _x enableS> 10:33:25 Error Missing ) Share this post Link to post Share on other sites
beno_83au 1362 Posted February 22, 2016 You spelt entities wrong :) 1 Share this post Link to post Share on other sites
twakkie 57 Posted February 22, 2016 You spelt entities wrong :) LOL! Thanks. Shows what happens when you copy paste :) 1 Share this post Link to post Share on other sites
Lala14 135 Posted February 22, 2016 sorry my fault there, was in a bit of a rush ;) 1 Share this post Link to post Share on other sites
twakkie 57 Posted February 24, 2016 sorry my fault there, was in a bit of a rush ;) No worries. Your script solved all our problems! Thank man! Share this post Link to post Share on other sites