Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2020
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. // based on a request position, max radius, and number of destinations
  2. // produce a list of urban city positions that can sequentially be used in a side mission
  3. // so, for example, no two positions will be in the same town
  4.  
  5. _requestLocation = _this select 0;
  6. _numDestinations = _this select 1;
  7. _maxRadius = _this select 2;
  8. _difficulty = _this select 3; //scale of 0 to 1, 0 being easiest and 1 being hardest
  9.  
  10. _searchList = ["NameCity", "Name"];
  11. if (_difficulty < 0.4) then {
  12. _searchList pushBack "NameLocal";
  13. _searchList pushBack "NameVillage";
  14. };
  15. if (_difficulty > 0.6) then {
  16. _searchList pushBack "NameCityCapital";
  17. };
  18.  
  19. _nearbyTowns = ( nearestLocations [ _requestLocation, _searchList, _maxRadius] );
  20. while {(count _nearbyTowns) < (_numDestinations + 3)} do {
  21. _maxRadius = _maxRadius * 1.15;
  22. _nearbyTowns = ( nearestLocations [_requestLocation, _searchList, _maxRadius] );
  23. };
  24.  
  25. _returnList = [];
  26. _maxIndex = count _nearbyTowns;
  27.  
  28. for [{ _i = 0 }, { _i < _numDestinations }, { _i = _i + 1 }] do {
  29. _index = floor (random _maxIndex);
  30. _town = _nearbyTowns deleteAt _index;
  31. _pos = locationPosition _town;
  32. _returnList pushBack _pos;
  33. _maxIndex = _maxIndex - 1;
  34. };
  35.  
  36. _returnList
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement