Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.14 KB | None | 0 0
  1. {
  2. fnc_avoid_worm = {
  3. private ["_danger_close","_op_dir","_chased_units","_fct","_reldir","_avoid_poz"];
  4. _danger_close = _this select 0;
  5. _chased_units = _this select 1;
  6. {
  7. _reldir = [_x, getPos _danger_close] call BIS_fnc_dirTo;
  8. _fct = [30,-30] call BIS_fnc_selectRandom;
  9. if (_reldir<180) then {_op_dir=_reldir+180 +_fct} else {_op_dir=_reldir-180+_fct};
  10. _avoid_poz = [getposATL _x,20+random 50, _op_dir] call BIS_fnc_relPos;
  11. _x doMove _avoid_poz;
  12. _x setSkill ["commanding", 1];
  13. } foreach _chased_units;
  14. };
  15.  
  16. Worm_fnc_mainFunction = {
  17. params["_markerName"];
  18. [_this select 0] spawn
  19. {
  20. params ["_press_implicit_x","_press_implicit_y"];
  21.  
  22. if (!isServer) exitWith {};
  23.  
  24. _poz_worm = _this select 0;
  25.  
  26. _cap = createVehicle ["Land_CanOpener_F",getmarkerpos _poz_worm,[],0,"CAN_COLLIDE"];
  27. _coada = createVehicle ["Land_CanOpener_F",getmarkerpos _poz_worm,[],0,"CAN_COLLIDE"];
  28. _coada_01= createVehicle ["Land_CanOpener_F",getmarkerpos _poz_worm,[],0,"CAN_COLLIDE"];
  29. _coada attachTo [_cap,[0,-1,1]];
  30. _coada_01 attachTo [_coada,[0,-1,1]];
  31. [_coada, true] remoteExec ["hideObjectGlobal",0,true];
  32. [_coada_01, true] remoteExec ["hideObjectGlobal",0,true];
  33.  
  34. _hide_me = true;
  35. while {_hide_me} do {
  36. sleep 2;
  37. _list_ai_in_range_worm = (position _cap) nearEntities [["Man","LandVehicle"],100];
  38. if (count _list_ai_in_range_worm > 0) then {
  39. _hide_me = false;
  40. _tgt_worm = _list_ai_in_range_worm call BIS_fnc_selectRandom;
  41. _dir_move = [getPos _cap,_tgt_worm] call BIS_fnc_dirTo;
  42. _dir_move = _dir_move+45;
  43. if (_dir_move<=90) then {
  44. _press_implicit_x = linearConversion [0, 90,_dir_move, 0, 1, true];
  45. _press_implicit_y = 1-_press_implicit_x;
  46. };
  47.  
  48. if ((_dir_move>90)and(_dir_move<180)) then {
  49. _dir_move = _dir_move-90;
  50. _press_implicit_x = linearConversion [0, 90,_dir_move, 1, 0, true];
  51. _press_implicit_y = _press_implicit_x-1;
  52. };
  53.  
  54. if ((_dir_move>180)and(_dir_move<270)) then {
  55. _dir_move = _dir_move-180;
  56. _press_implicit_x = linearConversion [0, 90,_dir_move, 0, -1, true];
  57. _press_implicit_y = (-1*_press_implicit_x)-1;
  58. };
  59.  
  60. if ((_dir_move>270)and(_dir_move<360)) then {
  61. _dir_move = _dir_move-270;
  62. _press_implicit_x = linearConversion [0, 90,_dir_move, -1, 0, true];
  63. _press_implicit_y = 1+_press_implicit_x;
  64. };
  65.  
  66. [_cap,_coada,_coada_01] remoteExec["Worm_fnc_effect",0];
  67. [_cap,_coada] remoteExec ["Worm_fnc_attack",0];
  68.  
  69. _cap setposATL [getPosATL _cap select 0,getPosATL _cap select 1,2];
  70. _cap setVelocity [_press_implicit_x*5,_press_implicit_y*5,20+random 10];
  71. sleep 1;
  72. };
  73. };
  74. sleep 1;
  75. enableCamShake false;
  76. waitUntil {(getPosATL _cap select 2) < 1};
  77. addCamShake [1,4,23];
  78. [_cap,_coada] remoteExec ["Worm_fnc_attack",0];
  79. [_cap] remoteExec ["Worm_fnc_bump",0];
  80. sleep 1;
  81.  
  82. while {!isNull _cap} do
  83. {
  84. _tgt_worm = [];
  85. _list_ai_in_range_worm = (position _cap) nearEntities [["Man","LandVehicle"],150];
  86. _tgt_worm = _list_ai_in_range_worm call BIS_fnc_selectRandom;
  87. if (count _list_ai_in_range_worm > 0) then {
  88. if ((_tgt_worm distance _cap < 15)&&!(surfaceIsWater getPos _tgt_worm)) then
  89. {
  90. [_cap,_list_ai_in_range_worm] call fnc_avoid_worm;
  91. _dir_move = [getPos _cap,_tgt_worm] call BIS_fnc_dirTo;
  92. if (_dir_move<=90) then {
  93. _press_implicit_x = linearConversion [0, 90,_dir_move, 0, 1, true];
  94. _press_implicit_y = 1-_press_implicit_x;
  95. };
  96.  
  97. if ((_dir_move>90)and(_dir_move<180)) then {
  98. _dir_move = _dir_move-90;
  99. _press_implicit_x = linearConversion [0, 90,_dir_move, 1, 0, true];
  100. _press_implicit_y = _press_implicit_x-1;
  101. };
  102.  
  103. if ((_dir_move>180)and(_dir_move<270)) then {
  104. _dir_move = _dir_move-180;
  105. _press_implicit_x = linearConversion [0, 90,_dir_move, 0, -1, true];
  106. _press_implicit_y = (-1*_press_implicit_x)-1;
  107. };
  108.  
  109. if ((_dir_move>270)and(_dir_move<360)) then {
  110. _dir_move = _dir_move-270;
  111. _press_implicit_x = linearConversion [0, 90,_dir_move, -1, 0, true];
  112. _press_implicit_y = 1+_press_implicit_x;
  113. };
  114. _cap setVelocity [_press_implicit_x*5,_press_implicit_y*5,15+random 10];
  115. sleep 0.5;
  116. waitUntil {(getPosATL _cap select 2) < 1};
  117. [_cap,_coada] remoteExec ["Worm_fnc_attack",0];
  118. _nearobj_wrom = nearestObjects [getposATL _cap, [], 20];
  119. { if ((_x!=_cap)&&(_x!=_coada)&&(_x!=_coada_01)&&!(surfaceIsWater getPos _x)) then {if (_x isKindOf "LandVehicle") then {_x setVelocity [1+random 3,1+random 3,5+random 17]; _x setDammage ((getDammage _x) + 0.5)} else {_x setVelocity [1+random 3,1+random 3,1+random 5]}; _x setDammage ((getDammage _x) + 0.5)};} foreach _nearobj_wrom;
  120. sleep 1;
  121. [_cap,_list_ai_in_range_worm] call fnc_avoid_worm;
  122. if (((getPosatl _cap select 2) <0)or((getPosatl _cap select 2) >2)) then {_cap setpos ([getpos _cap,0.5,50,10,0,1,0] call BIS_fnc_findSafePos)};
  123. sleep 8;
  124. _cap setposATL [getPosATL _cap select 0,getPosATL _cap select 1,2];
  125. };
  126.  
  127. if ((!isNull _tgt_worm)&&(_tgt_worm distance _cap > 15)&&!(surfaceIsWater getPos _tgt_worm)) then
  128. {
  129. [_cap,_list_ai_in_range_worm] call fnc_avoid_worm;
  130. _fct_move = 8+random 8;
  131. _fct = [+10+random -35,10+random 45] call BIS_fnc_selectRandom;
  132. _dir_move = [getPos _cap,_tgt_worm] call BIS_fnc_dirTo;
  133. _dir_move = _dir_move+_fct;
  134. if (_dir_move<=90) then {
  135. _press_implicit_x = linearConversion [0, 90,_dir_move, 0, 1, true];
  136. _press_implicit_y = 1-_press_implicit_x;
  137. };
  138.  
  139. if ((_dir_move>90)and(_dir_move<180)) then {
  140. _dir_move = _dir_move-90;
  141. _press_implicit_x = linearConversion [0, 90,_dir_move, 1, 0, true];
  142. _press_implicit_y = _press_implicit_x-1;
  143. };
  144.  
  145. if ((_dir_move>180)and(_dir_move<270)) then {
  146. _dir_move = _dir_move-180;
  147. _press_implicit_x = linearConversion [0, 90,_dir_move, 0, -1, true];
  148. _press_implicit_y = (-1*_press_implicit_x)-1;
  149. };
  150.  
  151. if ((_dir_move>270)and(_dir_move<360)) then {
  152. _dir_move = _dir_move-270;
  153. _press_implicit_x = linearConversion [0, 90,_dir_move, -1, 0, true];
  154. _press_implicit_y = 1+_press_implicit_x;
  155. };
  156. _cap setVelocity [_press_implicit_x*_fct_move,_press_implicit_y*_fct_move,5+random 5];
  157. sleep 2;
  158. _cap setposATL [getPosATL _cap select 0,getPosATL _cap select 1,2];
  159. };
  160. } else {sleep 10};
  161.  
  162. };
  163. };
  164. };
  165.  
  166. Worm_fnc_effect = {
  167. params["_i","_ii","_iii"];
  168. [_this select 0, _this select 1, _this select 2] spawn
  169. {
  170. if (!hasInterface) exitWith {};
  171.  
  172. _head_worm = _this select 0;
  173. _tail_worm = _this select 1;
  174. _voce_idle = _this select 2;
  175.  
  176. [_voce_idle, true] remoteExec ["hideObjectGlobal",0,true];
  177.  
  178. while {!isnull _head_worm} do
  179. {
  180. comment "sunOrMoon==0";
  181. if (true) then
  182. {
  183. _smoke_head = "#particlesource" createVehicleLocal (getPosATL _head_worm);
  184. _smoke_head setParticleCircle [0, [0, 0, 0]];
  185. _smoke_head setParticleRandom [3, [0.25, 0.25, 0.25], [0.1, 0.1, 0.1], 5, 0.25, [0.1, 0.1, 0.05, 0.1], 1, 0];
  186. _smoke_head setParticleParams [["\A3\data_f\cl_basic", 1, 0, 1], "", "Billboard", 1, 11, [0, 0, 0], [0, 0, 1], 7, 11, 7.9, 0.0001, [4, 3, 0.5], [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], [0.08], 1, 0, "", "", _head_worm,0,true,0.1,[[0,0,0,0]]];
  187. _smoke_head setDropInterval 0.01;
  188.  
  189. _spot_lit = "#lightpoint" createVehicle (getPosATL _head_worm);
  190. _spot_lit lightAttachObject [_head_worm, [0.1,0.1,5]];
  191. _spot_lit setLightUseFlare false;
  192. _spot_lit setLightDayLight true;
  193. _spot_lit setLightFlareSize 1;
  194. _spot_lit setLightFlareMaxDistance 1500;
  195. _spot_lit setLightAttenuation [0,0,50,1000,1,50];
  196.  
  197. while {player distance _head_worm <2000} do
  198. {
  199. _r_col_burp=random 1;
  200. _g_col_burp=random 1;
  201. _b_col_burp=random 1;
  202. _spot_lit setLightColor [_r_col_burp,_g_col_burp,_b_col_burp];
  203. _spot_lit setLightAmbient [_g_col_burp,_r_col_burp,_b_col_burp];
  204. _flick = 1+floor (random 9);
  205. _fl_inc = 0;
  206. while {_fl_inc<_flick} do
  207. {
  208. _spot_lit setLightBrightness (10+random 30);
  209. _fl_inc = _fl_inc+1;
  210. sleep 0.1+random 0.2;
  211. };
  212. _spot_lit setLightBrightness 0;
  213. sleep 3+ (random 10);
  214. };
  215. deleteVehicle _smoke_head;
  216. deleteVehicle _spot_lit;
  217. } else {
  218. _smoke_head = "#particlesource" createVehicleLocal (getPosATL _head_worm);
  219. _smoke_head setParticleCircle [0, [0, 0, 0]];
  220. _smoke_head setParticleRandom [3, [0.25, 0.25, 0.25], [0.1, 0.1, 0.1], 5, 0.25, [0.1, 0.1, 0.05, 0.1], 1, 0];
  221. _smoke_head setParticleParams [["\A3\data_f\cl_basic", 1, 0, 1], "", "Billboard", 1, 11, [0, 0, 0], [0, 0, 1], 7, 11, 7.9, 0.0001, [4, 3, 0.5], [[0, 0, 0, 1], [0, 0, 0, 1], [0, 0, 0, 1]], [0.08], 1, 0, "", "", _head_worm,0,true,0.1,[[0,0,0,0]]];
  222. _smoke_head setDropInterval 0.01;
  223. while {player distance _head_worm <2000} do {sleep 30};
  224. deleteVehicle _smoke_head;
  225. };
  226.  
  227. waitUntil {player distance _head_worm <2000};
  228. };
  229. };
  230. };
  231.  
  232. Worm_fnc_attack = {
  233. params ["_i","_ii"];
  234. [_this select 0,_this select 1] spawn
  235. {
  236. private ["_crater_impact"];
  237.  
  238. if (!hasInterface) exitWith {};
  239.  
  240. _head_worm = _this select 0;
  241. _tail_worm = _this select 1;
  242.  
  243. enableCamShake true;
  244. comment "Add Impact Sound Below HERE";
  245.  
  246. _blast_dust = "#particlesource" createVehicleLocal (getPosATL _head_worm);
  247. _blast_dust setParticleCircle [6, [-3, -3, 0]];
  248. _blast_dust setParticleRandom [2, [2, 2, 0], [-15, -15, 0], 5, 1, [0, 0, 0, 1], 1, 0];
  249. _blast_dust setParticleParams [["\A3\data_f\cl_basic", 1, 0, 1], "", "Billboard", 1, 7, [0, 0, 0], [0, 0, 0.1], 7, 10, 7.9, 0.005, [5, 7, 13], [[0.3, 0.27, 0.15, 1], [0.3, 0.27, 0.15, 0.5], [0.3, 0.27, 0.15, 0]], [0.08], 1, 0, "", "", _head_worm];
  250. _blast_dust setDropInterval 0.002;
  251.  
  252. _dist_worm = player distance _head_worm;
  253. _shake_power = linearConversion [0, 1000,_dist_worm, 5, 0, true];
  254. addCamShake [_shake_power,4,13+(random 33)];
  255.  
  256. _bolovani_blast = "#particlesource" createVehicleLocal (getPosATL _head_worm);
  257. _bolovani_blast setParticleCircle [2, [0, 0, 0]];
  258. _bolovani_blast setParticleRandom [1, [0.25, 0.25, 0], [10, 10, 15], 0.5, 0.25, [0, 0, 0, 0.1], 0, 0];
  259. _bolovani_blast setParticleParams [["\A3\data_f\ParticleEffects\Universal\Mud.p3d", 1, 0, 1], "", "SpaceObject", 1, 10, [0, 0, 0], [0, 0, 13], 3, 20, 7.9, 0.0001, [.6, .6, .6], [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], [0.08], 1, 0, "", "", _head_worm,0,true,0.3,[[0,0,0,0]]];
  260. _bolovani_blast setDropInterval 0.007;
  261.  
  262. sleep 0.25;
  263. deletevehicle _bolovani_blast;
  264. _crater_impact = createVehicle ["CraterLong",[getpos _head_worm select 0,getpos _head_worm select 1,0],[],0,"CAN_COLLIDE"];
  265. _crater_impact setDir (random 360);
  266. sleep 0.5;
  267. deletevehicle _blast_dust;
  268.  
  269. if (player distance _head_worm < 1500) then {
  270. };
  271. sleep 300;
  272. deletevehicle _crater_impact;
  273. };
  274. };
  275.  
  276. Worm_fnc_bump = {
  277. params["_i"];
  278. [_this select 0] spawn
  279. {
  280. if (!hasInterface) exitWith {};
  281.  
  282. _head_worm = _this select 0;
  283.  
  284. _blast_dust = "#particlesource" createVehicleLocal (getPosATL _head_worm);
  285. _blast_dust setParticleCircle [3, [-3, -3, 0]];
  286. _blast_dust setParticleRandom [2, [2, 2, 0], [-15, -15, 0], 5, 1, [0, 0, 0, 1], 1, 0];
  287. _blast_dust setParticleParams [["\A3\data_f\cl_basic", 1, 0, 1], "", "Billboard", 1, 3, [0, 0, 0], [0, 0, 0.1], 7, 10, 7.9, 0.005, [5, 7, 13], [[0.3, 0.27, 0.15, 1], [0.3, 0.27, 0.15, 0.5], [0.3, 0.27, 0.15, 0]], [0.08], 1, 0, "", "", _head_worm];
  288. _blast_dust setDropInterval 0.002;
  289. sleep 0.2;
  290. deleteVehicle _blast_dust;
  291. };
  292. };
  293. } remoteExec["BIS_fnc_call",0];
  294.  
  295. onMapSingleClick
  296. {
  297. if(isNil "isWormActive") then {isWormActive = false;};
  298. if(!isWormActive) then
  299. {
  300. wormMarker = createMarkerLocal["worm_start",_pos];
  301. wormMarker setMarkerType "mil_dot";
  302. wormMarker setMarkerText "Worm Start";
  303. [wormMarker] remoteExec["Worm_fnc_mainFunction",0];
  304. playsound "hint";
  305. isWormActive = true;
  306. }
  307. else
  308. {
  309. deleteMarker wormMarker;
  310. isWormActive = false;
  311. onMapSingleClick{};
  312. };
  313. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement