Jump to content

Recommended Posts

I'm having an issue with BIS_fnc_findSafePos.

findSafePos only returns two values, for the x and y axes, and I'm trying to use createSimpleObject with it which requires all 3 axes. The error code reads "2 elements provided, 3 expected."

Here's what I have down:

_pos = [obj1, 1, 100, 1, 1,0.25, 0] call BIS_fnc_findSafePos;
createSimpleObject ["Land_HelipadEmpty_F", _pos, false];

Everything in it works fine except that _pos is only x and y. I've subbed in "_pos = [0,0,0]" and it works just fine.

 

I just need to learn how to add the z axis to _pos. Can someone please help me?

Thank you in advance.

Share this post


Link to post
Share on other sites

You can either modify _pos to add the 0 value for the z axis at the end using pushBack :

_pos = [obj1, 1, 100, 1, 1,0.25, 0] call BIS_fnc_findSafePos;
_pos pushBack 0;
createSimpleObject ["Land_HelipadEmpty_F", _pos, false];

or keep the _pos array unchanged and perform the modifications in a copy using + syntax (see example 3)

 

createSimpleObject ["Land_HelipadEmpty_F", _pos + [ 0 ], false];

Alternatively, you can use select to extract the components to create a new array :

 

createSimpleObject ["Land_HelipadEmpty_F", [ _pos select 0, _pos select 1, 0 ], false];

 

Share this post


Link to post
Share on other sites
On 3/16/2024 at 11:41 PM, cidfr said:

You can either modify _pos to add the 0 value for the z axis at the end using pushBack :


_pos = [obj1, 1, 100, 1, 1,0.25, 0] call BIS_fnc_findSafePos;
_pos pushBack 0;
createSimpleObject ["Land_HelipadEmpty_F", _pos, false];

or keep the _pos array unchanged and perform the modifications in a copy using + syntax (see example 3)

 


createSimpleObject ["Land_HelipadEmpty_F", _pos + [ 0 ], false];

Alternatively, you can use select to extract the components to create a new array :

 


createSimpleObject ["Land_HelipadEmpty_F", [ _pos select 0, _pos select 1, 0 ], false];

 

 

YES! Thank you! I knew it had to be something simple like that. I tried your first two methods and they both worked perfectly!

 

Thank you again, cidfr!

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

×