Jump to content
gc8

findEmptyPosition buggy

Recommended Posts

has anyone else noticed that findEmptyPosition command sometimes returns positions inside another object, like wall for example? This makes the spawned vehicle in the returned pos to fly or explode.

maybe BIS could fix this :) ?

 

Share this post


Link to post
Share on other sites

ok I have this issue with non-apex arma.

Share this post


Link to post
Share on other sites

Good luck for a fix! BI doesn't seem to change anything in the jungle of classes.

 

Some other abnormal behaviors:

- nearestBuilding never takes into account the edited houses;

- nearObjects (and similar commands) are returning some walls or even all runway lights as "house". That makes a lot of unwanted weird houses, with no building position, in game....

Share this post


Link to post
Share on other sites

yeah, I had cover finding script in arma 2 but it doesnt work in arma 3 because the the objects returned by nearestObjects are so weird..... even when I had nearestObjects [_pp, ["Building"], _searchRadious ]; it returned objects that are not buildings...

 

in arma2 it worked perfectly in takistan towns.

Share this post


Link to post
Share on other sites

Still have this same problem that when I create vehicles on the position returned by findEmptyPosition they sometimes explode. Is BIS not going to fix this? Or am I doing something wrong, hmmm?

 

This is the code what I use:

 

_foundPos = _scenter findEmptyPosition [0, 75, _vehicleType];

 

Share this post


Link to post
Share on other sites

I totally have this problem. I have a custom ambient AI suite that I wrote, but I can't find a way to stop cars from intermittently exploding! Sometimes I find them inside a house even though they should be outside. I've tried ensuring they will keep a safe distance from all buildings, and they still find something to blow up on. I don't think you're wrong.

Share this post


Link to post
Share on other sites

- start with isFlatEmpty, far more convenient,
- then add your findEmptyPosition (why not?) but let some room for your object (you can use any by tank class instead of a quad if you want!)

- as many mods are made with poor buildings (no door, no position), and Tanoa is also a pity for that!, you can add some check to avoid a roof above the position:

 

( call {lineIntersectsSurfaces [getPosWorld player, getPosWorld myObject vectorAdd [0, 0, 50], myObject, objNull, true, 1, "GEOM", "NONE"] select 0 params ["","","","_house"]; _house isKindOf "House"} ); // returns true or false

 

Probably too much and CPU expensive...

Share this post


Link to post
Share on other sites

I'm now using BIS_fnc_findSafePos. It is using the isFlatEmpty with some additional checks to make sure the position is not inside of building. Getting much better results with this than findEmptyPosition but there's still explosions sometimes.

Share this post


Link to post
Share on other sites

I use this, it is to create a random center point for an occupied area, but it works well.

 

_gamelogic = CENTER;
_towns = nearestLocations [getPosATL _gamelogic, ["NameVillage","NameCity","NameCityCapital"], 25000]; 
_RandomTownPosition = position (_towns select (floor (random (count _towns))));

_m = createMarker [format ["mrk%1",random 100000],_RandomTownPosition];
_m setMarkerShape "ELLIPSE";
_m setMarkerSize [900,900];
_m setMarkerBrush "BDiagonal";
_m setMarkerAlpha 0.5;
_m setMarkerColor "ColorEAST";

_pos = getMarkerPos _m;

_randPos = [_pos , 0, 600, 12, 0, 0.3, 0] call BIS_fnc_findSafePos;

This code works very well to find an empty pos for a radio tower or a vehicle. Just place a gamelogic named CENTER and then run this code to find a position. Give this a go.

Share this post


Link to post
Share on other sites

Thanks for the code jakeplissken. I tried with BIS_fnc_findSafePos in malden airport and i spawned 50 vehicles to test it and one vehicle exploded when it was placed between two hangars. So pretty good result but not perfect.

 

This is the code I used, it first looks for space within 150 meters and then raises the search area if no place is found:

_loc = [];

_args = [_ppos, 0, 150, 12, 0, 0.5, 0];
for "_s" from 0 to 2 do
{
_args set[2, (_args select 2) + (_s * 200)];
_foundPos = _args call BIS_fnc_findSafePos;
if(count _foundPos > 0) exitwith
{
 _loc = _foundPos;
};
};

 

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

×