Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2020
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. // based on a request position, max radius, and number of destinations
  2. // produce a list of interesting rurual positions that can sequentially be used in a side mission
  3. // so, for example, no two positions will end up too close/nearby
  4.  
  5. _requestPos = _this select 0;
  6. _numDestinations = _this select 1;
  7. _maxRadius = _this select 2;
  8.  
  9. _searchList = ["NameCity", "Name", "NameVillage", "NameCityCapital", "NameLocal"];
  10.  
  11. _minumumDistance = 350;
  12. _townAversionDistance = 350;
  13. _spokes = 12;
  14. _angleStep = 360 / _spokes;
  15. _angle = (round (random _spokes)) * _angleStep;
  16.  
  17. _returnList = [];
  18.  
  19. while {(count _returnList) < _numDestinations} do {
  20. _radius = _minumumDistance + (random (_maxRadius - _minumumDistance));
  21. _testPos = _requestPos vectorAdd [_radius * (cos (_angle mod 360)), _radius * (sin (_angle mod 360)), 0];
  22. _nearbyTowns = nearestLocations [ _requestPos, _searchList, _radius];
  23. if (count _nearbyTowns < 1) then {
  24. _returnList pushBack _testPos;
  25. _angle = _angle + 100;
  26. } else {
  27. _angle = _angle + (_angleStep + (random 10));
  28. };
  29. };
  30.  
  31. _returnList
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement