Advertisement
Guest User

Untitled

a guest
Jan 8th, 2014
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.21 KB | None | 0 0
  1. private ["_aiunit","_xpos","_ypos","_unitpos","_aiGroup","_wppos","_wpradius","_wpnum","_levelnum","_numunits","_rndLOut","_ailoadout","_wp","_aispawnpos","_aiwep1","_aiammo1","_aiwep2","_aiammo2","_spawnChance", "_spawnMarker", "_spawnRadius", "_markerRadius", "_item", "_debug", "_start_time", "_loot", "_loot_amount", "_loot_box", "_wait_time", "_spawnRoll", "_position", "_event_marker_dropzone_dropzone", "_loot_pos", "_debug_marker","_loot_box","_hint", "_cleanheli","_drop","_helipos","_gunner2","_gunner","_playerPresent","_skillarray","_aicskill","_aiskin","_aigear","_helipatrol","_gear","_skin","_backpack","_mags","_gun","_triggerdis","_startingpos","_aiweapon","_mission","_heli_class","_startPos","_helicopter","_unitGroup","_pilot","_skill","_paranumber","_position","_wp1"];
  2.  
  3. _spawnChance = 1.000; // Percentage chance of event happening
  4. _markerRadius = 350; // Radius the loot can spawn and used for the marker
  5. _debug = false; // Puts a marker exactly were the loot spawns
  6.  
  7. _wait_time = 600;
  8.  
  9. // Dont mess with theses unless u know what yours doing
  10. _start_time = time;
  11. _spawnRadius = 5000;
  12. _spawnMarker = 'center';
  13.  
  14. if (isNil "EPOCH_EVENT_RUNNING") then {
  15. EPOCH_EVENT_RUNNING = false;
  16. };
  17.  
  18. // Check for another event running
  19. if (EPOCH_EVENT_RUNNING) exitWith {
  20. diag_log("Event already running");
  21. };
  22.  
  23. // Random chance of event happening
  24. _spawnRoll = random 1;
  25. if (_spawnRoll > _spawnChance and !_debug) exitWith {};
  26.  
  27. // Random location
  28. _position = [getMarkerPos _spawnMarker,0,_spawnRadius,10,0,2000,0] call BIS_fnc_findSafePos;
  29.  
  30. diag_log(format["Spawning C-130 drop zone event at %1", _position]);
  31.  
  32. _event_marker_dropzone_c130 = createMarker [ format ["loot_event_marker_%1", _start_time], _position];
  33. _event_marker_dropzone_c130 setMarkerColor "ColorGreen";
  34. _event_marker_dropzone_c130 setMarkerType "mil_objective";
  35. _event_marker_dropzone_c130 setMarkerText "UH60 Drop Zone";
  36.  
  37. _loot_pos = [_position,0,(_markerRadius - 100),10,0,2000,0] call BIS_fnc_findSafePos;
  38.  
  39. diag_log(format["Creating UH60 drop zone at %1", _loot_pos]);
  40.  
  41. // Send message to users
  42. _hint = parseText format["<t align='center' color='#00FF11' shadow='2' size='1.75'>Airborne Troops</t><br/><t align='center' color='#ffffff'>The US Army has sent in the 101st Airborne to eliminate the Bandit threat. They are dropping in via UH60!</t>"];
  43. customRemoteMessage = ['hint', _hint];
  44. publicVariable "customRemoteMessage";
  45.  
  46. diag_log(format["UH60 Drop zone event setup, waiting for %1 seconds", _wait_time]);
  47.  
  48. _startingpos = [10371.9, 15375, 0];
  49. _heli_class = "UH60M_EP1";
  50. _paranumber = 10;
  51. _skill = 1;
  52. _gun = "Random";
  53. _mags = 4;
  54. _backpack = "";
  55. _skin = "Soldier1_DZ";
  56. _gear = "Random";
  57. _helipatrol = True;
  58. //if (count _this > 12) then {
  59. // _mission = _this select 12;
  60. //} else {
  61. // _mission = False;
  62. //};
  63. //_delay = _this select 12;
  64. _aiweapon = [];
  65. _aigear = [];
  66. _aiskin = "";
  67. _aicskill = [];
  68. _skillarray = ["aimingAccuracy","aimingShake","aimingSpeed","endurance","spotDistance","spotTime","courage","reloadSpeed","commanding","general"];
  69.  
  70. // wait for player to come into area.
  71. //diag_log "Drop zone: Paradrop Waiting for player";
  72. //waitUntil
  73. //{
  74. // sleep 10;
  75. // _playerPresent = false;
  76. // {if((isPlayer _x) AND (_x distance [(_position select 0),(_position select 1),0] <= _triggerdis)) then {_playerPresent = true};}forEach playableUnits;
  77. // (_playerPresent)
  78. //};
  79. //Delay before chopper spawns in.
  80. //sleep _delay;
  81. //Spawing in Chopper and crew
  82. diag_log format ["UH60 Drop zone: Spawning a %1 with %2 units to be paradropped at %3",_heli_class,_paranumber,_position];
  83. _unitGroup = createGroup west;
  84. _pilot = _unitGroup createUnit ["Rocket_DZ", [0,0,0], [], 1, "NONE"];
  85. [_pilot] joinSilent _unitGroup;
  86. ai_air_units = (ai_air_units +1);
  87.  
  88. 10371.9, 15375
  89. _helicopter = createVehicle [_heli_class, [(_startingpos select 0),(_startingpos select 1), 100], [], 0, "FLY"];
  90. _helicopter setFuel 1;
  91. _helicopter engineOn true;
  92. _helicopter setVehicleAmmo 1;
  93. _helicopter flyInHeight 150;
  94. _helicopter addEventHandler ["GetOut",{(_this select 0) setFuel 0;(_this select 0) setDamage 1;}];
  95.  
  96. _pilot assignAsDriver _helicopter;
  97. _pilot moveInDriver _helicopter;
  98.  
  99. _gunner = _unitGroup createUnit ["Soldier1_DZ", [0,0,0], [], 1, "NONE"];
  100. _gunner assignAsGunner _helicopter;
  101. _gunner moveInTurret [_helicopter,[0]];
  102. [_gunner] joinSilent _unitGroup;
  103. ai_air_units = (ai_air_units +1);
  104.  
  105. _gunner2 = _unitGroup createUnit ["Soldier1_DZ", [0,0,0], [], 1, "NONE"];
  106. _gunner2 assignAsGunner _helicopter;
  107. _gunner2 moveInTurret [_helicopter,[1]];
  108. [_gunner2] joinSilent _unitGroup;
  109. ai_air_units = (ai_air_units +1);
  110.  
  111. {_pilot setSkill [_x,1]} forEach _skillarray;
  112. {_gunner setSkill [_x,0.7]} forEach _skillarray;
  113. {_gunner2 setSkill [_x,0.7]} forEach _skillarray;
  114. {_x addweapon "Makarov";_x addmagazine "8Rnd_9x18_Makarov";_x addmagazine "8Rnd_9x18_Makarov";} forEach (units _unitgroup);
  115. PVDZE_serverObjectMonitor set [count PVDZE_serverObjectMonitor,_helicopter];
  116. [_helicopter] spawn veh_monitor;
  117.  
  118. _unitGroup allowFleeing 0;
  119. _unitGroup setBehaviour "STEALTH";
  120. //_unitGroup setBehaviour "CARELESS";
  121. _unitGroup setSpeedMode "FULL";
  122. _unitGroup setCombatMode "RED";
  123.  
  124. // Add waypoints to the chopper group.
  125. _wp = _unitGroup addWaypoint [[(_position select 0), (_position select 1)], 0];
  126. _wp setWaypointType "MOVE";
  127. _wp setWaypointCompletionRadius 100;
  128.  
  129. _drop = True;
  130. _helipos = getpos _helicopter;
  131. while {(alive _helicopter) AND (_drop)} do {
  132. private ["_magazine","_weapon","_weaponandmag","_chute","_para","_pgroup"];
  133. sleep 1;
  134. _helipos = getpos _helicopter;
  135. if (_helipos distance [(_position select 0),(_position select 1),100] <= 250) then {
  136. _pgroup = createGroup west;
  137. for "_x" from 1 to _paranumber do {
  138. _helipos = getpos _helicopter;
  139. switch (_gun) do {
  140. _rndLOut=floor(random 7);
  141. _ailoadout=
  142. //_aiweapon =
  143. switch (_rndLOut) do
  144. {
  145. case 0: {["AK_47_M","30Rnd_762x39_AK47","MakarovSD","8Rnd_9x18_Makarov"]};
  146. case 1: {["M4A1_RCO_GL","30Rnd_762x39_AK47","M9SD","15Rnd_9x19_M9SD"]};
  147. case 2: {["Sa58P_EP1","30Rnd_762x39_SA58","MakarovSD","8Rnd_9x18_Makarov"]};
  148. case 3: {["Sa58V_CCO_EP1","30Rnd_762x39_SA58","M9SD","15Rnd_9x19_M9SD"]};
  149. case 4: {["Sa58V_EP1","30Rnd_762x39_SA58","MakarovSD","8Rnd_9x18_Makarov"]};
  150. case 5: {["M4SPR","30Rnd_556x45_Stanag","M9SD","15Rnd_9x19_M9SD"]};
  151. case 6: {["M4A1_HWS_GL_SD_Camo","30Rnd_556x45_StanagSD","MakarovSD","8Rnd_9x18_Makarov"]};
  152. };
  153. };
  154. //_weaponandmag = _aiweapon call BIS_fnc_selectRandom;
  155. /*_weaponandmag = _aiweapon
  156. _weapon = _weaponandmag select 0;
  157. _magazine = _weaponandmag select 1;
  158. switch (_gear) do {
  159. case 0 : {_aigear = ai_gear0;};
  160. case 1 : {_aigear = ai_gear1;};
  161. case 2 : {_aigear = ai_gear2;};
  162. case 3 : {_aigear = ai_gear3;};
  163. case 4 : {_aigear = ai_gear4;};
  164. case "Random" : {_aigear = ai_gear_random call BIS_fnc_selectRandom;};
  165. };
  166. _gearmagazines = _aigear select 0;
  167. _geartools = _aigear select 1; */
  168. if (_skin == "") then {
  169. _aiskin = ai_skin call BIS_fnc_selectRandom;
  170. } else {
  171. _aiskin = _skin
  172. };
  173. _para = _pgroup createUnit [_aiskin, [0,0,0], [], 1, "PRIVATE"];
  174. if (_backpack == "") then {
  175. _aipack = ai_packs call BIS_fnc_selectRandom;
  176. } else {
  177. _aipack = _backpack
  178. };
  179. _para enableAI "TARGET";
  180. _para enableAI "AUTOTARGET";
  181. _para enableAI "MOVE";
  182. _para enableAI "ANIM";
  183. _para enableAI "FSM";
  184. _para setCombatMode ai_combatmode;
  185. _para setBehaviour ai_behaviour;
  186. _para allowDammage true;
  187.  
  188. //clear default weapons / ammo
  189. removeAllWeapons _aiunit;
  190. //add random selection
  191. _aiwep1 = _ailoadout select 0;
  192. _aiammo1 = _ailoadout select 1;
  193. _aiwep2 = _ailoadout select 2;
  194. _aiammo2 = _ailoadout select 3;
  195. _aiunit addweapon _aiwep1;
  196. _aiunit addMagazine _aiammo1;
  197. _aiunit addMagazine _aiammo1;
  198. _aiunit addMagazine _aiammo1;
  199. _aiunit addweapon _aiwep2;
  200. _aiunit addMagazine _aiammo2;
  201. _aiunit addMagazine _aiammo2;
  202. _aiunit removeWeapon "ItemRadio";
  203. //add some garbage
  204. if (x == 1) then {
  205. _aiunit addMagazine "SmokeShellGreen";
  206. _aiunit addMagazine "HandGrenade_West";
  207. _aiunit addMagazine "FoodCanBakedBeans";
  208. _aiunit addMagazine "ItemSodaCoke";
  209. _aiunit addMagazine "ItemPainkiller";
  210. _aiunit addMagazine "ItemHeatPack";
  211. _aiunit addMagazine "ItemEpinephrine";
  212. _aiunit addMagazine "ItemMorphine";
  213. };
  214. if (x == 2) then {
  215. _aiunit addMagazine "ItemHeatPack";
  216. _aiunit addMagazine "ItemPainkiller";
  217. _aiunit addMagazine "ItemEpinephrine";
  218. _aiunit addMagazine "ItemMorphine";
  219. };
  220. if (x >= 3) then {
  221. _aiunit addMagazine "ItemHeatPack";
  222. _aiunit addMagazine "ItemBandage";
  223. };
  224. //set skills
  225. _aiunit setSkill ["aimingAccuracy",0.6];
  226. _aiunit setSkill ["aimingShake",0.7];
  227. _aiunit setSkill ["aimingSpeed",0.8];
  228. _aiunit setSkill ["endurance",0.9];
  229. _aiunit setSkill ["spotDistance",0.8];
  230. _aiunit setSkill ["spotTime",0.7];
  231. _aiunit setSkill ["courage",0.9];
  232. _aiunit setSkill ["reloadSpeed",0.8];
  233. _aiunit setSkill ["commanding",1];
  234. _aiunit setSkill ["general",1];
  235. //sleep 0.5;
  236.  
  237.  
  238. /*
  239. removeAllWeapons _para;
  240. removeAllItems _para;
  241. _para addweapon _aiweapon;
  242. for "_i" from 1 to _mags do {_para addMagazine _magazine;};
  243. _para addBackpack _aipack;
  244. {_para addMagazine _x} forEach _gearmagazines;
  245. {_para addweapon _x} forEach _geartools; */
  246. ai_ground_units = (ai_ground_units + 1);
  247. _para addEventHandler ["Killed",{[_this select 0, _this select 1, "ground"] call on_kill;}];
  248. _chute = createVehicle ["ParachuteEast", [(_helipos select 0), (_helipos select 1), (_helipos select 2)], [], 0, "NONE"];
  249. _para moveInDriver _chute;
  250. [_para] joinSilent _pgroup;
  251. sleep 1.5;
  252. };
  253. _drop = false;
  254. _pgroup selectLeader ((units _pgroup) select 0);
  255. diag_log format ["UH60 Drop zone: Spawned in %1 ai units for paradrop",_paranumber];
  256. [_pgroup, _position,_mission] call group_waypoints;
  257. };
  258. };
  259. if (_helipatrol) then {
  260. _wp1 = _unitGroup addWaypoint [[(_position select 0),(_position select 1)], 100];
  261. _wp1 setWaypointType "SAD";
  262. _wp1 setWaypointCompletionRadius 150;
  263. _unitGroup setBehaviour "AWARE";
  264. _unitGroup setSpeedMode "FULL";
  265. _unitGroup setCombatMode "RED";
  266. {_x addEventHandler ["Killed",{[_this select 0, _this select 1, "air"] call on_kill;}];} forEach (units _unitgroup);
  267. } else {
  268. {_x doMove [(_startingpos select 0), (_startingpos select 1), 100]} forEach (units _unitGroup);
  269. _unitGroup setBehaviour "CARELESS";
  270. _unitGroup setSpeedMode "FULL";
  271. _unitGroup setCombatMode "RED";
  272. _cleanheli = True;
  273. while {_cleanheli} do {
  274. sleep 20;
  275. _helipos1 = getpos _helicopter;
  276. if ((_helipos1 distance [(_startingpos select 0),(_startingpos select 1),100] <= 200) OR (!alive _helicopter)) then {
  277. deleteVehicle _helicopter;
  278. {deleteVehicle _x} forEach (units _unitgroup);
  279. sleep 10;
  280. deleteGroup _unitGroup;
  281. ai_air_units = (ai_air_units -3);
  282. diag_log "WAI: Paradrop cleaned up";
  283. _cleanheli = False;
  284. };
  285. };
  286. };
  287.  
  288. // Wait
  289. sleep _wait_time;
  290.  
  291. // Clean up
  292. EPOCH_EVENT_RUNNING = false;
  293. deleteMarker _event_marker_dropzone_uh60;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement