Jump to content
BlacKnightBK

What is wrong with my function here??

Recommended Posts

Hello guys,

So I have the following function (Func_fnc_findEmptyPad)that returns an array and it works perfectly as expected:

params [];

private _pads = [pad1, pad2, pad3];
private _empty = [];
{
      private _objs = (getPos _x) nearObjects 5;
      private _clear = true;

      {
          if (_x isKindOf "Land" || _x isKindOf "Man" || _x isKindOf "Air") then {
                _clear = false;
          };
      } forEach _objs;

      if (_clear) then {
            _empty pushBack _x;
      };
} forEach _pads;
_empty

 

And I have an if statement that depends on the function above, however, I get the weirdest error ever:

 

If statement:

private _empty = Func_fnc_findEmptyPad;
if ( (count _empty) > 0) then {....};

Error:

13:48:33   Error position: <count _empty) > 0) then {
private _pos =>
13:48:33   Error count: Type code, expected Array,String,Config entry

How on earth is it giving me this, I cannot even explain the problem because it is just weird.

 

Doesnt my function return the array _empty??

Share this post


Link to post
Share on other sites

the

 

if ( (count _empty) > 0) then {....};

 

doesn't work because _empty is code.

 

it seems that your missing "call" from this line:

 

private _empty = call Func_fnc_findEmptyPad;

 

Share this post


Link to post
Share on other sites

@gc8 Now that totally makes sense lol :D

 

Took me 1 mins restarting my game, my PC, everything I could think of lol

Thanks alot, you a life saver friend

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

×