Jump to content
MitchJC

Help working with ObjectsMapper Compositions

Recommended Posts

 

Hi all,

 

I was hoping someone would be able to help with the following. I've created a composition which is spawned using ObjectsMapper. I want to be able to disable damage and enable dynamic simulation on each of the items in the composition. Additionally I want a way of deleting the composition on objective completion. The problem I'm having is getting the building from the array. 

_HQComp =
[
	["Land_Cargo_HQ_V3_F",[0,0,0],89.937,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[8.04028,-1.2489,0],89.872,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[7.69019,7.33813,0],89.872,1,0,[0,0],"","",true,false], 
	["Land_PortableLight_double_F",[11.2708,5.54102,0],313.275,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[8.07739,-9.8667,0],90.1586,1,0,[0,-0],"","",true,false], 
	["MetalBarrel_burning_F",[-1.35107,13.1682,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[2.74634,-13.2556,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-5.88013,-13.412,0],0,1,0,[0,0],"","",true,false], 
	["B_supplyCrate_F",[-14.9216,-0.610474,0],88.5408,1,0,[0,0],"","",true,false], 
	["Box_NATO_WpsLaunch_F",[-14.9614,3.56836,0],91.5848,1,0,[0,-0],"","",true,false], 
	["Land_Cargo_House_V3_F",[-13.1018,10.2432,0],270.412,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[10.7866,12.7167,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[14.2078,9.14673,0],269.947,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-17.5911,0.522949,0],89.8719,1,0,[0,0],"","",true,false], 
	["Land_CncBarrier_stripes_F",[16.7244,5.35376,0],0,1,0,[0,0],"","",true,false], 
	["Land_Cargo_Patrol_V3_F",[-12.9534,-12.9851,0],358.398,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-12.0073,14.6807,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-17.4727,-7.99268,0],90.1586,1,0,[0,-0],"","",true,false], 
	["Land_Cargo_Patrol_V3_F",[12.1367,13.3417,0],358.398,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-14.3176,-13.4429,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-17.8599,9.36365,0],89.8719,1,0,[0,0],"","",true,false], 
	["Land_CncBarrier_stripes_F",[16.4963,13.2567,0],0,1,0,[0,0],"","",true,false], 
	["Land_CncBarrier_stripes_F",[20.6875,9.172,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[2.70532,23.7155,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-5.86133,23.599,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-17.7747,17.9559,0],89.8719,1,0,[0,0],"","",true,false], 
	["Land_Cargo_Patrol_V3_F",[-17.2051,18.9408,0],88.6308,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[23.6223,10.1174,0],269.947,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[11.2742,23.9015,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-14.479,23.327,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[23.3862,18.7457,0],270.049,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[19.97,24.0022,0],0,1,0,[0,0],"","",true,false]
];


0 = [(_ObjPos), random 360, _HQComp] call BIS_fnc_ObjectsMapper;
{
_x enable damage false;
_x enableDynamicSimulation true;    
} ForEach _HQComp;

 

 {deletevehicle _x;} ForEach _HQComp;

 

 The question is how do I return each object from each string to get this to work? The above doesn't work as it's a string and not an object.

 

Thanks in advance.

 

Mitch

Share this post


Link to post
Share on other sites

The order of the created objects is also the same as it is in your input array. E.g. your first input will also be the first return element:

_Obj =
[
	["Land_Cargo_HQ_V3_F",[0,0,0],89.937,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[8.04028,-1.2489,0],89.872,1,0,[0,0],"","",true,false] 
	//...
];

_HQComp = [(_ObjPos), random 360, _Obj] call BIS_fnc_ObjectsMapper;

_Land_Cargo_HQ_V3_F = _HQComp select 0;
_Land_HBarrier_Big_F = _HQComp select 1;
//...

/* or better: */
_HQComp params ["_Land_Cargo_HQ_V3_F","_Land_HBarrier_Big_F",...];

If you want to access any specific building then it would be the best practice to place the input array at the beginning of your array.

Share this post


Link to post
Share on other sites

Morning guys.

 

Thanks for your help.

 

Got it all sorted now. Here's the working script for others to use. You can set variable names on items when you create the compositions to use later, such as setting a building pos.

 

_HQComp =
[
	["Land_Cargo_HQ_V3_F",[0,0,0],89.937,1,0,[0,0],"HQBuilding","",true,false], 
	["Land_HBarrier_Big_F",[8.04028,-1.2489,0],89.872,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[7.69019,7.33813,0],89.872,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[8.07739,-9.8667,0],90.1586,1,0,[0,-0],"","",true,false], 
	["Land_HBarrier_Big_F",[2.74634,-13.2556,0],0,1,0,[0,0],"","",true,false], 
	["MetalBarrel_burning_F",[5.8855,12.8378,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-5.88013,-13.412,0],0,1,0,[0,0],"","",true,false], 
	["B_supplyCrate_F",[-14.9216,-0.610474,0],88.5408,1,0,[0,0],"","",true,false], 
	["Box_NATO_WpsLaunch_F",[-14.9614,3.56836,0],91.5848,1,0,[0,-0],"","",true,false], 
	["Land_PortableLight_double_F",[14.2327,6.06958,1.13405],359.847,1,0,[0,0],"","",true,false], 
	["Land_Cargo_House_V3_F",[-13.1018,10.2432,0],270.412,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[10.7866,12.7167,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[14.2078,9.14673,0],269.947,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-17.6982,0.710938,0],89.8719,1,0,[0,0],"","",true,false], 
	["Land_Cargo_Patrol_V3_F",[-12.9534,-12.9851,0],358.398,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-12.0073,14.6807,0],0,1,0,[0,0],"","",true,false], 
	["Land_CncBarrier_stripes_F",[16.5237,9.4718,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-17.4727,-7.99268,0],90.1586,1,0,[0,-0],"","",true,false], 
	["Land_Cargo_Patrol_V3_F",[12.1367,13.3417,0],358.398,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-14.3176,-13.4429,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-17.8599,9.36365,0],89.8719,1,0,[0,0],"","",true,false], 
	["Land_CncBarrier_stripes_F",[21.0486,6.25598,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[2.70532,23.7155,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-5.86133,23.599,0],0,1,0,[0,0],"","",true,false], 
	["Land_PortableLight_double_F",[23.6045,6.86292,1.19072],0.754643,1,0,[0,0],"","",true,false], 
	["Land_CncBarrier_stripes_F",[20.8206,14.1589,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-17.7747,17.9559,0],89.8719,1,0,[0,0],"","",true,false], 
	["Land_Cargo_Patrol_V3_F",[-17.2051,18.9408,0],88.6308,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[23.6223,10.1174,0],269.947,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[11.2742,23.9015,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[-14.479,23.327,0],0,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[23.3862,18.7457,0],270.049,1,0,[0,0],"","",true,false], 
	["Land_HBarrier_Big_F",[19.97,24.0022,0],0,1,0,[0,0],"","",true,false]
];


_HQItems = [[5836.61,1734.48,0], random 360, _HQComp] call BIS_fnc_ObjectsMapper;

{
_x allowDamage false;
_x enableDynamicSimulation true;  

} Foreach _HQItems;


sleep 10;			// Wait 10 Seconds and then delete the composition. 

{
deletevehicle _x;
sleep 0.1;
} ForEach _HQItems;

 

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

×