Jump to content
twakkie

enableSimulationGlobal for Array of Item Types

Recommended Posts

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

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.

  • Like 1

Share this post


Link to post
Share on other sites

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

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;
  • Like 1

Share this post


Link to post
Share on other sites

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

  • Like 1

Share this post


Link to post
Share on other sites

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

You spelt entities wrong :)

 

 LOL! Thanks. Shows what happens when you copy paste :)

  • Like 1

Share this post


Link to post
Share on other sites

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×