daily pastebin goal
93%
SHARE
TWEET

Untitled

KhelMho Jan 12th, 2018 69 in 25 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include maps\_utility;
  2. #include common_scripts\utility;
  3. #include maps\_zombiemode_utility;
  4.  
  5. //1-26-15: rewrite script to save entities and improve simplicity
  6. //1-30-15: modified script and implemented proxftw's changes
  7. //2-8-15: modified script to support multiple drops with the same score requirement
  8. //2-17-15: improved hud function
  9. //27-03-2015: BluntStuffy, Srry!!! made 2 small edits to get dev-mode running. Both marked with: BluntStuffy Edit:
  10. //8-15-15: fixed zombie blood, minigun, and random weapon conflicts with quick revive
  11.  
  12. init()
  13. {
  14.     level.max_multi_drops = 2; //amount of drops that can spawn simultaneously through collateral damage/explosions
  15.     level.multi_drop_time = .1; //amount of time after zombie death before multi drops are inactive
  16.  
  17.     //waw powerups
  18.     //name, model, player_vox, player_vox_num, devil_vox, rarity_num, shader, hint, on_fx, grab_fx, wave_fx, single_client, electricity
  19.     thread add_powerup("nuke", "zombie_bomb", "vox_powerup_nuke", 3, "nukebomb_vox", 5, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
  20.     thread add_powerup("insta_kill", "zombie_skull", "vox_powerup_insta", 3, "instakill_vox", 0, "comic_specialty_instakill_zombies", undefined, undefined, undefined, undefined, undefined, undefined);
  21.     thread add_powerup("double_points", "zombie_x2_icon", "vox_powerup_double", 3, "doublepoints_vox", 0, "comic_specialty_2x_zombies", undefined, undefined, undefined, undefined, undefined, undefined);
  22.     //thread add_powerup("full_ammo", "zombie_ammocan", "vox_powerup_ammo", 3, "maxammo_vox", 5, undefined, &"ZOMBIE_POWERUP_MAX_AMMO", undefined, undefined, undefined, undefined, undefined);
  23.     //thread add_powerup("carpenter", "zombie_carpenter", "vox_powerup_carp", 3, "carpenter_vox", 5, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
  24.  
  25.     //custom powerups
  26.     /*thread add_powerup("firesale", "bo_zombie_firesale", undefined, 1, "firesale_vox", 2, "comic_specialty_zombie_firesale_zombies", undefined, undefined, undefined, undefined, undefined, true);*/
  27.     thread add_powerup("zombie_blood", "bo2_p6_zm_tm_blood_power_up", undefined, 1, "zombie_blood_vox", 2, "comic_specialty_zombie_blood_zombies", undefined, "solo_powerup_on", "solo_powerup_grabbed", "solo_powerup_grabbed_wave", true, undefined);
  28.     thread add_powerup("minigun", "bo_zombie_pickup_minigun", undefined, undefined, "death_machine_vox", 2, "comic_specialty_deathmachine_zombies", undefined, "solo_powerup_on", "solo_powerup_grabbed", "solo_powerup_grabbed_wave", true, true);
  29.     thread add_powerup("bonus_points", "bo_zombie_z_money_icon", undefined, 1, "zombie_cash_vox", 0, undefined, undefined, "solo_powerup_on", "solo_powerup_grabbed", "solo_powerup_grabbed_wave", true, undefined);
  30.     /*thread add_powerup("gtlad", "bo_zombie_pickup_perk_bottle", undefined, undefined, undefined, 0, undefined, undefined, undefined, undefined, undefined, undefined, undefined);*/
  31.  
  32.     //models
  33.     precachemodel("zombie_bomb");
  34.     precachemodel("zombie_skull");
  35.     precachemodel("zombie_x2_icon");
  36.     precachemodel("zombie_ammocan");
  37.     precachemodel("zombie_carpenter");
  38.     precachemodel("bo_zombie_pickup_minigun");
  39.     precachemodel("bo_zombie_firesale");
  40.     precachemodel("bo_zombie_z_money_icon");
  41.     precachemodel("bo2_p6_zm_tm_blood_power_up");
  42.     precachemodel("bo_zombie_pickup_perk_bottle");
  43.  
  44.     //shaders
  45.     PrecacheShader( "comic_specialty_2x_zombies" );
  46.     PrecacheShader( "comic_specialty_instakill_zombies" );
  47.     PrecacheShader( "comic_specialty_deathmachine_zombies" );
  48.     PrecacheShader( "comic_specialty_zombie_firesale_zombies" );
  49.     PrecacheShader( "comic_specialty_zombie_blood_zombies" );
  50.  
  51.     //fx
  52.     /*level._effect["powerup_on"] = loadfx( "misc/fx_zombie_powerup_on" );*/
  53.     level._effect["powerup_on_red"] = loadfx( "misc/fx_zombie_powerup_on_red" );
  54.     /*level._effect["powerup_grabbed"] = loadfx( "misc/fx_zombie_powerup_grab" );*/
  55.     /*level._effect["powerup_grabbed_wave"] = loadfx( "misc/fx_zombie_powerup_wave" );*/
  56.     level._effect["solo_powerup_on"] = loadfx( "misc/fx_zombie_powerup_on_solo" );
  57.     level._effect["solo_powerup_grabbed"] = loadfx( "misc/fx_zombie_powerup_grab_solo" );
  58.     level._effect["solo_powerup_grabbed_wave"] = loadfx( "misc/fx_zombie_powerup_wave_solo" );
  59.     level._effect["mini_nuke"] = loadfx( "misc/fx_zombie_mini_nuke" );
  60.  
  61.     level thread watch_for_drop();
  62.     level thread random_powerup_loop();
  63.     level thread init_player_zombie_vars(); // Prevents possible issues
  64.  
  65.     level thread on_player_connect(); //otw 8-15-15: set player variables if necessary
  66.  
  67.     level.powerup_history = [];
  68.     level.valid_powerups = [];
  69.     level.current_powerups = 0;
  70.     level.zombie_drop_point = [];
  71.  
  72.     //vars
  73.     set_zombie_var( "zombie_powerup_drop_increment", 1000); // lower this to make drop happen more often (default 2000)
  74.     set_zombie_var( "zombie_insta_kill", 0);
  75.     set_zombie_var( "zombie_point_scalar", 1 );
  76.     set_zombie_var( "zombie_timer_offset", 350);    // hud offsets
  77.     set_zombie_var( "zombie_timer_offset_interval", 30 );
  78.     set_zombie_var( "zombie_powerup_insta_kill_on", false );
  79.     set_zombie_var( "zombie_powerup_point_doubler_on", false );
  80.     set_zombie_var( "zombie_powerup_point_doubler_time", 30 ); // length of point doubler
  81.     set_zombie_var( "zombie_powerup_insta_kill_time", 30 ); // length of insta kill
  82.     /*set_zombie_var( "FireSaleOn", false );
  83.     set_zombie_var( "ZombFireSale", 0 );
  84.     set_zombie_var( "FireSaleTime", 30 );*/
  85. }
  86.  
  87. powerup_function_run(entity, name, player) //run custom functions here, use player variable if necessary, if you're using the entity don't thread (gets deleted)
  88. {
  89.     switch(name)
  90.     {
  91.         //waw powerups
  92.         case "carpenter":
  93.             level carpenter_func(entity);
  94.             break;
  95.  
  96.         case "double_points":
  97.             level double_points_func();
  98.             break;
  99.  
  100.         case "full_ammo":
  101.             level full_ammo_func();
  102.             break;
  103.  
  104.         case "insta_kill":
  105.             level insta_kill_func();
  106.             break;
  107.  
  108.         case "nuke":
  109.             level nuke_func(entity);
  110.             break;
  111.  
  112.         //custom powerups
  113.         case "minigun":
  114.             player minigun();
  115.             break;
  116.  
  117.         case "zombie_blood":
  118.             player zombie_blood();
  119.             break;
  120.  
  121.         case "bonus_points":
  122.             player giverandpoints();
  123.             break;
  124.  
  125.         /*case "firesale":
  126.             level firesale();
  127.             break;*/
  128.  
  129.         /*case "gtlad":
  130.             level gtlad_powerup();
  131.             break;*/
  132.  
  133.         default:
  134.             break; 
  135.     }
  136. }
  137.  
  138. powerup_function_check(name) //additional function checks here to validate powerup
  139. {
  140.     switch(name)
  141.     {
  142.         case "carpenter":
  143.             if(!carpenter_func_check())
  144.             {
  145.                 return false;
  146.             }
  147.             break;
  148.  
  149.         case "minigun":
  150.             if(minigunnodrop())
  151.             {
  152.                 //iprintlnbold("minigun invalid");
  153.                 return false;
  154.             }
  155.             break;
  156.  
  157.         /*case "firesale":
  158.             if(flag("moving_chest_now") || level.zombie_vars["ZombFireSale"] || level.zombie_vars["FireSaleOn"])
  159.             {
  160.                 //iprintlnbold("firesale invalid");
  161.                 return false;
  162.             }
  163.             break;*/
  164.  
  165.         default:
  166.             break;
  167.     }
  168.     //iprintlnbold("passed function check");
  169.     return true;
  170. }
  171.  
  172. pass_laststand_check(name) //otw 8-15-15: prevent certain drops from doing anything while in laststand
  173. {
  174.     if(!self maps\_laststand::player_is_in_laststand() && isdefined(self.inStand) && self.inStand == false) //otw 8-15-15: checks if player isn't in last stand, solo qr check as well
  175.     {
  176.         //iprintlnbold("player isn't in last stand");
  177.         return true; //powerup is accepted if not in laststand
  178.     }
  179.     if(name == "minigun")
  180.     {
  181.         return false;
  182.     }
  183.     //iprintlnbold("powerup accepted");
  184.     return true; //powerup is accepted in laststand
  185. }
  186.  
  187. powerup_spawn(index, name, model, player_vox, player_vox_num, devil_vox, shader, hint, fx_0, fx_1, fx_2, single_client, origin) //specify origin to force drop
  188. {
  189.     powerup = powerup_entity(index, model, origin);
  190.     powerup powerup_sound();
  191.     powerup thread powerup_wobble(fx_0);
  192.     powerup thread powerup_timeout();
  193.     player = powerup powerup_grab(fx_1, fx_2);
  194.     if(isdefined(player) && player pass_laststand_check(name))
  195.     {
  196.         //iprintlnbold("powerup grabbed");
  197.         player thread powerup_vo(player_vox, player_vox_num);
  198.         level thread play_devil_dialog(devil_vox, player, single_client);
  199.         level thread powerup_shader_init(shader, player, single_client);
  200.         level thread powerup_hint_func(hint);
  201.         level thread powerup_function_run(powerup, name, player); //run custom code
  202.     }
  203.     //iprintlnbold("delete powerup");
  204.     powerup delete();
  205. }
  206.  
  207. add_powerup(name, model, player_vox, player_vox_num, devil_vox, rarity_num, shader, hint, fx_0, fx_1, fx_2, single_client, electricity)
  208. {
  209.     for (i = 0; i < level.max_multi_drops; i++)
  210.     {
  211.         level thread wait_for_drop_notify(i, name, model, player_vox, player_vox_num, devil_vox, rarity_num, shader, hint, fx_0, fx_1, fx_2, single_client, electricity);
  212.     }
  213. }
  214.  
  215. wait_for_drop_notify(index, name, model, player_vox, player_vox_num, devil_vox, rarity_num, shader, hint, fx_0, fx_1, fx_2, single_client, electricity)
  216. {
  217.     level endon("disconnect");
  218.     while(1)
  219.     {
  220.         level waittill("powerup_init_" + index);
  221.         //iprintlnbold("notify recieved");
  222.         size = validate_powerup(index, name, rarity_num, electricity); //add valid powerups to array
  223.         if(size == 0)
  224.         {
  225.             continue; //no valid powerups, restart
  226.         }
  227.         level waittill("powerup_drop_" + index);
  228.  
  229.         if(level.random_powerup[index] != name)
  230.         {
  231.             continue; //ignore powerups that haven't been chosen
  232.         }
  233.         //iprintln(name);
  234.  
  235.         level.powerup_history[level.powerup_history.size] = name; //remember powerup
  236.         level.random_powerup[index] = undefined;
  237.         if(index == 0) //valid_powerups are only remembered for this index
  238.         {
  239.             level.valid_powerups = []; //restore the valid powerup array for next time
  240.         }
  241.     }
  242. }
  243.  
  244. watch_for_drop()
  245. {
  246.     flag_wait( "all_players_connected" );
  247.     players = get_players();
  248.     score_to_drop = ( players.size * level.zombie_vars["zombie_score_start"] ) + level.zombie_vars["zombie_powerup_drop_increment"];
  249.     //iprintln(score_to_drop);
  250.    
  251.     hint = undefined;
  252.     level endon("disconnect");
  253.     while (1)
  254.     {
  255.         wait( 0.5 );
  256.         curr_total_score = 0;
  257.         players = get_players();
  258.         for (i = 0; i < players.size; i++)
  259.         {
  260.             curr_total_score += players[i].score_total;
  261.         }
  262.         if (curr_total_score > score_to_drop)
  263.         {
  264.         //  iprintlnbold("drop score valid");
  265.             wait_for_inactive_powerup(); //make sure the index isn't already active
  266.  
  267.             level.zombie_vars["zombie_powerup_drop_increment"] *= 1.14;
  268.             score_to_drop = curr_total_score + level.zombie_vars["zombie_powerup_drop_increment"];
  269.             //iprintln(score_to_drop);
  270.             level.drop_powerup = true;
  271.             hint = undefined;
  272.  
  273.             level waittill("powerup_drop_" + 0); //first drop controls variable
  274.             wait level.multi_drop_time; //add delay for multi drops to occur
  275.             level.drop_powerup = undefined;
  276.         }
  277.         else if(curr_total_score <= score_to_drop && !isdefined(hint))
  278.         {
  279.         //  iprintlnbold("drop score invalid");
  280.             hint = true;
  281.         }
  282.     }
  283. }
  284.  
  285. powerup_drop(origin, entity, force) //the most recent zombie death location is chosen for the drop.
  286. {
  287.     if(!isdefined(force) && (!isdefined(level.drop_powerup) || !is_in_playable_area(entity)))
  288.     {
  289.     //  iprintlnbold("drop variable rejected");
  290.         return;
  291.     }
  292.     //iprintln(origin);
  293.  
  294.     count = level.current_powerups; //remember variable
  295.     //iprintln(count);
  296.  
  297.     for (i = 0; i < level.max_multi_drops; i++)
  298.     {
  299.         if(count == i)
  300.         {
  301.             //iprintln(i);
  302.             level.current_powerups += 1;
  303.             level.zombie_drop_point[i] = origin;
  304.             level notify("powerup_init_" + i); //notify to threads with specific index
  305.             level waittill("powerup_drop_" + i);
  306.             level.current_powerups -= 1;
  307.         }
  308.     }
  309. }
  310.  
  311. force_random_powerup(origin, entity)
  312. {
  313.     wait_for_inactive_powerup();
  314.     level powerup_drop(origin, entity, true); //true variable to force
  315. }
  316.  
  317. force_powerup(name, model, player_vox, player_vox_num, devil_vox, shader, hint, fx_0, fx_1, fx_2, single_client, origin)
  318. {
  319.     wait_for_inactive_powerup();
  320.     level powerup_spawn(0, name, model, player_vox, player_vox_num, devil_vox, shader, hint, fx_0, fx_1, fx_2, single_client, origin);
  321. }
  322.  
  323. wait_for_inactive_powerup() //prevents conflicts when initiating a new powerup
  324. {
  325.     level endon("disconnect");
  326.     while(level.current_powerups > 0) //wait for active powerups to clear
  327.     {
  328.         wait .1;
  329.     }
  330. }
  331.  
  332. random_powerup_loop()
  333. {  
  334.     wait 0.5;                       // BluntStuffy Edit: a small wait to prevent ' size cannot be applied to undefined ' making dev-mode crash at launch
  335.     level.random_powerup = [];
  336.     level endon("disconnect");
  337.     while(1)
  338.     {
  339.         size_0 = level.valid_powerups.size;
  340.         wait .1;
  341.         size_1 = level.valid_powerups.size;
  342.         if(level.valid_powerups.size != 0 && size_0 == size_1) //array has finished updating
  343.         {
  344.             for (i = 0; i < level.max_multi_drops; i++)
  345.             {
  346.                 level.random_powerup[i] = level.valid_powerups[RandomInt(level.valid_powerups.size)]; //index additional random drops
  347.                 level notify("powerup_drop_" + i); //notify drop with index
  348.             }
  349.         }
  350.     }
  351. }
  352.  
  353. validate_powerup(index, name, rarity_num, electricity)
  354. {
  355.     if(is_powerup_valid(index, name, rarity_num, electricity) && index == 0) //only create a valid powerup array for one thread
  356.     {
  357.         level.valid_powerups[level.valid_powerups.size] = name; //get an array of all valid powerups
  358.     }
  359.     wait .1; //give time for all threads to update array
  360.  
  361.     //iprintln(level.valid_powerups.size);
  362.     return level.valid_powerups.size;
  363. }
  364.  
  365. is_powerup_valid(index, name, rarity_num, electricity) //multiple checks done here to validate powerup
  366. {
  367.     if(isdefined(electricity) && !flag("electricity_on"))
  368.     {
  369.         //iprintlnbold("electricity reject");
  370.         return false;
  371.     }
  372.     if(!history_check(name, rarity_num))
  373.     {
  374.         //iprintlnbold("history reject");
  375.         return false;
  376.     }
  377.     if(!powerup_function_check(name))
  378.     {
  379.         //iprintlnbold("powerup function reject");
  380.         return false;
  381.     }
  382.     return true;   
  383. }
  384.  
  385. history_check(name, count)
  386. {
  387.     if(!isdefined(count) || isdefined(count) && (count == 0 || level.powerup_history.size <= count)) //powerup history insufficient
  388.     {
  389.         //iprintlnbold("unrestricted powerup");
  390.         return true;
  391.     }
  392.     size = level.powerup_history.size;
  393.     for(i = size - count; i < size; i++)
  394.     {
  395.         if(level.powerup_history[i] == name) //powerup has been seen before exceeding count
  396.         {
  397.             //iprintlnbold("powerup seen recently");
  398.             return false;
  399.         }
  400.     }
  401.     return true;
  402. }
  403.  
  404. is_in_playable_area(entity) //check if the most recent zombie death location is in playable area
  405. {
  406.     playable_area = getentarray("playable_area","targetname");
  407.     for (i = 0; i < playable_area.size; i++)
  408.     {
  409.         if (entity istouching(playable_area[i]))
  410.         {
  411.             return true;
  412.         }
  413.     }
  414.     //iprintlnbold("not in playable area");
  415.     return false;
  416. }
  417.  
  418. powerup_entity(index, model, origin)
  419. {
  420.     if(!isdefined(origin))
  421.     {
  422.         origin = level.zombie_drop_point[index];
  423.     }
  424.     entity = spawn("script_model", origin + (0,0,40));
  425.     entity SetModel(model);
  426.     //iprintln(entity.model);
  427.     //iprintln(origin);
  428.     return entity;
  429. }
  430.  
  431. powerup_sound()
  432. {
  433.     playsoundatposition("spawn_powerup", self.origin);
  434.     self PlayLoopSound("spawn_powerup_loop");
  435. }
  436.  
  437. powerup_wobble(powerup_on_fx)
  438. {
  439.     self endon ("powerup_grabbed");
  440.     self endon ("powerup_timedout");
  441.  
  442.     fx = "powerup_on";
  443.    
  444.     if (isdefined(self.redfx) ) //redspace
  445.         fx = "powerup_on_red";
  446.    
  447.     if(isdefined(powerup_on_fx))
  448.     {
  449.         fx = powerup_on_fx;
  450.     }
  451.  
  452.     if (isdefined(self))
  453.     {
  454.         playfxontag (level._effect[fx], self, "tag_origin");
  455.     }
  456.  
  457.     while (isdefined(self))
  458.     {
  459.         waittime = randomfloatrange(2.5, 5);
  460.         yaw = RandomInt( 360 );
  461.         if( yaw > 300 )
  462.         {
  463.             yaw = 300;
  464.         }
  465.         else if( yaw < 60 )
  466.         {
  467.             yaw = 60;
  468.         }
  469.         yaw = self.angles[1] + yaw;
  470.         self rotateto ((-60 + randomint(120), yaw, -45 + randomint(90)), waittime, waittime * 0.5, waittime * 0.5);
  471.         wait randomfloat (waittime - 0.1);
  472.     }
  473. }
  474.  
  475. powerup_timeout()
  476. {
  477.     self endon ("powerup_grabbed");
  478.  
  479.     wait 15;
  480.  
  481.     for (i = 0; i < 40; i++)
  482.     {
  483.         // hide and show
  484.         if (i % 2)
  485.         {
  486.             self hide();
  487.         }
  488.         else
  489.         {
  490.             self show();
  491.         }
  492.  
  493.         if (i < 15)
  494.         {
  495.             wait 0.5;
  496.         }
  497.         else if (i < 25)
  498.         {
  499.             wait 0.25;
  500.         }
  501.         else
  502.         {
  503.             wait 0.1;
  504.         }
  505.     }
  506.  
  507.     self notify ("powerup_timedout");
  508.     self delete();
  509. }
  510.  
  511. powerup_vo(player_vox, player_vox_num) //updated to support custom player vox variants
  512. {
  513.     if(!isdefined(player_vox))
  514.     {
  515.         return;
  516.     }
  517.     self endon("death");
  518.     self endon("disconnect");
  519.    
  520.     index = maps\_zombiemode_weapons::get_player_index(self);
  521.     sound = undefined;
  522.    
  523.     if(!isdefined (level.player_is_speaking))
  524.     {
  525.         level.player_is_speaking = 0;
  526.     }
  527.    
  528.     wait(randomfloatrange(1,2));
  529.  
  530.     sound = "plr_" + index + "_" + player_vox + "_" + randomintrange(0, player_vox_num);
  531.     //iprintln(sound);
  532.    
  533.     //This keeps multiple voice overs from playing on the same player (both killstreaks and headshots).
  534.     if (level.player_is_speaking != 1 && isDefined(sound))
  535.     {  
  536.         level.player_is_speaking = 1;
  537.         self playsound(sound, "sound_done");           
  538.         self waittill("sound_done");
  539.         level.player_is_speaking = 0;
  540.     }
  541.     else
  542.     {
  543.         //iprintlnbold("player already speaking");
  544.     }
  545. }
  546.  
  547. powerup_grab(powerup_grab_fx, powerup_grab_wave_fx)
  548. {
  549.     self endon ("powerup_timedout");
  550.  
  551.     fx_0 = "powerup_grabbed";
  552.     fx_1 = "powerup_grabbed_wave";
  553.     if(isdefined(powerup_grab_fx))
  554.     {
  555.         fx_0 = powerup_grab_fx;
  556.     }
  557.     if(isdefined(powerup_grab_wave_fx))
  558.     {
  559.         fx_1 = powerup_grab_wave_fx;
  560.     }
  561.  
  562.     player = undefined; //otw edit
  563.     while (isdefined(self))
  564.     {
  565.         players = get_players();
  566.  
  567.         for (i = 0; i < players.size; i++)
  568.         {
  569.             if (distance (players[i].origin, self.origin) < 64)
  570.             {
  571.                 player = players[i]; //otw edit: get player that grabbed powerup
  572.  
  573.                 playfx (level._effect[fx_0], self.origin);
  574.                 playfx (level._effect[fx_1], self.origin); 
  575.  
  576.                 wait( 0.1 );
  577.  
  578.                 playsoundatposition("powerup_grabbed", self.origin);
  579.                 self stoploopsound();
  580.             }
  581.         }
  582.         if(isdefined(player))
  583.         {
  584.             self notify ("powerup_grabbed");
  585.             break;
  586.         }
  587.         wait 0.1;
  588.     }
  589.     return player; //otw edit: return player that grabbed powerup
  590. }
  591.  
  592. powerup_shader_init(shader, player, single_client) //create the hud elements, single_client is true if only the powerup grabber gets the shader
  593. {
  594.     if(!isdefined(shader))
  595.     {
  596.         return;
  597.     }
  598.     if(isdefined(single_client)) //powerup is player specific
  599.     {
  600.         //iprintlnbold("single player hud");
  601.         player shader_func(shader);
  602.     }
  603.     else //create a hud element for all players
  604.     {
  605.         //iprintlnbold("all players hud");
  606.         players = get_players();
  607.         for (i = 0; i < players.size; i++)
  608.         {
  609.             players[i] thread shader_func(shader);
  610.         }
  611.     }
  612. }
  613.  
  614. shader_func(shader)
  615. {
  616.     hud = undefined;
  617.        
  618.     if(!isdefined(self.powerup_hud))
  619.     {
  620.         self.powerup_hud = [];
  621.     }
  622.     hud = self is_shader_active(shader);
  623.     if(isdefined(hud))
  624.     {
  625.         //iprintlnbold("reset timer");
  626.         hud.timer = 30; //reset time to default
  627.         return;
  628.     }
  629.  
  630.     hud = self create_powerup_hud(shader);
  631.     hud thread shader_flash();
  632.     hud thread shader_offset(self, self get_shader_index(hud), self.powerup_hud.size);
  633.     hud shader_countdown();
  634.     hud destroy();
  635.     self remove_shader_from_array(shader);
  636. }
  637.  
  638. create_powerup_hud(shader) //self is the player
  639. {
  640.     hud = create_simple_hud(self); //create client hud
  641.     if ( shader == "comic_specialty_deathmachine_zombies" )
  642.         self.dmhud = hud;
  643.     else if ( shader == "comic_specialty_zombie_blood_zombies" )
  644.         self.zbhud = hud;
  645.        
  646.     hud.shader = shader; //shader
  647.     hud.timer = 30; //timer
  648.     self.powerup_hud[self.powerup_hud.size] = hud;
  649.  
  650.     hud.foreground = true;
  651.     hud.sort = 2;
  652.     hud.hidewheninmenu = false;
  653.     hud.alignX = "center";
  654.     hud.alignY = "bottom";
  655.     hud.horzAlign = "center";
  656.     hud.vertAlign = "bottom";
  657.     hud.x = self get_hud_offset(hud);
  658.     hud.y = hud.y - 35;
  659.     hud.alpha = 0.8;
  660.     hud setshader(shader, 32, 32);
  661.  
  662.     //iprintln(self.powerup_hud.size);
  663.     return hud;
  664. }
  665.  
  666. shader_flash() //using a default 30s time
  667. {
  668.     level endon("disconnect");
  669.     while(isdefined(self) && self.timer > 0)
  670.     {
  671.         if(self.timer < 5)
  672.         {
  673.             wait(0.1);     
  674.             self.alpha = 0; //make the shader invisible
  675.             wait(0.1);
  676.             self.alpha = 1; //make the shader visible
  677.         }
  678.         else if(self.timer < 10)
  679.         {
  680.             wait(0.2);
  681.             self.alpha = 0;
  682.             wait(0.18);
  683.             self.alpha = 1;
  684.         }
  685.         self.alpha = 1;
  686.         wait(0.01);
  687.     }
  688. }
  689.  
  690. shader_offset(player, index, size)
  691. {
  692.     level endon("disconnect");
  693.     while(isdefined(self) && self.timer > 0)
  694.     {
  695.         if(player get_shader_index(self) != index || player.powerup_hud.size != size) //index or size changed, update x offset
  696.         {
  697.             //iprintlnbold("shader offset updated");
  698.             index = player get_shader_index(self);
  699.             size = player.powerup_hud.size;
  700.             self.x = player get_hud_offset(self);
  701.         }
  702.         wait .05;
  703.     }
  704. }
  705.  
  706. shader_countdown()
  707. {
  708.     level endon("disconnect");
  709.     while(isdefined(self) && self.timer > 0)
  710.     {
  711.         wait 1;
  712.         self.timer --;
  713.         //iprintln(self.timer);
  714.     }
  715. }
  716.  
  717. is_shader_active(shader)
  718. {
  719.     for (i = 0; i < self.powerup_hud.size; i++)
  720.     {
  721.         if(self.powerup_hud[i].shader == shader)
  722.         {
  723.             return self.powerup_hud[i];
  724.         }
  725.     }
  726.     return undefined;
  727. }
  728.  
  729. remove_shader_from_array(shader)
  730. {
  731.     for (i = 0; i < self.powerup_hud.size; i++)
  732.     {
  733.         if(self.powerup_hud[i].shader == shader)
  734.         {
  735.             self.powerup_hud = array_remove(self.powerup_hud, self.powerup_hud[i]);
  736.         }
  737.     }
  738. }
  739.  
  740. get_shader_index(entity)
  741. {
  742.     for (i = 0; i < self.powerup_hud.size; i++)
  743.     {
  744.         if(self.powerup_hud[i] == entity)
  745.         {
  746.             return i;
  747.         }
  748.     }
  749.     return undefined;
  750. }
  751.  
  752.  
  753.  
  754. get_hud_offset(hud) //using index number for x offsets, self is player
  755. {
  756.     index = get_shader_index(hud);
  757.     if(self.powerup_hud.size == 1) //if there is only one shader, use a 0 offset
  758.     {
  759.         index = undefined;
  760.     }
  761.     x = undefined;
  762.     switch(index) //currently supports 10 active shaders, newest powerup uses the next highest index
  763.     {
  764.         case 0:
  765.             x = -24; //close together
  766.             break;
  767.         case 1:
  768.             x = 24;
  769.             break;
  770.         case 2:
  771.             x = -72;
  772.             break;
  773.         case 3:
  774.             x = 72;
  775.             break;
  776.         case 4:
  777.             x = -120;
  778.             break;
  779.         case 5:
  780.             x = 120;
  781.             break;
  782.         case 6:
  783.             x = -168;
  784.             break;
  785.         case 7:
  786.             x = 168;
  787.             break;
  788.         case 8:
  789.             x = -216; //far apart
  790.             break;
  791.         case 9:
  792.             x = 216;
  793.             break;
  794.  
  795.         default: //center, undefined
  796.             x = 0;
  797.             break; 
  798.     }
  799.     //iprintln(x);
  800.     return x;  
  801. }
  802.  
  803. powerup_hint_func(hint) //this is the old full_ammo_on_hud() function for the most part
  804. {
  805.     if(!isdefined(hint))
  806.     {
  807.         return;
  808.     }
  809.     time = 1.5;
  810.     // set up the hudelem
  811.     hudelem = maps\_hud_util::createFontString( "default", 2 );
  812.     hudelem maps\_hud_util::setPoint( "TOP", undefined, 0, level.zombie_vars["zombie_timer_offset"] - (level.zombie_vars["zombie_timer_offset_interval"] * 2));
  813.     hudelem.sort = 0.5;
  814.     hudelem.alpha = 0;
  815.     hudelem fadeovertime(0.5);
  816.     hudelem.alpha = 1;
  817.     hudelem.label = hint;
  818.     wait 0.5;
  819.     hudelem FadeOverTime(time);
  820.     hudelem MoveOverTime(time);
  821.     hudelem.y = 270;
  822.     hudelem.alpha = 0;
  823.     wait time;
  824.     hudelem destroy();
  825. }
  826.  
  827. //devil dialog
  828.  
  829. play_devil_dialog(devil_vox, player, single_client)
  830. {
  831.     if(!isdefined(devil_vox))
  832.     {
  833.         return;
  834.     }
  835.     if(!IsDefined(level.devil_is_speaking))
  836.     {
  837.         level.devil_is_speaking = 0;
  838.     }
  839.     if(devil_vox == "nukebomb_vox") //fix to remove devil_dialog_delay()
  840.     {
  841.         wait(1.8);
  842.     }
  843.     if(level.devil_is_speaking == 0)
  844.     {
  845.         level.devil_is_speaking = 1;
  846.         if(isdefined(single_client))
  847.         {
  848.             player playlocalsound(devil_vox); //only play sound for client
  849.         }
  850.         else
  851.         {
  852.             play_sound_2D(devil_vox);
  853.         }
  854.         wait 2.0;
  855.         level.devil_is_speaking = 0;
  856.     }  
  857. }
  858.  
  859. //powerup functions
  860.  
  861. //carpenter
  862.  
  863. carpenter_func_check()
  864. {
  865.     if(get_num_window_destroyed() < 5)
  866.     {
  867.         return false;
  868.     }
  869.     return true;
  870. }
  871.  
  872. get_num_window_destroyed()
  873. {
  874.     num = 0;
  875.     for( i = 0; i < level.exterior_goals.size; i++ )
  876.     {
  877.         if( all_chunks_destroyed( level.exterior_goals[i].barrier_chunks ) )
  878.         {
  879.             num += 1;
  880.         }
  881.  
  882.     }
  883.     return num;
  884. }
  885.  
  886. carpenter_func(entity)
  887. {
  888.     origin = entity.origin;
  889.  
  890.     window_boards = getstructarray( "exterior_goal", "targetname" );
  891.     total = level.exterior_goals.size;
  892.    
  893.     //COLLIN
  894.     carp_ent = spawn("script_origin", (0,0,0));
  895.     carp_ent playloopsound( "carp_loop" );
  896.    
  897.     while(true)
  898.     {
  899.         windows = get_closest_window_repair(window_boards, origin);
  900.         if( !IsDefined( windows ) )
  901.         {
  902.             carp_ent stoploopsound( 1 );
  903.             carp_ent playsound( "carp_end", "sound_done" );
  904.             carp_ent waittill( "sound_done" );
  905.             break;
  906.         }
  907.        
  908.         else
  909.             window_boards = array_remove(window_boards, windows);
  910.  
  911.  
  912.         while(1)
  913.         {
  914.             if( all_chunks_intact( windows.barrier_chunks ) )
  915.             {
  916.                 break;
  917.             }
  918.  
  919.             chunk = get_random_destroyed_chunk( windows.barrier_chunks );
  920.  
  921.             if( !IsDefined( chunk ) )
  922.                 break;
  923.  
  924.             windows thread maps\_zombiemode_blockers_new::replace_chunk( chunk, false, true );
  925.             windows.clip enable_trigger();
  926.             windows.clip DisconnectPaths();
  927.             wait_network_frame();
  928.             wait(0.05);
  929.         }
  930.         wait_network_frame();  
  931.     }
  932.  
  933. players = get_players();
  934.     for(i = 0; i < players.size; i++)
  935.     {
  936.         if(level.zombie_vars["zombie_point_scalar"] == 1)
  937.         {
  938.             players[i].score += 200;
  939.             players[i].score_total += 200;
  940.             players[i] maps\_zombiemode_score::set_player_score_hud();
  941.         }
  942.         else
  943.         {
  944.             players[i].score += 400;
  945.             players[i].score_total += 400;
  946.             players[i] maps\_zombiemode_score::set_player_score_hud();
  947.         }
  948.     }
  949.  
  950.     carp_ent delete();
  951. }
  952.  
  953. get_closest_window_repair( windows, origin )
  954. {
  955.     current_window = undefined;
  956.     shortest_distance = undefined;
  957.     for( i = 0; i < windows.size; i++ )
  958.     {
  959.         if( all_chunks_intact(windows[i].barrier_chunks ) )
  960.             continue;
  961.  
  962.         if( !IsDefined( current_window ) ) 
  963.         {
  964.             current_window = windows[i];
  965.             shortest_distance = DistanceSquared( current_window.origin, origin );
  966.            
  967.         }
  968.         else
  969.         {
  970.             if( DistanceSquared(windows[i].origin, origin) < shortest_distance )
  971.             {
  972.  
  973.                 current_window = windows[i];
  974.                 shortest_distance =  DistanceSquared( windows[i].origin, origin );
  975.             }
  976.         }
  977.     }
  978.     return current_window;
  979. }
  980.  
  981. // nuke
  982. // kill them all!
  983.  
  984. nuke_func(drop_item)
  985. {
  986.     origin = drop_item.origin;
  987.  
  988.     PlayFx(level._effect["mini_nuke"], origin );
  989.     level thread nuke_flash();
  990.  
  991.     zombies = getaispeciesarray("axis");
  992.     zombies = get_array_of_closest( origin, zombies );
  993.     for (i = 0; i < zombies.size; i++)
  994.     {
  995.         wait (randomfloatrange(0.1, 0.7));
  996.         if( !IsDefined( zombies[i] ) )
  997.         {
  998.             continue;
  999.         }
  1000.        
  1001.         if( zombies[i].animname == "boss_zombie" || isdefined(zombies[i].boss) && zombies[i].boss || isdefined(zombies[i].boss_napalm) && zombies[i].boss_napalm )
  1002.         {
  1003.             continue;
  1004.         }
  1005.  
  1006.         if( is_magic_bullet_shield_enabled( zombies[i] ) )
  1007.         {
  1008.             continue;
  1009.         }
  1010.  
  1011.         if( i < 5 && !( zombies[i] enemy_is_dog() ) )
  1012.         {
  1013.             zombies[i] thread animscripts\death::flame_death_fx();
  1014.  
  1015.         }
  1016.  
  1017.         if( !( zombies[i] enemy_is_dog() ) )
  1018.         {
  1019.             zombies[i] maps\_zombiemode_spawner::zombie_head_gib();
  1020.         }
  1021.  
  1022.         zombies[i] dodamage( zombies[i].health + 666, zombies[i].origin );
  1023.         playsoundatposition( "nuked", zombies[i].origin );
  1024.     }
  1025.  
  1026.     players = get_players();
  1027.     for(i = 0; i < players.size; i++)
  1028.     {
  1029.         if(level.zombie_vars["zombie_point_scalar"] == 1)
  1030.         {
  1031.             players[i].score += 400;
  1032.             players[i].score_total += 400;
  1033.             players[i] maps\_zombiemode_score::set_player_score_hud();
  1034.         }
  1035.         else
  1036.         {
  1037.             players[i].score += 800;
  1038.             players[i].score_total += 800;
  1039.             players[i] maps\_zombiemode_score::set_player_score_hud();
  1040.         }
  1041.     }
  1042.     wait 5;
  1043. }
  1044.  
  1045. nuke_flash()
  1046. {
  1047.     players = getplayers();
  1048.     for(i=0; i<players.size; i ++)
  1049.     {
  1050.         players[i] play_sound_2d("nuke_flash");
  1051.     }
  1052.    
  1053.     fadetowhite = newhudelem();
  1054.  
  1055.     fadetowhite.x = 0;
  1056.     fadetowhite.y = 0;
  1057.     fadetowhite.alpha = 0;
  1058.  
  1059.     fadetowhite.horzAlign = "fullscreen";
  1060.     fadetowhite.vertAlign = "fullscreen";
  1061.     fadetowhite.foreground = true;
  1062.     fadetowhite SetShader( "white", 640, 480 );
  1063.  
  1064.     // Fade into white
  1065.     fadetowhite FadeOverTime( 0.2 );
  1066.     fadetowhite.alpha = 0.8;
  1067.  
  1068.     wait 0.5;
  1069.     fadetowhite FadeOverTime( 1.0 );
  1070.     fadetowhite.alpha = 0;
  1071.  
  1072.     wait 1.1;
  1073.     fadetowhite destroy();
  1074. }
  1075.  
  1076. //double points
  1077. // double the points
  1078.  
  1079. double_points_func()
  1080. {
  1081.     level notify ("powerup points scaled");
  1082.     level endon ("powerup points scaled");
  1083.  
  1084.     level thread point_doubler_on_hud();
  1085.  
  1086.     level.zombie_vars["zombie_point_scalar"] = 2;
  1087.     wait 30;
  1088.  
  1089.     level.zombie_vars["zombie_point_scalar"] = 1;
  1090. }
  1091.  
  1092. point_doubler_on_hud()
  1093. {
  1094.     self endon ("disconnect");
  1095.  
  1096.     // check to see if this is on or not
  1097.     if ( level.zombie_vars["zombie_powerup_point_doubler_on"] )
  1098.     {
  1099.         // reset the time and keep going
  1100.         level.zombie_vars["zombie_powerup_point_doubler_time"] = 30;
  1101.         return;
  1102.     }
  1103.  
  1104.     level.zombie_vars["zombie_powerup_point_doubler_on"] = true;
  1105.  
  1106.     // set time remaining for point doubler
  1107.     level thread time_remaining_on_point_doubler_powerup();
  1108. }
  1109.  
  1110. time_remaining_on_point_doubler_powerup()
  1111. {  
  1112.     temp_ent = spawn("script_origin", (0,0,0));
  1113.     temp_ent playloopsound ("double_point_loop");
  1114.    
  1115.     // time it down!
  1116.     while ( level.zombie_vars["zombie_powerup_point_doubler_time"] >= 0)
  1117.     {
  1118.         wait 0.1;
  1119.         level.zombie_vars["zombie_powerup_point_doubler_time"] = level.zombie_vars["zombie_powerup_point_doubler_time"] - 0.1;
  1120.         //self setvalue( level.zombie_vars["zombie_powerup_point_doubler_time"] ); 
  1121.     }
  1122.  
  1123.     // turn off the timer
  1124.     level.zombie_vars["zombie_powerup_point_doubler_on"] = false;
  1125.     players = get_players();
  1126.     for (i = 0; i < players.size; i++)
  1127.     {
  1128.         //players[i] stoploopsound("double_point_loop", 2);
  1129.         players[i] playsound("points_loop_off");
  1130.     }
  1131.     temp_ent stoploopsound(2);
  1132.  
  1133.  
  1134.     // remove the offset to make room for new powerups, reset timer for next time
  1135.     level.zombie_vars["zombie_powerup_point_doubler_time"] = 30;
  1136.     temp_ent delete();
  1137. }
  1138.  
  1139. //max ammo
  1140.  
  1141. full_ammo_func()
  1142. {
  1143.     players = get_players();
  1144.  
  1145.     for (i = 0; i < players.size; i++)
  1146.     {
  1147.         primaryWeapons = players[i] GetWeaponsList();
  1148.  
  1149.         for( x = 0; x < primaryWeapons.size; x++ )
  1150.         {
  1151.             players[i] GiveMaxAmmo( primaryWeapons[x] );
  1152.         }
  1153.     }
  1154. }
  1155.  
  1156. //insta kill
  1157.  
  1158. insta_kill_func()
  1159. {
  1160.     level notify( "powerup instakill" );
  1161.     level endon( "powerup instakill" );
  1162.    
  1163.     level thread insta_kill_on_hud();
  1164.  
  1165.     level.zombie_vars["zombie_insta_kill"] = 1;
  1166.     wait( 30 );
  1167.     level.zombie_vars["zombie_insta_kill"] = 0;
  1168.     players = get_players();
  1169.     for(i = 0; i < players.size; i++)
  1170.     {
  1171.         players[i] notify("insta_kill_over");
  1172.  
  1173.     }
  1174. }
  1175.  
  1176. insta_kill_on_hud()
  1177. {
  1178.     self endon ("disconnect");
  1179.  
  1180.     // check to see if this is on or not
  1181.     if ( level.zombie_vars["zombie_powerup_insta_kill_on"] )
  1182.     {
  1183.         // reset the time and keep going
  1184.         level.zombie_vars["zombie_powerup_insta_kill_time"] = 30;
  1185.         return;
  1186.     }
  1187.  
  1188.     level.zombie_vars["zombie_powerup_insta_kill_on"] = true;
  1189.  
  1190.     // set time remaining for insta kill
  1191.     level thread time_remaning_on_insta_kill_powerup();
  1192. }
  1193.  
  1194. time_remaning_on_insta_kill_powerup()
  1195. {
  1196.     temp_enta = spawn("script_origin", (0,0,0));
  1197.     temp_enta playloopsound("insta_kill_loop");
  1198.  
  1199.     // time it down!
  1200.     while ( level.zombie_vars["zombie_powerup_insta_kill_time"] >= 0)
  1201.     {
  1202.         wait 0.1;
  1203.         level.zombie_vars["zombie_powerup_insta_kill_time"] = level.zombie_vars["zombie_powerup_insta_kill_time"] - 0.1;
  1204.     }
  1205.  
  1206.     players = get_players();
  1207.     for (i = 0; i < players.size; i++)
  1208.     {
  1209.         players[i] playsound("insta_kill");
  1210.     }
  1211.  
  1212.     temp_enta stoploopsound(2);
  1213.     // turn off the timer
  1214.     level.zombie_vars["zombie_powerup_insta_kill_on"] = false;
  1215.  
  1216.     // remove the offset to make room for new powerups, reset timer for next time
  1217.     level.zombie_vars["zombie_powerup_insta_kill_time"] = 30;
  1218.  
  1219.     temp_enta delete();
  1220. }
  1221.  
  1222. check_for_instakill( player ) //ran from zombiemode_spawner
  1223. {
  1224.     if( IsDefined( player ) && IsAlive( player ) && level.zombie_vars["zombie_insta_kill"])
  1225.     {
  1226.         if( is_magic_bullet_shield_enabled( self ) )
  1227.         {
  1228.             return;
  1229.         }
  1230.  
  1231.         if( self.animname == "boss_zombie" )
  1232.         {
  1233.             return;
  1234.         }
  1235.  
  1236.         if(player.use_weapon_type == "MOD_MELEE")
  1237.         {
  1238.             player.last_kill_method = "MOD_MELEE";
  1239.         }
  1240.         else
  1241.         {
  1242.             player.last_kill_method = "MOD_UNKNOWN";
  1243.  
  1244.         }
  1245.  
  1246. /*      if( flag( "dog_round" ) ) BluntStuffy Edit:     no flag "dog_round" initialized in oil_rig. game chrases on an assert in dev-mode using insta-kill
  1247.         {
  1248.             self DoDamage( self.health + 666, self.origin, player );
  1249.             player notify("zombie_killed");
  1250.         }
  1251.         else
  1252.         {       */
  1253.             self maps\_zombiemode_spawner::zombie_head_gib();
  1254.             self DoDamage( self.health + 666, self.origin, player );
  1255.             player notify("zombie_killed");
  1256.            
  1257. //      }
  1258.     }
  1259. }
  1260.  
  1261. //below not used, prevents script error
  1262.  
  1263. include_zombie_powerup( powerup_name )
  1264. {
  1265.  
  1266. }
  1267.  
  1268. special_powerup_drop(drop_point, variable)
  1269. {
  1270.  
  1271. }
  1272.  
  1273. powerup_round_start()
  1274. {
  1275.  
  1276. }
  1277.  
  1278. // Other Powerups
  1279.  
  1280. dm_last_stand_watcher()
  1281. {
  1282.     self endon( "DeathMachineOver" );
  1283.     self waittill_any( "death", "fake_death", "player_downed" );
  1284.     self.dmhud destroy();
  1285.     self.zombie_vars[ "MiniGunTime" ] = 0;
  1286.     self.PRO["DM"] = undefined;
  1287.     self TakeWeapon( "ghost_minigun" );
  1288.     self thread SetAmmoClip();
  1289. }
  1290.  
  1291. // Death Machine
  1292. MiniGun()
  1293. {
  1294.     if(isDefined( self.PRO["DM"] ) && self.PRO["DM"])
  1295.     {
  1296.         self.zombie_vars[ "MiniGunTime" ] = 30;
  1297.         return;
  1298.     }
  1299.    
  1300.     self thread dm_last_stand_watcher();
  1301.     self.PRO["DM"] = true;
  1302.     self.zombie_vars[ "MiniGunTime" ] = 30;
  1303.     self DisableWeaponCycling();
  1304.     self setStance( "stand" );
  1305.     self AllowSprint( false );
  1306.     self AllowCrouch( false );
  1307.     self AllowMelee( false );
  1308.     self thread GetAllAmmoSet();
  1309.     self.CurrWeap = self GetCurrentWeapon();
  1310.        
  1311.     self GiveWeapon( "ghost_minigun" );
  1312.     self SwitchToWeapon( "ghost_minigun" );
  1313.     while( 1 )
  1314.     {
  1315.         if ( self.zombie_vars[ "MiniGunTime" ] <= 0 )
  1316.             break;
  1317.        
  1318.         self.zombie_vars[ "MiniGunTime" ]--;
  1319.         wait 1;
  1320.     }
  1321.     self thread SetAmmoClip();
  1322.     self AllowCrouch( true );
  1323.     self.dmhud destroy();
  1324.     self.zombie_vars[ "MiniGunTime" ] = 0;
  1325.     self.PRO["DM"] = undefined;
  1326.     self EnableWeaponCycling();
  1327.     self TakeWeapon( "ghost_minigun" );
  1328.     self SwitchToWeapon( self.CurrWeap );
  1329.     self.CurrWeap = undefined;
  1330.     if ( !self maps\_laststand::player_is_in_laststand() )
  1331.     {
  1332.         self AllowSprint( true );
  1333.         self AllowMelee( true );
  1334.     }
  1335.     self notify( "DeathMachineOver" );
  1336. }
  1337.  
  1338. DisableBuyingPerks()
  1339. {
  1340.     self.is_drinking = 1;
  1341.     while( self.zombie_vars[ "MiniGunOn" ] == true )
  1342.         wait .01;
  1343.     self.is_drinking = undefined;
  1344. }
  1345.  
  1346. GetAllAmmoSet()
  1347. {
  1348.     GrenadeClip = undefined;
  1349.     GrenadeClip2 = undefined;
  1350.     GrenadeClip3 = undefined;
  1351.     GrenadeClip4 = undefined;
  1352.     if( self HasWeapon( "fraggrenade" ) )
  1353.     {
  1354.         GrenadeClip = self GetWeaponAmmoClip( "fraggrenade" );
  1355.         self SetWeaponAmmoClip( "fraggrenade", 0 );
  1356.     }
  1357.     while( self.zombie_vars[ "MiniGunOn" ] == true )
  1358.         wait .01;
  1359.     if( IsDefined( GrenadeClip ) )
  1360.         self SetWeaponAmmoClip( "fraggrenade", GrenadeClip );
  1361. }
  1362.  
  1363. WatchTime()
  1364. {
  1365.     self notify( "DeathTimeReset" );
  1366.     self endon( "DeathTimeReset" );
  1367.     self.zombie_vars[ "MiniGunOn" ] = true;
  1368.     self.zombie_vars[ "MiniGunTime" ] = 30;
  1369.     while( 1 )
  1370.     {
  1371.         wait 1;
  1372.         self.zombie_vars[ "MiniGunTime" ]--;
  1373.         if( self.zombie_vars["MiniGunTime"] <= 0 )
  1374.             break;
  1375.     }
  1376.     self.zombie_vars[ "MiniGunOn" ] = false;
  1377. }
  1378.  
  1379. WatchDown( CurrWeap )
  1380. {
  1381.     self endon( "DeathMachineOver" );
  1382.     self.wentDownAgain = undefined;
  1383.     Weap = CurrWeap;
  1384.     Stock = self GetWeaponAmmoStock( Weap );
  1385.     Clip = self GetWeaponAmmoClip( Weap );
  1386.     self.justDied = false;
  1387.     self thread AddExtraDiedChecks();
  1388.     while( IsDefined( self.is_zombie ) && !self.is_zombie && !self maps\_laststand::player_is_in_laststand() && self.sessionstate != "spectator" && IsAlive( self ) && !self.justDied )
  1389.         wait .01;
  1390.     //self thread SetVisTrigs();
  1391.     //self EnableWeaponCycling();
  1392.     self TakeWeapon( "ghost_minigun" );
  1393.     // self SwitchToWeapon( CurrWeap );
  1394.     self AllowSprint( true );
  1395.     self AllowMelee( true );
  1396.     self AllowProne( true );
  1397.     self AllowAds( true );
  1398.     self.PRO["DM"] = undefined;
  1399.     self.zombie_vars[ "MiniGunOn" ] = false;
  1400.     self.zombie_vars[ "MiniGunTime" ] = 0;
  1401.     self notify( "DeathTimeReset" );
  1402.     self thread reset_after_revive();       // BlSt - Moved this to a seperate function so the endon() doesn't screw things up.. ( the notify from the minigun() function has a wait of 30s, allowing this function to end while the player is down ( 60 sec bleedout ) )
  1403.     self notify( "DeathMachineOver" );
  1404. }
  1405.  
  1406. reset_after_revive(Weap, Clip, Stock )
  1407. {
  1408.     self endon( "disconnect" );
  1409.     while( IsDefined( self.is_zombie ) && self.is_zombie || self maps\_laststand::player_is_in_laststand() || self.sessionstate == "spectator" || !IsAlive( self ) || self.justDied )
  1410.         wait .01;
  1411.     wait 0.5;
  1412.     if( IsAlive( self ) )
  1413.     {
  1414.         if( self HasWeapon( "ghost_minigun" ) ) self TakeWeapon( "ghost_minigun" );
  1415.         self GiveWeapon( Weap );
  1416.         self SetWeaponAmmoClip( Weap, Clip );
  1417.         self SetWeaponAmmoStock( Weap, Stock );
  1418.         self SwitchToWeapon( Weap );
  1419.     }
  1420.     self.CurrWeap = undefined;
  1421. }
  1422.  
  1423. AddExtraDiedChecks()
  1424. {
  1425.     self endon( "DeathMachineOver" );
  1426.     self waittill_any( "fake_death", "death", "player_downed" );
  1427.     self.justDied = true;
  1428.     self waittill( "player_revived" );
  1429.     self.justDied = false;
  1430. }
  1431.  
  1432. SetAmmoClip()
  1433. {
  1434.     self endon( "DeathMachineAmmoOver" );
  1435.     while( 1 )
  1436.     {
  1437.         if( self GetWeaponAmmoClip( "ghost_minigun" ) != 100 )
  1438.             self SetWeaponAmmoClip( "ghost_minigun", 100 );
  1439.         wait .01;
  1440.     }
  1441. }
  1442.  
  1443. MiniGunNoDrop()
  1444. {
  1445.     players = GetPlayers();
  1446.     for ( i=0; i<players.size; i++ )
  1447.         if( players[i].zombie_vars[ "MiniGunOn" ] == true )
  1448.             return true;
  1449.     return false;
  1450. }
  1451. /*
  1452. // Fire Sale
  1453.  
  1454. FireSale()
  1455. {
  1456.     Play = GetPlayers();
  1457.  
  1458.     level.zombie_vars["ZombFireSale"] = 1;
  1459.  
  1460.     while( flag( "moving_chest_now" ) )
  1461.         wait .01;
  1462.    
  1463.     level thread FireOnHUD();
  1464.     level notify( "FireSale" );
  1465.     level thread InitFireSale();
  1466.  
  1467.     Sound = spawn( "script_origin", ( 0, 0, 0 ) );
  1468.     Sound PlaySound( "firesale_jingle" );
  1469.    
  1470.     wait 30;
  1471.     level notify( "FireSaleOver" );
  1472.     level.zombie_vars["ZombFireSale"] = 0;
  1473.     Sound Delete();
  1474. }
  1475.  
  1476. FireOnHUD()
  1477. {
  1478.     self endon( "disconnect" );
  1479.  
  1480.     if( level.zombie_vars["FireSaleOn"] )
  1481.     {
  1482.         level.zombie_vars["FireSaleTime"] = 30;
  1483.         return;
  1484.     }
  1485.  
  1486.     level.zombie_vars["FireSaleOn"] = true;
  1487.  
  1488.     level thread TimeFireSale();       
  1489. }
  1490.  
  1491. TimeFireSale()
  1492. {
  1493.     while( level.zombie_vars["FireSaleTime"] >= 0 )
  1494.     {
  1495.         wait 1;
  1496.         level.zombie_vars["FireSaleTime"]--;   
  1497.     }
  1498.  
  1499.     level.zombie_vars["FireSaleOn"] = false;
  1500.  
  1501.     level.zombie_vars["FireSaleTime"] = 30;
  1502. }
  1503.  
  1504. InitFireSale()
  1505. {
  1506.     level.BoxCost = 10;
  1507.     for( i = 0; i < level.chests.size; i++ )
  1508.     {
  1509.         if( i != level.chest_index )
  1510.         {
  1511.             level.chests[i] SetHintString( "Press ^3F ^7for ^3Random Weapon ^7[Cost: ^310^7]" );
  1512.             level.chests[i].HintString = "FireSale";
  1513.             //rubble = getent( level.chests[i].script_noteworthy + "_rubble", "script_noteworthy" );
  1514.             rubble = maps\_zombiemode_weapons::GetClosestRubble( level.chests[i] );
  1515.             level.chests[i] maps\_zombiemode_weapons::show_magic_box();
  1516.             thread maps\_zombiemode_weapons::unhide_magic_box( i );
  1517.             // rubble hide();
  1518.             if ( IsDefined( rubble ) && rubble.size > 0 )
  1519.                 for (a = 0; a < rubble.size; a++)
  1520.                     rubble[a] hide();
  1521.  
  1522.             thread CreateDestroyLight( i );
  1523.         }
  1524.         else
  1525.         {
  1526.             if( !IsDefined( level.chests[i].BoxOpen ) )
  1527.             {
  1528.                 level.chests[i] SetHintString( "Press ^3F ^7for ^3Random Weapon ^7[Cost: ^310^7]" );
  1529.                 level.chests[i].HintString = "FireSale";
  1530.             }
  1531.         }
  1532.     }
  1533.    
  1534.     wait 30;
  1535.    
  1536.     level.BoxCost = 950;
  1537.     for( i = 0; i < level.chests.size; i++ )
  1538.     {
  1539.         if( i != level.chest_index && !IsDefined( level.chests[i].FireSale ) )
  1540.         {
  1541.             level.chests[i] SetHintString( "Press ^3F ^7for ^3Random Weapon ^7[Cost: ^3950^7]" );
  1542.             level.chests[i].HintString = "Normal";
  1543.             // rubble = getent( level.chests[i].script_noteworthy + "_rubble", "script_noteworthy" );
  1544.             rubble = maps\_zombiemode_weapons::GetClosestRubble( level.chests[i] );
  1545.             level.chests[i] disable_trigger();
  1546.             level.chests[i] maps\_zombiemode_weapons::hide_chest();
  1547.             // rubble show();
  1548.             if ( IsDefined( rubble ) && rubble.size > 0 )
  1549.                 for (a = 0; a < rubble.size; a++)
  1550.                     rubble[a] show();
  1551.         }
  1552.         else if( i == level.chest_index )
  1553.         {
  1554.             if( !IsDefined( level.chests[i].BoxOpen ) )
  1555.             {
  1556.                 level.chests[i] SetHintString( "Press ^3F ^7for ^3Random Weapon ^7[Cost: ^3950^7]" );
  1557.                 level.chests[i].HintString = "Normal";
  1558.             }
  1559.         }
  1560.     }
  1561. }
  1562.  
  1563. CreateDestroyLight( i )
  1564. {
  1565.     Lights = [];
  1566.  
  1567.     Anchor = GetEnt( level.chests[i].target, "targetname" );
  1568.     anchorTarget = GetEnt( anchor.target, "targetname" );
  1569.  
  1570.     Lights[i] = Spawn( "script_model", anchorTarget.origin );
  1571.     Lights[i].angles = anchorTarget.angles + ( -90, 0, 0 );
  1572.     Lights[i] SetModel( "tag_origin" );
  1573.     playfxontag( level._effect["lght_marker"], Lights[i], "tag_origin" );
  1574.        
  1575.     wait 30;
  1576.  
  1577.     Lights[i] delete();
  1578. }
  1579.  
  1580. // gtlad
  1581.  
  1582. gtlad_powerup()
  1583. {
  1584.     players = getplayers();
  1585.     for ( i = 0; i < players.size; i++ )
  1586.     {
  1587.         flag_wait( "electricity_on" );
  1588.         players[i] maps\_zombiemode_perks::thegtlad();
  1589.     }
  1590. }
  1591. */
  1592. // Bonus Points
  1593.  
  1594. GiveRandPoints()
  1595. {
  1596.     if(level.zombie_vars["zombie_point_scalar"] == 1)
  1597.     {
  1598.        RandomAmount = RandomIntRange( 500, 1500 );
  1599.     }
  1600.     else
  1601.     {
  1602.        RandomAmount = RandomIntRange( 1000, 3000 );
  1603.     }
  1604.  
  1605.     RoundUp = round_up_to_ten( RandomAmount );
  1606.     level thread play_devil_dialog( "bonus_points_vox" );
  1607.     self maps\_zombiemode_score::add_to_player_score( RoundUp );
  1608. }
  1609.  
  1610.  
  1611. // Zombie Blood
  1612.  
  1613. blood_last_stand_watcher()
  1614. {
  1615.     self endon( "blood_over" );
  1616.     self waittill_any( "death", "fake_death", "player_downed" );
  1617.     self.zbhud destroy();
  1618.     self.zombie_vars[ "blood_time" ] = 0;
  1619.     self.PRO["zombie_blood"] = undefined;
  1620. }
  1621.  
  1622. zombie_blood()
  1623. {
  1624.     self endon( "blood_over" );
  1625.     if ( isDefined( self.PRO["zombie_blood"] )&& self.PRO["zombie_blood"] )
  1626.     {
  1627.         self.zombie_vars[ "blood_time" ] = 30;
  1628.         return;
  1629.     }
  1630.    
  1631.     self thread blood_last_stand_watcher();
  1632.     self.PRO["zombie_blood"] = true;
  1633.     self.zombie_vars[ "blood_time" ] = 30;
  1634.    
  1635.     self.zombie_blood = true;
  1636.     self.ignoreme = true;
  1637.     self setblur( 4, 0.2 );
  1638.     new_fov = 65 + 15;
  1639.     self setClientDvar( "cg_fov", new_fov );
  1640.     wait .2;
  1641.     self setblur(0.2, 0.2);
  1642.     self setClientDvar("r_filmUseTweaks", 0);
  1643.     self setClientDvar("r_filmTweakEnable", 0);
  1644.     self VisionSetNaked( "berserker", 0.6 );
  1645.  
  1646.     while( 1 )
  1647.     {
  1648.         if ( self.zombie_vars[ "blood_time" ] <= 0 )
  1649.             break;
  1650.        
  1651.         self.zombie_vars[ "blood_time" ]--;
  1652.         wait 1;
  1653.     }
  1654.    
  1655.     self playsound("points_loop_off");
  1656.     self.PRO["zombie_blood"] = undefined;
  1657.     self.zombie_vars[ "blood_time" ] = 0;
  1658.     self.ignoreme = false;
  1659.     self.zombie_blood = false;
  1660.     self setblur( 4, 0.4 );
  1661.     self setClientDvar("r_filmUseTweaks", 1);
  1662.     self setClientDvar("r_filmTweakEnable", 1);
  1663.     self setClientDvar( "cg_fov", 65 );
  1664.     if ( !self maps\_laststand::player_is_in_laststand() )
  1665.         self VisionSetNaked( "default", 2 );
  1666.  
  1667.     wait .4;
  1668.     self setblur(0, 0.3);
  1669.    
  1670.     self.zbhud destroy();
  1671.     self.zombie_vars[ "blood_time" ] = 0;
  1672.     self.PRO["zombie_blood"] = undefined;
  1673.     self notify( "blood_over" );
  1674. }
  1675.  
  1676. CountDown()
  1677. {
  1678.     self endon( "reset_zombie_blood" );
  1679.     self.zombie_vars["BloodTime"] = 30;
  1680.     while( self.zombie_vars["BloodTime"] >= 0 )
  1681.     {
  1682.         wait 1;
  1683.         self.zombie_vars["BloodTime"]--;
  1684.     }
  1685.     self.zombie_vars["BloodTime"] = 30;
  1686. }
  1687.  
  1688. init_player_zombie_vars()
  1689. {
  1690.     flag_wait( "all_players_connected" );
  1691.     players = get_players();
  1692.     for( p = 0; p < players.size; p++ )
  1693.     {
  1694.         players[p].zombie_vars[ "ZombieBlood" ] = false;
  1695.         players[p].zombie_vars[ "BloodTime" ] = 0;
  1696.  
  1697.         players[p].zombie_vars[ "MiniGunOn" ] = false;
  1698.         players[p].zombie_vars[ "MiniGunTime" ] = 0;
  1699.     }
  1700. }
  1701.  
  1702. on_player_connect() //otw 8-15-15: set player variables here if necessary
  1703. {
  1704.     for(;;)
  1705.     {
  1706.         level waittill("connecting", player);
  1707.         player.zombie_blood = false; //zombie blood
  1708.         player.inStand = false; //otw 8-16-15: quick revive laststand fix
  1709.         player thread glitch_fix();
  1710.     }
  1711. }
  1712.  
  1713. glitch_fix()
  1714. {
  1715.     self waittill( "spawned_player" );
  1716.  
  1717.     while(1)
  1718.     {
  1719.         if( self.ignoreme == true )
  1720.         {
  1721.             if( !isdefined( self.revivetrigger ) && !self.inStand )
  1722.             {
  1723.                 if( !isdefined( self.zombie_blood ) || isdefined( self.zombie_blood ) && !self.zombie_blood )
  1724.                 {
  1725.                     self.ignoreme = false;
  1726.                 }
  1727.             }
  1728.         }
  1729.         wait 0.3;
  1730.     }
  1731. }
RAW Paste Data
Top