Jump to content
Sign in to follow this  
1para{god-father}

Stop spawn into water ?

Recommended Posts

I am using the below to spawn in a random position from a marker but how can i stop it spawning into Water , as sometimes it spawns into water :(


_marker = _this select 0;  // marker name
_radius = _this select 1;   //5K
_pos = getmarkerpos _marker;
_exp = "(1 + meadow) * (1 - forest) * (1 - trees)";
_prec = 100;
_bestplace = selectBestPlaces [_pos,_radius,_exp,_prec,1];
_spot = _bestplace select 0;
_spot2 = _spot select 0;

Share this post


Link to post
Share on other sites
I am using the below to spawn in a random position from a marker but how can i stop it spawning into Water , as sometimes it spawns into water :(

Just keep trying to guess into land is found.

_marker = _this select 0;  // marker name
_radius = _this select 1;   //5K
_pos = getmarkerpos _marker;

_foundPos = false;
_spot2 = [0,0,0];
while (not _foundPos) do {
  _exp = "(1 + meadow) * (1 - forest) * (1 - trees)";
  _prec = 100;
  _bestplace = selectBestPlaces [_pos,_radius,_exp,_prec,1];
  _spot = _bestplace select 0;
  _spot2 = _spot select 0;
  if (not surfaceIsWater _spot2) then {_foundPos = true;};
};
//Result in spot2

Share this post


Link to post
Share on other sites

And/or probably you can try to add "sea" to expression, eg:

_exp = "(1 + meadow) * (1 - forest) * (1 - trees) - (10 * sea)";

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  

×