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 urban city positions that can sequentially be used in a side mission
- // so, for example, no two positions will be in the same town
- _requestLocation = _this select 0;
- _numDestinations = _this select 1;
- _maxRadius = _this select 2;
- _difficulty = _this select 3; //scale of 0 to 1, 0 being easiest and 1 being hardest
- _searchList = ["NameCity", "Name"];
- if (_difficulty < 0.4) then {
- _searchList pushBack "NameLocal";
- _searchList pushBack "NameVillage";
- };
- if (_difficulty > 0.6) then {
- _searchList pushBack "NameCityCapital";
- };
- _nearbyTowns = ( nearestLocations [ _requestLocation, _searchList, _maxRadius] );
- while {(count _nearbyTowns) < (_numDestinations + 3)} do {
- _maxRadius = _maxRadius * 1.15;
- _nearbyTowns = ( nearestLocations [_requestLocation, _searchList, _maxRadius] );
- };
- _returnList = [];
- _maxIndex = count _nearbyTowns;
- for [{ _i = 0 }, { _i < _numDestinations }, { _i = _i + 1 }] do {
- _index = floor (random _maxIndex);
- _town = _nearbyTowns deleteAt _index;
- _pos = locationPosition _town;
- _returnList pushBack _pos;
- _maxIndex = _maxIndex - 1;
- };
- _returnList
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement