Advertisement
Bob_the_K

spawn.sqf

Dec 22nd, 2014
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.30 KB | None | 0 0
  1. private ["_counter","_vipBase","_vipUID","_findSpot","_isBase","_isNear","_isPZombie","_isZero","_nearPlayers","_position","_seldLoc","_seldRandom","_waitScript","_forEachIndex"];
  2.  
  3. cutText ["","BLACK OUT",0];
  4. // removes class selection removeAllWeapons player;
  5. // removes class selection removeAllItems player;
  6. // removes class selection removeBackpack player;
  7. haloSelect = -1;
  8. spawnSelect = -1;
  9. statusSelect = -2;
  10.  
  11. locArray = [
  12. [[17471.7,5239.7,230.049], [16778.7,6308.6,151.993], [17890,5747.92,167.251], [16285.5,7424.76,396.825], [17614.8,7834.89,261.943]], //Byelov
  13. [[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]], //Sabina
  14. [[14499.2,12362.8,86.9139], [13434.3,11698.1,85.3361], [13745.9,12248.4,63.8834], [12151.4,12853.8,233.966], [12359.3,12430.1,111.949]], //Etanovsk
  15. [[11237.6,14413.2,105.549], [11868.8,14156.2,293.846], [12655.3,15389.2,108.404], [12021.7,15939.5,114.001], [11217.5,16047.8,114.001]], //Lyepestok
  16. [[17069,12300.4,43.5294], [16738.1,13978.6,56.9753], [15240.9,14005.2,60.342], [16264.4,15420.1,28.2671], [14902.5,15232.1,46.6703]], //Martin
  17. [[15693.2,16882.5,131.85], [14414.9,17488.4,171.399], [13742.7,19072.6,55.5006], [14839.8,16583.1,80.5402],[16042.8,16100.7,7.50033]], //Dalnogorsk
  18. [[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]], //Yaroslav
  19. [[8350.45,18936.8,122.77], [9711.87,20179.9,69.5927], [8193.27,21405.5,153.653], [8607.75,20548.9,178.285], [8072.49,19927.1,112.192]], //Kameni
  20. [[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]], //Seven
  21. [[8225.28,3073.61,10.4816], [8917.26,4271.81,80.3664], [8228.37,5491.64,100.734], [7069.92,4880.18,34.7772], [5719.95,5951.77,37.2921]], //Branibor
  22. [[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]], //Shtangrad
  23. [[5903.94,10519.4,91.9985], [6678.8,10050.2,93.6081], [6439.7,9333.18,217.558], [6107.62,8824.15,35.7552], [5067.08,8301.84,36.8271]], //Vedich
  24. [[10238.2,7319.2,149.359], [9264.65,6540.16,143.436], [8197.54,7717.57,76.0581], [7949.59,8585.13,102.284], [8711.17,8695.79,146.269]], //Krazno
  25. [[20028.1,5539.08,91.9985], [18044.1,5516.69,143.436], [17764.9,4823.54,76.0581], [17519.5,5384.25,287.936], [16982.5,5380.76,146.269]], //Alexander
  26. [[14827.5,5689.35,149.359], [15368.7,5504.59,143.436], [14418.2,5377.16,76.0581], [14250.2,5909.93,102.284], [15168,6408.98,146.269]] //Grushnoye
  27. ];
  28.  
  29. _waitScript = [] spawn {
  30. private ["_blocked","_bodies","_bodyCheck","_bodyPos","_vipBase","_vipUID","_i","_idc","_pos"];
  31. _bodyCheck = {
  32. if (ctrlVisible 1001) then {
  33. _vipUID = (getPlayerUID player);
  34. {if (_vipUID == _x) then {_vipBase = _forEachIndex;};} forEach vipListBase;
  35. locArray = locArray+[[(vipListBases select _vipBase)]];
  36. };
  37. _blocked = false;
  38. _bodies = [];
  39. {if (!isNull _x) then {if ((_x getVariable["bodyName",name _x]) == (name player)) then {_bodyPos = (getPosATL _x);_bodies set [count _bodies,_bodyPos];};};} count allDead;
  40. if (count _bodies != 0) then {
  41. {
  42. _bodyPos = _x;
  43. {
  44. _pos = (locArray select _forEachIndex) select 0;
  45. if ((_bodyPos distance _pos) <= bodyCheckDistance) then {
  46. _idc = (1600+_forEachIndex);
  47. ctrlShow [_idc,false];
  48. _blocked = true;
  49. };
  50. } forEach locArray;
  51. } count _bodies;
  52. if !(ctrlVisible 1640) then {ctrlShow [1001,false];};
  53. if (_blocked) then {systemChat format ["Note: some spawns are blocked due to a body of yours within %1m",bodyCheckDistance];};
  54. };
  55. };
  56. while {statusSelect < 2} do {
  57. dayz_temperatur = 36;
  58. DZE_InRadiationZone = false;
  59. fnc_usec_damageHandler = {};
  60. {_x hideObject true;_x allowDamage false;} count (player nearEntities ["CAManBase", 80]);
  61. uiSleep 1;
  62. if (!dialog) then {
  63. cutText ["","BLACK OUT",0];
  64. // removes class selection if (statusSelect == -2) then {_i="createDialog";createDialog "E_Class_Dialog";call classFill;};
  65. if (statusSelect == 0) then {disableUserInput true;disableUserInput true;disableUserInput true;_i="createDialog";createDialog "E_Spawn_Dialog";if !((getPlayerUID player) in vipListBase) then {ctrlShow [1001,false];ctrlShow [1640,false];};call _bodyCheck;uiSleep 1;disableUserInput false;disableUserInput false;disableUserInput false;};
  66. if (statusSelect == 1) then {_i="createDialog";createDialog "E_Halo_Dialog";};
  67. };
  68. };
  69. };
  70.  
  71. _isPZombie = player isKindOf "PZombie_VB";
  72. // #include "class.sqf"
  73. statusSelect = 0;
  74. closeDialog 0;
  75. waitUntil {spawnSelect != -1};
  76. statusSelect = 1;
  77. closeDialog 0;
  78. if (!_isPZombie && (spawnSelect != 41)) then {waitUntil {haloSelect != -1};};
  79. statusSelect = 3;
  80. closeDialog 0;
  81. terminate _waitScript;
  82. {_x hideObject false;_x allowDamage true;} count (player nearEntities ["CAManBase", 80]);
  83. fnc_usec_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandler.sqf";
  84. cutText ["","BLACK IN"];
  85.  
  86. if (spawnSelect == 40) exitWith {
  87. _vipUID = (getPlayerUID player);
  88. {if (_vipUID == _x) then {_vipBase = _forEachIndex;};} forEach vipListBase;
  89. _position = vipListBases select _vipBase;
  90. if (haloSelect == 1) then {player setPosATL [_position select 0,_position select 1,1500];[player,1500] spawn BIS_fnc_halo;} else {player setPosATL _position;};
  91. };
  92. if (spawnSelect == 41) then {spawnSelect = floor (random 14)};
  93.  
  94. _seldLoc = locArray select spawnSelect;
  95. _seldRandom = _seldLoc call BIS_fnc_selectRandom;
  96. _findSpot = true;
  97. _isNear = false;
  98. _counter = 0;
  99. while {_findSpot && _counter < 20} do {
  100. _position = ([_seldRandom,0,650,1,0,20,0] call BIS_fnc_findSafePos);
  101. _nearPlayers = (_position nearEntities ["CAManBase",100]);
  102. {if ((!isNull _x) && (getPlayerUID _x != "")) then {_isNear = true;};} count _nearPlayers;
  103. _isZero = ((_position select 0) == 0) && ((_position select 1) == 0);
  104. _isBase = (count(nearestObjects [_position,["Plastic_Pole_EP1_DZ"],45]) > 0);
  105. _counter = _counter + 1;
  106. if (!_isNear && !_isZero && !_isBase) then {_findSpot = false};
  107. };
  108. _position = [_position select 0,_position select 1,0];
  109. if (haloSelect == 1) then {player setPosATL [_position select 0,_position select 1,1500];[player,1500] spawn BIS_fnc_halo;} else {player setPosATL _position;};
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement