Advertisement
Abnormal202

Untitled

Jun 9th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.26 KB | None | 0 0
  1. function ice_boss_init()
  2. {
  3. wait(10);
  4. level.boss_damage = 25; //amount of damage boss does
  5. level.boss_damage_time = 0.5; //how much time in between "hits" in seconds
  6. level.boss_damage_radius = 150; //damaging radius
  7. level.speed = 100; //speed variable for boss. Higher number, higher speed.
  8. level.hits_to_kill_boss = 3; //how many hits it takes to get to the center of a tootsie pop. Should be same number as amount of fire traps.
  9. level.seconds_of_silence = 2; //time after boss spawns before he starts chasing people.
  10. level.time_before_bunker_doors_open = 5; //exactly what you think it is
  11. level.ice_time_to_move = 2; //how long various "ice" objects take to move, if they have a script_vector
  12.  
  13.  
  14. level.only_bad_crumbs = false;
  15. ice = GetEntArray("ice","targetname"); //don't touch this. It's what hides the Ice effect intitially.
  16. for(i=0;i<ice.size;i++)
  17. {
  18. ice[i] Hide();
  19. }
  20. wait(5);
  21.  
  22.  
  23.  
  24. thread ice_boss_round( 2 ); //here is where you put the rounds you want to be ice rounds. just copy and past the line and put the number of the round you want inside the parenthesis.
  25. thread ice_boss_round( 4 );
  26. thread ice_boss_round( RandomIntRange( 5, 6 ) ); //you can also randomize between two rounds if you want. In this example he could come at round 5 or 6.
  27. thread ice_boss_round( 7 );
  28.  
  29. thread fire_trap_init();
  30. }
  31. function ice_boss_round( ice_round_number )
  32. {
  33.  
  34. while(1)
  35. {
  36. level waittill( "end_of_round" );
  37. IPrintLnBold("round " + (level.round_number + 1));
  38. if((level.round_number + 1) == ice_round_number)
  39. {
  40. level flag::clear( "spawn_zombies" );
  41. level notify("boss_round");
  42. players = GetPlayers();
  43. ice_round_spawns = Struct::Get_Array("ice_round_spawn","targetname");
  44.  
  45. ice = GetEntArray("ice","targetname");
  46. for(i=0;i<ice.size;i++)
  47. {
  48. ice[i] Show();
  49. if(isDefined(ice[i].script_vector))
  50. {
  51. ice[i] MoveTo(ice[i].origin + ice[i].script_vector, level.ice_time_to_move);
  52. }
  53. }
  54.  
  55.  
  56. for(i=0;i<players.size;i++)
  57. {
  58. players[i] DontInterpolate();
  59. players[i] SetOrigin( ice_round_spawns[i].origin);
  60. players[i] SetPlayerAngles( ice_round_spawns[i].angles );
  61. }
  62. bunker_door = GetEntArray("bunker_door","targetname");
  63. for(i=0;i<bunker_door.size;i++)
  64. {
  65. bunker_door[i] MoveTo(bunker_door[i].origin + bunker_door[i].script_vector, 0.05);
  66. }
  67. wait(level.seconds_of_silence);
  68. thread spawn_ice_boss();
  69. level flag::set( "spawn_zombies" );
  70. wait(level.time_before_bunker_doors_open);
  71. for(i=0;i<bunker_door.size;i++)
  72. {
  73. bunker_door[i] MoveTo(bunker_door[i].origin - bunker_door[i].script_vector, 2);
  74. }
  75. }
  76. else
  77. {
  78. wait(1);
  79. }
  80. }
  81. }
  82. function spawn_ice_boss()
  83. {
  84. level.boss_spawns = Struct::Get_array("boss_spawn","targetname");
  85. rand = RandomIntRange( 0, level.boss_spawns.size );
  86. level.boss = util::spawn_model( "tag_origin", level.boss_spawns[rand].origin);
  87. PlayFxOnTag( BOSS_FX, level.boss, "tag_origin");
  88. level.boss.alive = true;
  89. level.boss.ice_boss = true;
  90. level.boss.hits = 0;
  91.  
  92. wait(2);
  93.  
  94. level.boss thread damage_players();
  95. level.boss thread player_breadcrumbs();
  96. level.boss check_for_da_damage();
  97.  
  98. }
  99. function check_for_da_damage()
  100. {
  101. while(1)
  102. {
  103. level waittill("boss_has_been_hit");
  104. IPrintLnBold("boss_has_been_hit");
  105. wait(1);
  106. if(self.hits == level.hits_to_kill_boss)
  107. {
  108. IPrintLnBold("boss killed");
  109. self notify("boss_dead");
  110. self Delete();
  111. level.bosses_dead ++;
  112. level notify("boss_round_over");
  113. ice = GetEntArray("ice","targetname");
  114. for(i=0;i<ice.size;i++)
  115. {
  116.  
  117. if(isDefined(ice[i].script_vector))
  118. {
  119. ice[i] MoveTo(ice[i].origin - ice[i].script_vector, level.ice_time_to_move);
  120. }
  121. wait(level.ice_time_to_move);
  122. ice[i] Hide();
  123. }
  124. }
  125. else
  126. {
  127. self thread player_breadcrumbs();
  128. }
  129.  
  130. }
  131. }
  132. function fire_trap_init()
  133. {
  134. level.fire_trap_cost = 500; //cost
  135. level.fire_trap_time = 20; //how long it is active for one use
  136. level.trap_cooldown_time = 10; //how long trap is cooling down before you can use it again.
  137.  
  138. trigs = GetEntArray("fire_trap_trig","targetname");
  139. //for(i=0;i<trigs.size;i++)
  140. //{
  141. // trigs[i] SetHintString( &"ZOMBIE_NEED_POWER");
  142. //}
  143. //level flag::wait_till("power_on");
  144. while(1)
  145. {
  146. for(i=0;i<trigs.size;i++)
  147. {
  148. trigs[i] thread activation();
  149. }
  150. level waittill("boss_round");
  151. for(i=0;i<trigs.size;i++)
  152. {
  153. trigs[i] thread boss_round_activation();
  154. }
  155. level waittill("boss_round_over");
  156. }
  157. }
  158. function activation()
  159. {
  160.  
  161. level endon("boss_round");
  162. while(1)
  163. {
  164. self SetHintString( "Press and Hold ^3[{+activate}]^7 to Activate Trap [Cost:" + level.fire_trap_cost + "]");
  165. self waittill("trigger",player);
  166. if(player.score >= level.fire_trap_cost)
  167. {
  168. player zm_score::minus_to_player_score(level.fire_trap_cost);
  169. self SetHintString( "Fire Trap Active");
  170. hurt_trig = GetEnt(self.target,"targetname");
  171. fire_orgs = Struct::Get_Array(hurt_trig.target,"targetname");
  172. for(i=0;i<fire_orgs.size;i++)
  173. {
  174.  
  175. fireorg[i] = util::spawn_model( "tag_origin", fire_orgs[i].origin);
  176. PlayFxOnTag( FIRE_TRAP_FX, fireorg[i], "tag_origin");
  177. //IPrintLnBold(fireorg[i].origin);
  178. fireorg[i] thread firetrap_check_yo_self();
  179. }
  180. hurt_trig thread check_for_creatures();
  181. wait(level.fire_trap_time);
  182. hurt_trig notify("trap_over");
  183. for(i=0;i<fire_orgs.size;i++)
  184. {
  185. fireorg[i] notify("trap_over");
  186. fireorg[i] Delete();
  187. }
  188. wait(level.trap_cooldown_time);
  189. }
  190. wait(0.05);
  191. }
  192. }
  193. function firetrap_check_yo_self()
  194. {
  195. self endon("trap_over");
  196. level waittill("boss_round");
  197. self Delete();
  198. }
  199. function boss_round_activation()
  200. {
  201.  
  202. self SetHintString( "Press and Hold ^3[{+activate}]^7 to Activate Trap");
  203. self waittill("trigger",player);
  204.  
  205. self SetHintString( "Fire Trap Active");
  206. hurt_trig = GetEnt(self.target,"targetname");
  207. hurt_trig.already_got_him = false;
  208. fire_orgs = Struct::Get_Array(hurt_trig.target,"targetname");
  209. for(i=0;i<fire_orgs.size;i++)
  210. {
  211.  
  212. fireorg[i] = util::spawn_model( "tag_origin", fire_orgs[i].origin);
  213. IPrintLnBold(fireorg[i].origin);
  214. PlayFxOnTag( FIRE_TRAP_FX, fireorg[i], "tag_origin");
  215. }
  216. hurt_trig thread check_for_creatures();
  217. hurt_trig thread check_for_trap();
  218. wait(level.fire_trap_time);
  219. hurt_trig notify("trap_over");
  220. for(i=0;i<fire_orgs.size;i++)
  221. {
  222. fireorg[i] Delete();
  223. }
  224. self SetHintString( "Trap Already Used");
  225. if(hurt_trig.already_got_him == false)
  226. {
  227. self thread boss_round_activation();
  228. }
  229. }
  230. function check_for_creatures()
  231. {
  232. level endon("boss_round");
  233. self endon("trap_over");
  234. while(1)
  235. {
  236. self waittill("trigger",ent);
  237.  
  238. ent DoDamage( ent.health + 666, ent.origin);
  239.  
  240. wait(0.05);
  241. }
  242.  
  243. }
  244. function check_for_trap()
  245. {
  246. self endon("trap_over");
  247. while(1)
  248. {
  249. if( level.boss IsTouching(self) && self.already_got_him == false)
  250. {
  251. level.boss.hits ++;
  252. self.already_got_him = true;
  253. level notify("boss_has_been_hit");
  254. level.boss MoveTo(level.boss.origin, 1);
  255. }
  256. wait(0.05);
  257.  
  258. }
  259. }
  260. function damage_players()
  261. {
  262.  
  263. while(self.alive)
  264. {
  265. players_to_hurt = util::get_array_of_closest( self.origin, level.players , undefined , undefined, level.boss_damage_radius);
  266. foreach(player in players_to_hurt)
  267. {
  268. player DoDamage(level.boss_damage, self.origin);
  269. player ASMSetAnimationRate(0.8);
  270. player SetMoveSpeedScale(0.8);
  271. player thread back_to_normal();
  272. }
  273. wait(level.boss_damage_time);
  274. }
  275. }
  276. function back_to_normal()
  277. {
  278. while(1)
  279. {
  280. dist = Distance( self.origin, level.boss.origin );
  281. if(dist > level.boss_damage_radius)
  282. {
  283. self ASMSetAnimationRate(1);
  284. self SetMoveSpeedScale(1);
  285. break;
  286. }
  287. wait(0.05);
  288. }
  289. }
  290. function player_breadcrumbs()
  291. {
  292. level endon("boss_has_been_hit");
  293. distraction_points = Struct::Get_Array("ice_boss_distraction","targetname");
  294. rand = randomintrange( 0, distraction_points.size);
  295. while(1)
  296. {
  297. players = GetPlayers();
  298. self endon("boss_dead");
  299.  
  300. for(i=0;i<players.size;i++)
  301. {
  302. if(players[i].laststand != true)
  303. {
  304. level.crumbs[i] = util::spawn_model( "tag_origin", players[i].origin + (0,0,40));
  305. }
  306. else
  307. {
  308. IPrintLnBold("anus");
  309.  
  310. dist = Distance( self.origin, distraction_points[rand].origin );
  311. time = dist / level.speed;
  312. level.boss MoveTo( distraction_points[rand].origin, time);
  313. continue;
  314. }
  315. }
  316. good_to_go = false;
  317. times_looped = 0;
  318. while(good_to_go == false)
  319. {
  320. if(times_looped == level.players.size)
  321. {
  322. IPrintLnBold("break");
  323. level.only_bad_crumbs = true;
  324. break;
  325. }
  326. good_crumb = ArrayGetClosest( self.origin, level.crumbs );
  327. if(BulletTracePassed( self.origin, good_crumb.origin, false, false ))
  328. {
  329. good_crumb thread go_to_closest();
  330. good_to_go = true;
  331. }
  332. else
  333. {
  334. good_crumb Delete();
  335. IPrintLnBold("bad crumb deleted");
  336. }
  337. times_looped ++;
  338. }
  339. wait(0.5);
  340. }
  341.  
  342. }
  343. function go_to_closest()
  344. {
  345. level endon("boss_has_been_hit");
  346. dist = Distance( self.origin, level.boss.origin );
  347. time = dist / level.speed;
  348.  
  349. level.boss MoveTo( self.origin, time);
  350.  
  351.  
  352. wait(1);
  353.  
  354. if(level.only_bad_crumbs == false)
  355. {
  356. IprintlnBold("deletre");
  357. for(i=0;i<level.crumbs.size;i++)
  358. {
  359. level.crumbs[i] Delete();
  360. }
  361. }
  362.  
  363. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement