Advertisement
Guest User

Untitled

a guest
Jan 14th, 2014
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.71 KB | None | 0 0
  1. //Created by axeman Edited by TheSzerdi
  2. //Edited by Fuchs for EMS
  3. private ["_aiunit","_xpos","_ypos","_unitpos","_aiGroup","_wppos","_wpradius","_wpnum","_levelnum","_numunits","_rndLOut","_ailoadout","_wp","_aispawnpos","_aiwep1","_aiammo1"];
  4.  
  5. _aiunit = objNull;
  6. _aiGroup = createGroup EAST;
  7. _aispawnpos =_this select 0;
  8. _wpradius = _this select 1;
  9. _wpnum = _this select 2;
  10. _numunits = _this select 3;
  11. _levelnum = _this select 4;
  12.  
  13. _xpos = _aispawnpos select 0;
  14. _ypos = _aispawnpos select 1;
  15.  
  16. diag_log format ["Epoch Event: Spawn initiated: Centre:%1 | Radius in m:%2 | Waypoint number:%3 | WeaponLevel:%4",_aispawnpos,_wpradius,_wpnum,_levelnum];
  17.  
  18. for [{ x=1 },{ x < _numunits+1 },{ x = x + 1; }] do
  19. {
  20. _unitpos = [_xpos+x,_ypos+x,0];
  21.  
  22. if (_levelnum==0) then // in_sityes troops
  23. {
  24. if ((x == 1) || (x == 3) || (x == 5)) then //troop soldiers
  25. {
  26. "BanditW2_DZ" createUnit [_unitpos, _aiGroup, "_aiunit=this;",1,"PRIVATE"];
  27. _rndLOut=floor(random 4);
  28. _ailoadout=
  29. switch (_rndLOut) do
  30. {
  31. case 0: {["M1014","8Rnd_B_Beneli_74Slug"]};
  32. case 1: {["M1014","8Rnd_B_Beneli_Pellets"]};
  33. case 2: {["Remington870_lamp","8Rnd_B_Beneli_74Slug"]};
  34. case 3: {["Remington870_lamp","8Rnd_B_Beneli_Pellets"]};
  35. };
  36. };
  37. if ((x == 2) || (x == 4) || (x >= 6)) then //troops snipers
  38. {
  39. "Bandit1_DZ" createUnit [_unitpos, _aiGroup, "_aiunit=this;",1,"PRIVATE"];
  40. _rndLOut=floor(random 3);
  41. _ailoadout=
  42. switch (_rndLOut) do
  43. {
  44. case 0: {["M4A1_HWS_GL_SD_Camo","30Rnd_556x45_StanagSD"]};
  45. case 1: {["Huntingrifle","5x_22_LR_17_HMR"]};
  46. case 2: {["M14_EP1","20Rnd_762x51_DMR"]};
  47. };
  48. };
  49. };
  50. if (_levelnum==1) then //in_military troops
  51. {
  52. if (x == 1) then //one troops commander
  53. {
  54. "Ins_Soldier_GL_DZ" createUnit [_unitpos, _aiGroup, "_aiunit=this;",1,"LIEUTENANT"];
  55. _rndLOut=floor(random 7);
  56. _ailoadout=
  57. switch (_rndLOut) do
  58. {
  59. case 0: {["AK_47_M","30Rnd_762x39_AK47"]};
  60. case 1: {["M4A1_RCO_GL","30Rnd_556x45_Stanag"]};
  61. case 2: {["Sa58P_EP1","30Rnd_762x39_SA58"]};
  62. case 3: {["Sa58V_CCO_EP1","30Rnd_762x39_SA58"]};
  63. case 4: {["Sa58V_EP1","30Rnd_762x39_SA58"]};
  64. case 5: {["M4SPR","30Rnd_556x45_Stanag"]};
  65. case 6: {["M4A1_HWS_GL_SD_Camo","30Rnd_556x45_StanagSD"]};
  66. };
  67. };
  68. if ((x == 2) || (x == 3)) then //troops sergeant
  69. {
  70. "GUE_Soldier_Crew_DZ" createUnit [_unitpos, _aiGroup, "_aiunit=this;",1,"SERGEANT"];
  71. _rndLOut=floor(random 4);
  72. _ailoadout=
  73. switch (_rndLOut) do
  74. {
  75. case 0: {["BAF_L85A2_RIS_SUSAT","30Rnd_556x45_Stanag"]};
  76. case 1: {["RPK_74","75Rnd_545x39_RPK"]};
  77. case 2: {["G36A_camo","30Rnd_556x45_G36"]};
  78. case 3: {["M4A1_HWS_GL_SD_Camo","30Rnd_556x45_StanagSD"]};
  79. };
  80. };
  81. if (x > 3) then //troops soldiers
  82. {
  83. "GUE_Soldier_MG_DZ" createUnit [_unitpos, _aiGroup, "_aiunit=this;",1,"CORPORAL"];
  84.  
  85. _rndLOut=floor(random 5);
  86. _ailoadout=
  87. switch (_rndLOut) do
  88. {
  89. case 0: {["SVD_CAMO","10Rnd_762x54_SVD"]};
  90. case 1: {["M24","5Rnd_762x51_M24"]};
  91. case 2: {["M24_des_EP1","5Rnd_762x51_M24"]};
  92. case 3: {["SVD","10Rnd_762x54_SVD"]};
  93. case 4: {["AK_107_pso","30Rnd_545x39_AK"]};
  94. };
  95. };
  96. };
  97. diag_log format ["Epoch Event: Creating Bandit1_DZ by %1 at %2. Result:%3 | Loadout:%4 / Num:%5",player,_unitpos,_aiunit,_ailoadout,_rndLOut];
  98.  
  99. _aiunit enableAI "TARGET";
  100. _aiunit enableAI "AUTOTARGET";
  101. _aiunit enableAI "MOVE";
  102. _aiunit enableAI "ANIM";
  103. _aiunit enableAI "FSM";
  104. _aiunit allowDammage true;
  105.  
  106. _aiunit addEventHandler ['killed',{_this execVM "\z\addons\dayz_server\modules\addunits\bodyclean.sqf"}]; //Body disappear time
  107.  
  108. _aiunit setCombatMode "RED";
  109. _aiunit setBehaviour "COMBAT";
  110.  
  111. //clear default weapons / ammo
  112. removeAllWeapons _aiunit;
  113. //add random selection
  114. _aiwep1 = _ailoadout select 0;
  115. _aiammo1 = _ailoadout select 1;
  116. _aiunit addweapon _aiwep1;
  117. _aiunit addMagazine _aiammo1;
  118. _aiunit addMagazine _aiammo1;
  119. _aiunit addMagazine _aiammo1;
  120. _aiunit removeWeapon "ItemRadio","NVGoggles";
  121. //add some garbage
  122. if (x == 1) then {
  123. _aiunit addMagazine "SmokeShellGreen";
  124. _aiunit addMagazine "HandGrenade_West";
  125. _aiunit addMagazine "FoodCanBakedBeans";
  126. _aiunit addMagazine "ItemSodaCoke";
  127. _aiunit addMagazine "ItemPainkiller";
  128. _aiunit addMagazine "ItemHeatPack";
  129. _aiunit addMagazine "ItemEpinephrine";
  130. _aiunit addMagazine "ItemMorphine";
  131. };
  132. if (x == 2) then {
  133. _aiunit addMagazine "ItemHeatPack";
  134. _aiunit addMagazine "ItemPainkiller";
  135. _aiunit addMagazine "ItemEpinephrine";
  136. _aiunit addMagazine "ItemMorphine";
  137. };
  138. if (x >= 3) then {
  139. _aiunit addMagazine "ItemHeatPack";
  140. _aiunit addMagazine "ItemBandage";
  141. };
  142. //set skills
  143. _aiunit setSkill ["aimingAccuracy",0.6];
  144. _aiunit setSkill ["aimingShake",0.7];
  145. _aiunit setSkill ["aimingSpeed",0.8];
  146. _aiunit setSkill ["endurance",0.9];
  147. _aiunit setSkill ["spotDistance",0.8];
  148. _aiunit setSkill ["spotTime",0.7];
  149. _aiunit setSkill ["courage",0.9];
  150. _aiunit setSkill ["reloadSpeed",0.8];
  151. _aiunit setSkill ["commanding",1];
  152. _aiunit setSkill ["general",1];
  153. //sleep 0.5;
  154. };
  155. //generate waypoints
  156. for [{ x=1 },{ x < _wpnum },{ x = x + 1; }] do {
  157. _wppos = [_xpos+(x*20),_ypos+(x*20),_wpradius];
  158. _wp = _aiGroup addWaypoint [_wppos, _wpradius];
  159. _wp setWaypointType "MOVE";
  160. };
  161. _wp = _aiGroup addWaypoint [[_xpos,_ypos,0], _wpradius];
  162. _wp setWaypointType "CYCLE";
  163.  
  164. diag_log format ["Epoch Event: Last Waypoint %1 at %2",_wp,_wppos];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement