Jump to content

Recommended Posts

Could somebody help on how to spawn something near these bushes using NearestTerrainObjects and not spawning twice on same pos.

_allBushes = nearestTerrainObjects [player, [Bush], 250, false];

for "_i" from 1 to 5 do

_pos = selectRandom _allBushes

_grp = createGroup east;

_unit = _grp createUnit ["C_man_p_beggar_F", [0,0,0], [], 0, "FORM"];

_unit setPos _pos;

};

 

Share this post


Link to post
Share on other sites

There you go

_allBushes = nearestTerrainObjects [player, [Bush], 250, false];

for "_i" from 1 to 5 do
{
if(count _allBushes == 0) exitWith {};

// Get random bush and delete it from list
_index = floor random (count _allBushes);
_pos = getpos (_allBushes # _index);
_allBushes deleteAt _index;

_grp = createGroup east;

_unit = _grp createUnit ["C_man_p_beggar_F", [0,0,0], [], 0, "FORM"];

_unit setPos _pos;

};
  • Like 1

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

×