Jump to content
Sign in to follow this  
nullsys

BIS_fnc_findSafePos is driving me insane, please help!

Recommended Posts

Expected:

To find a location, between 2000 & 5000 meters, relatively flat, on land and with 1 meter of space around it.

Create a device, place the device and the player in that location for testing purposes.

Reality:

This works 100% of the time via Debug and "Local Exec" while in game.

This works maybe 3/4 times through SQF.

All tested locally through the editor.

sndObjects = ["Land_Device_disassembled_F","Land_Device_assembled_F"];
sndObject = sndObjects call BIS_fnc_selectRandom;
_pos = [getpos player,2000,5000,1,0,0.7,0,[],[(getpos player),(getpos player)]] call BIS_fnc_findSafePos;
hint str _pos;
sndChecker = sndObject createVehicle _pos;
player setpos _pos;

Can someone please explain why this works every time through the debug scripting, but not every time in SQF scripts?

Share this post


Link to post
Share on other sites

What is "wrong" the 1/4 of the time it doesn't work?

Share this post


Link to post
Share on other sites
What is "wrong" the 1/4 of the time it doesn't work?

Sorry, I forgot to mention.

Absolutely nothing happens with _pos. Nothing is returned from the function BIS_fnc_findSafePos.

It's almost like it doesn't find a "safe place" and that's the end of it.

Yet, I have tested this by placing the player in the desert to the east, making sure the distance is short, and it will absolutely return a new position while using the debug option in "preview".

As soon as I go back to trying it through a SQF, nothing is returned roughly 1/4 of the time.

Share this post


Link to post
Share on other sites

How are you executing the script (via trigger, etc.)? And make sure to have -showScriptErrors enabled on your Steam startup parameters to make sure it doesn't error out 1/4 of the time.

Share this post


Link to post
Share on other sites

BIS_fnc_findSafePos won't always find safe positions and sometimes choose some weird predefined positions from the maps config, most of them seem to be mid-air.

Why not just use isFlatEmpty instead?

Share this post


Link to post
Share on other sites
BIS_fnc_findSafePos won't always find safe positions and sometimes choose some weird predefined positions from the maps config, most of them seem to be mid-air.

Why not just use isFlatEmpty instead?

Thank you!

Giving it a test now, and looking at the scripting for them from the configs. Nice to know it's not just me being mad.

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
Sign in to follow this  

×