Advertisement
MGT

DRNSpawn.sqf

MGT
Jul 23rd, 2014
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. private ["_isIsland","_pos","_findSpot","_mkr","_position","_isNear","_isZero","_counter","_DRNLocs","_DRNloc"];
  2. _DRNLocs = [
  3. //Sabina
  4. [[15381.7,8395.57,87.6772], [16472.3,9163.9,119.374], [16037.2,10031.2,36.1822], [14472.9,10700.6,21.4281], [14493.7,9200.24,126.867]],
  5. //Yaroslav
  6. [[11684.3,18379.2,46.0772], [10158.6,17676.4,90.3028], [10454.7,19612.3,56.9962], [9402.78,15928.5,105.941], [10450.7,19417.3,61.5052]],
  7. //Seven
  8. [[10183.8,1541.89,26.493], [10807.8,1100.28,27.3607], [11404,806.905,23.4282], [11521.4,1606.74,48.3487], [9198.37,2514.65,28.741]],
  9. //Shtangrad
  10. [[1528.68,7270.51,36.3004], [3122.7,6819.02,81.765], [4703.43,6447.21,37.6225], [4101.24,7890.2,36.6137], [4721.14,7146.57,287.936]]
  11. ];
  12. drnspawn = -1;
  13. cutText ["","BLACK OUT"];
  14. _ok = createDialog "DRN_DIALOG";
  15. waitUntil { drnspawn != -1};
  16. if (drnspawn == 4) then {drnspawn = floor (random 4)};
  17. _DRNloc = _DRNLocs select drnspawn;
  18. //Spawn modify via mission init.sqf
  19. if(isnil "spawnArea") then {
  20. spawnArea = 1500;
  21. };
  22. if(isnil "spawnShoremode") then {
  23. spawnShoremode = 1;
  24. };
  25. //spawn into random
  26. _findSpot = true;
  27. _mkr = "";
  28. while {_findSpot} do {
  29. _counter = 0;
  30. while {_counter < 20 and _findSpot} do {
  31. // switched to floor
  32. _mkr = _DRNLoc select(floor(random (count _DRNLoc)));
  33. _position = ([(_mkr),0,spawnArea,10,0,2000,spawnShoremode] call BIS_fnc_findSafePos);
  34. _isNear = count (_position nearEntities ["Man",100]) == 0;
  35. _isZero = ((_position select 0) == 0) and ((_position select 1) == 0);
  36. //Island Check
  37. _pos = _position;
  38. _isIsland = false; //Can be set to true during the Check
  39. for [{_w=0},{_w<=150},{_w=_w+2}] do {
  40. _pos = [(_pos select 0),((_pos select 1) + _w),(_pos select 2)];
  41. if(surfaceisWater _pos) exitWith {
  42. _isIsland = true;
  43. };
  44. };
  45.  
  46. if ((_isNear and !_isZero) || _isIsland) then {_findSpot = false};
  47. _counter = _counter + 1;
  48. };
  49. };
  50. _isZero = ((_position select 0) == 0) and ((_position select 1) == 0);
  51. _position = [_position select 0,_position select 1,0];
  52. diag_log("DEBUG: spawning new player at" + str(_position));
  53. if (!_isZero) then {
  54. player setPosATL _position;
  55. };
  56. cutText ["","BLACK IN"];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement