BlackbirdSD 15 Posted November 29, 2020 For me the most useful thing for making my missions is to have the ability to place units randomly within a rectangle instead of just a circle. Is there a way to lay down a trigger, shaped how I want then have a unit randomly start within that trigger shape? Share this post Link to post Share on other sites
pierremgi 4737 Posted November 29, 2020 Yes. As you know, most of the commands/functions for placing/spawning/moving something in an area, refers to the radius. For example, Bis_fnc_findSafePos findEmpyPosition but also selectBestPlaces , waypoints completion radius... With a rectangle, no more radius question. You can compare x,y coordinates... but that means a North oriented rectangle. So, what I do, is to manage a randomized position inside a usual circled area (larger than rectangle), with a looped condition exiting for this position inside the rectangle. something like: private _pos = [0,0,0]; While {! (_pos inArea _myRectangle)} do { _pos = _centerOfArea getPos [_circleRadius * sqrt random 1, random 360]; _pos}; Share this post Link to post Share on other sites
M1ke_SK 230 Posted November 30, 2020 https://community.bistudio.com/wiki/BIS_fnc_randomPos Check the example for a whitelisted array with - [center, [a, b, angle, rect]] example: _rectangle = true; _radnomRectanglePos = [[[_position, [_xAxis, _yAxis, _rotation, _rectangle]]], _blacklist] call BIS_fnc_randomPos; 1 Share this post Link to post Share on other sites
Larrow 2794 Posted November 30, 2020 17 hours ago, BlackbirdSD said: Is there a way to lay down a trigger, shaped how I want then have a unit randomly start within that trigger shape? BIS_fnc_randomPosTrigger Unit init... if ( isServer ) then { this setPos ( [ myTrigger ] call BIS_fnc_randomPosTrigger ); }; Where myTrigger is the name given to your trigger 1 Share this post Link to post Share on other sites
BlackbirdSD 15 Posted November 30, 2020 2 hours ago, Larrow said: BIS_fnc_randomPosTrigger Unit init... if ( isServer ) then { this setPos ( [ myTrigger ] call BIS_fnc_randomPosTrigger ); }; Where myTrigger is the name given to your trigger Perfect thanks. I hope if they make an Arma 4 they will just include a placement rectangle to make it easier. Share this post Link to post Share on other sites
pierremgi 4737 Posted November 30, 2020 Yes, BIS_fnc_randomPosTrigger is not too bad, and definitely better than whitelisting in BIS_fnc_randomPos. Now, for performance, may I suggest you to compare: [ myTrigger ] call BIS_fnc_randomPosTrigger; and private _pos = [0,0,0]; _circleRadius = 1.42 * ((triggerArea myTrigger #0) max (triggerArea myTrigger #1)); While {! (_pos inArea myTrigger)} do { _pos = myTrigger getPos [_circleRadius * sqrt random 1, random 360]; _pos}; Share this post Link to post Share on other sites
BlackbirdSD 15 Posted November 30, 2020 5 hours ago, pierremgi said: Yes, BIS_fnc_randomPosTrigger is not too bad, and definitely better than whitelisting in BIS_fnc_randomPos. Now, for performance, may I suggest you to compare: [ myTrigger ] call BIS_fnc_randomPosTrigger; and private _pos = [0,0,0]; _circleRadius = 1.42 * ((triggerArea myTrigger #0) max (triggerArea myTrigger #1)); While {! (_pos inArea myTrigger)} do { _pos = myTrigger getPos [_circleRadius * sqrt random 1, random 360]; _pos}; What do you mean by test for performance? See which one works better? Share this post Link to post Share on other sites