Jump to content
HazJ

Flat position without trees/bushes/etc - Tanoa

Recommended Posts

Hi all,

Okay so. I have multiple different code/functions for finding flat area/position, etc... What I am after now is different. I want to find a random position on the map which is flat. I got this far. The problem is that the trees/bushes/etc sometimes appear. I tried selectBestPlaces command but not having much joy. I think the expression is incorrect. I saw in another thread that someone clears the area by checking if trees/bushes are there using nearestTerrainObjects. I don't really want to do this if possible. Tried isFlatEmpty as well. It is just Tanoa... When it does work. It isn't always consistent. It can works once and then the other 10 tests or so no position is found. Any suggestions?

Share this post


Link to post
Share on other sites

Have you tried BIS_fnc_findSafePos? I don't know if terrain objects are also included in the objDist param.

Share this post


Link to post
Share on other sites

Yeah. I tried that. No luck.

Share this post


Link to post
Share on other sites

You can also place grasscutters all over the place.

For trees/large bushes have you tried to delete them or is that not desired?

 

Cheers

Share this post


Link to post
Share on other sites

Rather not delete them if possible.

Share this post


Link to post
Share on other sites
8 minutes ago, HazJ said:

Rather not delete them if possible.

Well you could also just hide them if that's wanted:

_stuff = nearestTerrainObjects [player, ["HIDE","ROCKS","TREE","BUSH","SMALL TREE"], 20];
{_x hideObjectGlobal true} forEach _stuff;

No idea otherwise, except further tweaking of the selectBestPlaces command, which can be a bit finicky.

 

Cheers

Share this post


Link to post
Share on other sites

What would the expression be for go at open area. No trees, etc around.

Share this post


Link to post
Share on other sites
16 minutes ago, HazJ said:

What would the expression be for go at open area. No trees, etc around.

Something like this:

 

{deletemarker _x} foreach allMapMarkers;

_centerPos = getArray (configfile >> "CfgWorlds" >> worldName >> "centerPosition");

_allMeadows = selectBestPlaces [_centerPos,(worldSize / 2) * 1.4142,"(1 - forest) * (1 - hills) * (1 - sea) * (1 - trees) * (1 + meadow) * (1 - houses)",50,100];
_allMeadows = _allMeadows apply {_x#0};
{

	_marker = createmarker [str _x, _x];
	_marker setmarkertype "mil_flag";
	_marker setmarkercolor "ColorRed";
	_marker setmarkertext format ["Flat %1",_forEachIndex];

} forEach _allMeadows;

Additionally you could check for nearTerrainObjects as shown above.

 

Cheers

  • Like 4

Share this post


Link to post
Share on other sites

Thanks Grumpy. Will try that out later tonight when I get home.

  • Like 1

Share this post


Link to post
Share on other sites

Works great @Grumpy Old Man! Thank you. There is rare chance it will get a position near rocky area or on a slope, etc but gives me something to improve! :grinning:

Thanks again!

  • Like 1

Share this post


Link to post
Share on other sites

@Grumpy Old Man Is there a possibility to find flat terrains using BIS_fnc_randomPos, not BIS_fnc_findSafePos, because I want to find flat place in a forest and clear it from trees (for some forest camps :))?

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

×