Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // based on a request position, max radius, and number of destinations
- // produce a list of interesting rurual positions that can sequentially be used in a side mission
- // so, for example, no two positions will end up too close/nearby
- _requestPos = _this select 0;
- _numDestinations = _this select 1;
- _maxRadius = _this select 2;
- _searchList = ["NameCity", "Name", "NameVillage", "NameCityCapital", "NameLocal"];
- _minumumDistance = 350;
- _townAversionDistance = 350;
- _spokes = 12;
- _angleStep = 360 / _spokes;
- _angle = (round (random _spokes)) * _angleStep;
- _returnList = [];
- while {(count _returnList) < _numDestinations} do {
- _radius = _minumumDistance + (random (_maxRadius - _minumumDistance));
- _testPos = _requestPos vectorAdd [_radius * (cos (_angle mod 360)), _radius * (sin (_angle mod 360)), 0];
- _nearbyTowns = nearestLocations [ _requestPos, _searchList, _radius];
- if (count _nearbyTowns < 1) then {
- _returnList pushBack _testPos;
- _angle = _angle + 100;
- } else {
- _angle = _angle + (_angleStep + (random 10));
- };
- };
- _returnList
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement