Jump to content
LSValmont

Error with BIS_fnc_findSafePos after a BIS_fnc_randomPos pos.

Recommended Posts

I am getting this error when using BIS_fnc_findSafePos after getting a position from BIS_fnc_randomPos.

 

7401649409c246983c2931e097299d798384c7df

 

This is the script that generates that error:

_FirstPos = [] call BIS_fnc_randomPos;
_Residential_Area = nearestLocations [_FirstPos, ["NameCity","NameCityCapital","NameVillage"], worldSize];
_Residential_Position = position (_Residential_Area select (floor (random (count _Residential_Area))));

_Rdm_Pos =  [[[_Residential_Position, random 1]],["water"]] call BIS_fnc_randomPos;
_Safe_Pos = [_Rdm_Pos, 0, 100, 10, 0, 0.1, 0] call BIS_fnc_findSafePos;

_pos = _Safe_Pos;

_pos

This however works without any errors:

_FirstPos = [] call BIS_fnc_randomPos;
_Residential_Area = nearestLocations [_FirstPos, ["NameCity","NameCityCapital","NameVillage"], worldSize];
_Residential_Position = position (_Residential_Area select (floor (random (count _Residential_Area))));

_Rdm_Pos =  [[[_Residential_Position, random 1]],["water"]] call BIS_fnc_randomPos;

_pos = _Rdm_Pos;

_pos

//this works without errors and gives me a position value just fine

So the error only happens when I take the position generated by _Rnd_Pos (BIS_fnc_randomPos) and use it inside _Safe_Pos (BIS_fnc_findSafePos).

 

Any ideas why this is happening and how to fix it?

 

Thanks!

Share this post


Link to post
Share on other sites
36 minutes ago, killzone_kid said:

Deleted my previous response as I tested both codes and no errors for me.

 

 

Hi Killzone_Kid! 

 

Really? Perhaps if I upload the mission for you to check it? The full script is a little bit longer but I figured those were the relevant parts since removing the _Safe_Pos fixed the error but also the better positioning of the missions. 

Share this post


Link to post
Share on other sites

Your error is probably with passing [x,y] for center instead or [x,y,z] to BIS_fnc_randomPos. Surely you can debug it yourself

  • Like 1

Share this post


Link to post
Share on other sites
18 hours ago, LSValmont said:

_Safe_Pos = [_Rdm_Pos, 0, 100, 10, 0, 0.1, 0] call BIS_fnc_findSafePos;

 

The problem comes from : BIS_fnc_findSafePos

https://community.bistudio.com/wiki/BIS_fnc_findSafePos


 

Spoiler

 

defaultPos (Optional): Array - default position when no position is found (Default: []). Array format is [landPosition, seaPosition], where:

landPosition: Array - in format [x,y] or [x,y,z] - default position on land

seaPosition: Array - in format [x,y] or [x,y,z] - default position on water

Return Value:

Array - in format [x,y] on success. When position cannot be found at all, default map center position is returned, which will be in format [x,y,0]

 

 

so this can change if you add the 0 [x,y,0]

 

_Pos = [(_Pos select 0) , (_Pos select 1) , 0];

 

any better idea ?

 

Basically i have done this error in my GF Missions script and i haven't fixed this because i'm geting another issue then , with EOS script.

  • Thanks 1

Share this post


Link to post
Share on other sites
18 hours ago, LSValmont said:

_pos = _Safe_Pos;

 

in order to check this you can :

systemchat format ["%1",_pos ];
copytoclipboard str _pos ;	// copy paste
  • Thanks 1

Share this post


Link to post
Share on other sites
8 minutes ago, GEORGE FLOROS GR said:

The problem comes from : BIS_fnc_findSafePos


Not really. the error is in BIS_fnc_randomPosTrigger, but BIS_fnc_findSafePos doesn't call BIS_fnc_randomPosTrigger

  • Like 2

Share this post


Link to post
Share on other sites
2 hours ago, killzone_kid said:


Not really. the error is in BIS_fnc_randomPosTrigger, but BIS_fnc_findSafePos doesn't call BIS_fnc_randomPosTrigger

 

If the error is in BIS_fnc_randomPos then why does the error only happens if you have a BIS_fnc_findSafePos using the position generated by BIS_fnc_randomPos? That is so weird... Soon I will be near my PC and will be able to test using George Floros' suggestions. 

Share this post


Link to post
Share on other sites
6 hours ago, LSValmont said:

 

If the error is in BIS_fnc_randomPos then why does the error only happens if you have a BIS_fnc_findSafePos using the position generated by BIS_fnc_randomPos? That is so weird... Soon I will be near my PC and will be able to test using George Floros' suggestions. 

I have no errors so must be something else on your end

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

×