Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.00 KB | None | 0 0
  1. #using scripts\codescripts\struct;
  2.  
  3. #using scripts\shared\array_shared;
  4. #using scripts\shared\callbacks_shared;
  5. #using scripts\shared\clientfield_shared;
  6. #using scripts\shared\compass;
  7. #using scripts\shared\exploder_shared;
  8. #using scripts\shared\flag_shared;
  9. #using scripts\shared\laststand_shared;
  10. #using scripts\shared\math_shared;
  11. #using scripts\shared\scene_shared;
  12. #using scripts\shared\util_shared;
  13.  
  14. #insert scripts\shared\shared.gsh;
  15. #insert scripts\shared\version.gsh;
  16.  
  17. // Added for traps
  18. //#using scripts\zm\zm_temptraps_fx;
  19.  
  20. #insert scripts\zm\_zm_utility.gsh;
  21.  
  22. #using scripts\zm\_load;
  23. #using scripts\zm\_zm;
  24. #using scripts\zm\_zm_audio;
  25. #using scripts\zm\_zm_powerups;
  26. #using scripts\zm\_zm_utility;
  27. #using scripts\zm\_zm_weapons;
  28. #using scripts\zm\_zm_zonemgr;
  29. #using scripts\zm\_zm_score;
  30. //#using scripts\zm\_zm_blockers;
  31.  
  32. #using scripts\shared\ai\zombie_utility;
  33.  
  34. //Perks
  35. #using scripts\zm\_zm_pack_a_punch;
  36. #using scripts\zm\_zm_pack_a_punch_util;
  37. #using scripts\zm\_zm_perk_additionalprimaryweapon;
  38. #using scripts\zm\_zm_perk_doubletap2;
  39. #using scripts\zm\_zm_perk_deadshot;
  40. #using scripts\zm\_zm_perk_juggernaut;
  41. #using scripts\zm\_zm_perk_quick_revive;
  42. #using scripts\zm\_zm_perk_sleight_of_hand;
  43. #using scripts\zm\_zm_perk_staminup;
  44.  
  45. //additional perks
  46. #using scripts\zm\_zm_perk_widows_wine;
  47. #using scripts\zm\_zm_powerup_ww_grenade;
  48. #using scripts\zm\_zm_perk_electric_cherry;
  49.  
  50. //jump pad
  51. // #using scripts\_redspace\rs_o_jump_pad;
  52.  
  53.  
  54.  
  55. //Powerups
  56. #using scripts\zm\_zm_powerup_double_points;
  57. #using scripts\zm\_zm_powerup_carpenter;
  58. #using scripts\zm\_zm_powerup_fire_sale;
  59. #using scripts\zm\_zm_powerup_free_perk;
  60. #using scripts\zm\_zm_powerup_full_ammo;
  61. #using scripts\zm\_zm_powerup_insta_kill;
  62. #using scripts\zm\_zm_powerup_nuke;
  63. #using scripts\zm\_zm_powerup_weapon_minigun;
  64.  
  65. //Traps
  66. #using scripts\zm\_zm_trap_electric;
  67.  
  68. #using scripts\zm\zm_usermap;
  69.  
  70. // NSZ Kino Teleporter
  71. //#using scripts\_NSZ\nsz_kino_teleporter;
  72.  
  73. //#using scripts\zm\zm_rotating_door;
  74.  
  75. // NSZ Buried Buildables
  76. //#using scripts\_NSZ\nsz_buildables;
  77.  
  78. //#using scripts\zm\zm_giant_cleanup_mgr;
  79.  
  80. //#using scripts\zm\zm_flyby;
  81.  
  82. // NSZ Shootable EE
  83. //#using scripts\_NSZ\nsz_shootable_ee;
  84. //#using scripts\_NSZ\wakka_shootable_ee;
  85.  
  86.  
  87. #precache( "fx", "zombie/fx_glow_eye_orange" );
  88. #precache( "fx", "zombie/fx_bul_flesh_head_fatal_zmb" );
  89. #precache( "fx", "zombie/fx_bul_flesh_head_nochunks_zmb" );
  90. #precache( "fx", "zombie/fx_bul_flesh_neck_spurt_zmb" );
  91. #precache( "fx", "zombie/fx_blood_torso_explo_zmb" );
  92. #precache( "fx", "trail/fx_trail_blood_streak" );
  93. #precache( "fx", "electric/fx_elec_sparks_directional_orange" );
  94.  
  95. #precache( "string", "ZOMBIE_NEED_POWER" );
  96. #precache( "string", "ZOMBIE_ELECTRIC_SWITCH" );
  97.  
  98. #precache( "model", "zombie_zapper_cagelight_red");
  99. #precache( "model", "zombie_zapper_cagelight_green");
  100. #precache( "model", "lights_indlight_on" );
  101. #precache( "model", "lights_milit_lamp_single_int_on" );
  102. #precache( "model", "lights_tinhatlamp_on" );
  103. #precache( "model", "lights_berlin_subway_hat_0" );
  104. #precache( "model", "lights_berlin_subway_hat_50" );
  105. #precache( "model", "lights_berlin_subway_hat_100" );
  106.  
  107. #precache( "model", "p6_power_lever" );
  108.  
  109. #precache( "triggerstring", "ZOMBIE_BUTTON_BUY_OPEN_DOOR_COST","1250" );
  110. #precache( "triggerstring", "ZOMBIE_BUTTON_BUY_OPEN_DOOR_COST","750" );
  111. #precache( "triggerstring", "ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_COST","1000" );
  112. #precache( "triggerstring", "ZOMBIE_BUTTON_BUY_TRAP","1000" );
  113. #precache( "triggerstring", "ZOMBIE_UNDEFINED" );
  114. #precache( "triggerstring", "ZOMBIE_TELEPORT_COOLDOWN" );
  115. #precache( "triggerstring", "ZOMBIE_TELEPORT_TO_CORE" );
  116. #precache( "triggerstring", "ZOMBIE_RANDOM_WEAPON_COST","950" );
  117. #precache( "triggerstring", "ZOMBIE_RANDOM_WEAPON_COST","10" );
  118. #precache( "triggerstring", "ZOMBIE_PERK_PACKAPUNCH","5000" );
  119. #precache( "triggerstring", "ZOMBIE_PERK_PACKAPUNCH_AAT","2500" );
  120.  
  121.  
  122. #precache( "fx", "zombie/fx_perk_juggernaut_factory_zmb" );
  123. #precache( "fx", "zombie/fx_perk_quick_revive_factory_zmb" );
  124. #precache( "fx", "zombie/fx_perk_sleight_of_hand_factory_zmb" );
  125. #precache( "fx", "zombie/fx_perk_doubletap2_factory_zmb" );
  126. #precache( "fx", "zombie/fx_perk_daiquiri_factory_zmb" );
  127. #precache( "fx", "zombie/fx_perk_stamin_up_factory_zmb" );
  128. #precache( "fx", "zombie/fx_perk_mule_kick_factory_zmb" );
  129. #precache( "triggerstring", "ZOMBIE_PERK_QUICKREVIVE","500" );
  130. #precache( "triggerstring", "ZOMBIE_PERK_QUICKREVIVE","1500" );
  131. #precache( "triggerstring", "ZOMBIE_PERK_FASTRELOAD","3000" );
  132. #precache( "triggerstring", "ZOMBIE_PERK_DOUBLETAP","2000" );
  133. #precache( "triggerstring", "ZOMBIE_PERK_JUGGERNAUT","2500" );
  134. #precache( "triggerstring", "ZOMBIE_PERK_ADDITIONALPRIMARYWEAPON","4000" );
  135. //*****************************************************************************
  136. // MAIN
  137. //*****************************************************************************
  138.  
  139. function main()
  140. {
  141.  
  142. level._uses_default_wallbuy_fx = 1;
  143.  
  144. zm::init_fx();
  145. level util::set_lighting_state( 1 );
  146.  
  147. level._effect["eye_glow"] = "zombie/fx_glow_eye_orange";
  148. level._effect["headshot"] = "zombie/fx_bul_flesh_head_fatal_zmb";
  149. level._effect["headshot_nochunks"] = "zombie/fx_bul_flesh_head_nochunks_zmb";
  150. level._effect["bloodspurt"] = "zombie/fx_bul_flesh_neck_spurt_zmb";
  151.  
  152. level._effect["animscript_gib_fx"] = "zombie/fx_blood_torso_explo_zmb";
  153. level._effect["animscript_gibtrail_fx"] = "trail/fx_trail_blood_streak";
  154. level._effect["switch_sparks"] = "electric/fx_elec_sparks_directional_orange";
  155.  
  156.  
  157. //level thread nsz_kino_teleporter::init();
  158. //level thread nsz_buildables::init();
  159.  
  160.  
  161.  
  162. //original
  163.  
  164.  
  165. zm_usermap::main();
  166.  
  167. // NSZ Shootable EE
  168. //level thread nsz_shootable_ee::main();
  169. // level thread wakka_shootable_ee::main();
  170.  
  171. // level._zombie_custom_add_weapons =&custom_add_weapons;
  172.  
  173. //Setup the levels Zombie Zone Volumes
  174. level.zones = [];
  175. level.zone_manager_init_func =&usermap_test_zone_init;
  176. init_zones[0] = "start_zone";
  177. level thread zm_zonemgr::manage_zones( init_zones );
  178.  
  179. level.pathdist_type = PATHDIST_ORIGINAL;
  180.  
  181. //level._zombie_custom_add_weapons =&custom_add_weapons;
  182.  
  183. zm_pap_util::enable_swap_attachments();
  184.  
  185. //wakka hax
  186. callback::on_connect(&WakkaCash);
  187.  
  188. level.random_pandora_box_start = true;
  189.  
  190. level thread setupMusic();
  191.  
  192. level.burning_zombies = []; //JV max number of zombies that can be on fire
  193. level.max_barrier_search_dist_override = 400;
  194.  
  195. level.door_dialog_function = &zm::play_door_dialog;
  196.  
  197. // level.zombie_anim_override = &zm_giant::anim_override_func;
  198.  
  199. level._round_start_func = &zm::round_start;
  200.  
  201. init_sounds();
  202.  
  203. zombie_utility::set_zombie_var( "zombie_powerup_drop_max_per_round", 1 );
  204. // lower this to make drop happen more often
  205.  
  206. // nate vox shit
  207. level thread custom_add_vox();
  208.  
  209. // power shit
  210. level thread power_electric_switch();
  211.  
  212. //Pack-a-Punch Camo
  213. level.pack_a_punch_camo_index = 75;
  214. level.pack_a_punch_camo_index_number_variants = 5;
  215.  
  216. //rdv put dogs in round2
  217. // level.next_dog_round = 2;
  218.  
  219. }
  220.  
  221. function usermap_test_zone_init()
  222. {
  223. level flag::init( "always_on" );
  224. level flag::set( "always_on" );
  225. }
  226.  
  227. function custom_add_weapons()
  228. {
  229. zm_weapons::load_weapon_spec_from_table("gamedata/weapons/zm/zm_levelcommon_weapons.csv", 1);
  230. }
  231.  
  232.  
  233.  
  234. //-------------------------------------------------------------------------------
  235. // Create the zone information for zombie spawning
  236. //-------------------------------------------------------------------------------
  237. //function factory_zone_init()
  238. //{
  239. // Note this setup is based on a flag-centric view of setting up your zones. A brief
  240. // zone-centric example exists below in comments
  241.  
  242. //Counter Clockwise opening
  243.  
  244. // //
  245. // zm_zonemgr::add_adjacent_zone( "start_zone", "trainshed_zone", "enter_trainshed_zone" );
  246.  
  247. //
  248. // zm_zonemgr::add_adjacent_zone( "trainshed_zone", "outside_west_zone", "enter_outside_west_zone" );
  249.  
  250. //
  251. // zm_zonemgr::add_adjacent_zone( "trainshed_zone", "outside_west_zone", "enter_outside_west_zone" );
  252.  
  253.  
  254. // "enter_warehouse_second_floor" );
  255. //}
  256.  
  257.  
  258.  
  259. #define JUGGERNAUT_MACHINE_LIGHT_FX "jugger_light"
  260. #define QUICK_REVIVE_MACHINE_LIGHT_FX "revive_light"
  261. #define STAMINUP_MACHINE_LIGHT_FX "marathon_light"
  262. #define WIDOWS_WINE_FX_MACHINE_LIGHT "widow_light"
  263. #define SLEIGHT_OF_HAND_MACHINE_LIGHT_FX "sleight_light"
  264. #define DOUBLETAP2_MACHINE_LIGHT_FX "doubletap2_light"
  265. #define DEADSHOT_MACHINE_LIGHT_FX "deadshot_light"
  266. #define ADDITIONAL_PRIMARY_WEAPON_MACHINE_LIGHT_FX "additionalprimaryweapon_light"
  267.  
  268. /#
  269. function power_on_listener( trig )
  270. {
  271. trig endon( "trigger" );
  272.  
  273. level flag::wait_till("power_on");
  274.  
  275. trig notify( "trigger" );
  276. }
  277. #/
  278.  
  279. function power_electric_switch()
  280. {
  281. trig = getent("use_power_switch","targetname");
  282. trig sethintstring(&"ZOMBIE_ELECTRIC_SWITCH");
  283. trig SetCursorHint( "HINT_NOICON" );
  284.  
  285.  
  286. cheat = false;
  287.  
  288. /#
  289. if( GetDvarInt( "zombie_cheat" ) >= 3 )
  290. {
  291. wait( 5 );
  292. cheat = true;
  293. }
  294. #/
  295.  
  296. user = undefined;
  297. if ( cheat != true )
  298. {
  299. level thread power_on_listener( trig );
  300.  
  301. trig waittill("trigger",user);
  302. if( isdefined( user ) )
  303. {
  304. //user zm_audio::create_and_play_dialog( "general", "power_on" );
  305. }
  306. }
  307.  
  308.  
  309.  
  310.  
  311.  
  312. level thread scene::play( "power_switch", "targetname" );
  313.  
  314. //TO DO (TUEY) - kick off a 'switch' on client script here that operates similiarly to Berlin2 subway.
  315. level flag::set( "power_on" );
  316. util::wait_network_frame();
  317. level notify( "sleight_on" );
  318. util::wait_network_frame();
  319. level notify( "revive_on" );
  320. util::wait_network_frame();
  321. level notify( "doubletap_on" );
  322. util::wait_network_frame();
  323. level notify( "juggernog_on" );
  324. util::wait_network_frame();
  325. level notify( "Pack_A_Punch_on" );
  326. util::wait_network_frame();
  327. level notify( "specialty_armorvest_power_on" );
  328. util::wait_network_frame();
  329. level notify( "specialty_rof_power_on" );
  330. util::wait_network_frame();
  331. level notify( "specialty_quickrevive_power_on" );
  332. util::wait_network_frame();
  333. level notify( "specialty_fastreload_power_on" );
  334. util::wait_network_frame();
  335.  
  336.  
  337.  
  338. level util::set_lighting_state( 2 );
  339.  
  340. util::clientNotify("ZPO"); // Zombie Power On!
  341. util::wait_network_frame();
  342.  
  343. trig delete();
  344.  
  345. wait 1;
  346.  
  347. thread play_sound_2d("poweron2");
  348.  
  349. wait 1;
  350.  
  351. thread play_sound_2d("poweron");
  352.  
  353. s_switch = struct::get("power_switch_fx","targetname");
  354. forward = AnglesToForward( s_switch.origin );
  355. playfx( level._effect["switch_sparks"], s_switch.origin, forward );
  356.  
  357. level util::delay( 19, undefined, &zm_audio::sndMusicSystem_PlayState, "power_on" );
  358.  
  359. }
  360.  
  361. // nate vox shit
  362.  
  363. function custom_add_vox()
  364. {
  365. zm_audio::loadPlayerVoiceCategories("gamedata/audio/zm/zombie_vox.csv");
  366. }
  367.  
  368. // end vox
  369.  
  370. function init_sounds()
  371. {
  372. zm_utility::add_sound( "break_stone", "evt_break_stone" );
  373. zm_utility::add_sound( "gate_door", "zmb_gate_slide_open" );
  374. zm_utility::add_sound( "heavy_door", "zmb_heavy_door_open" );
  375.  
  376. // override the default slide with the buzz slide
  377. zm_utility::add_sound("zmb_heavy_door_open", "zmb_heavy_door_open");
  378. }
  379.  
  380. function ammomatic()
  381. {
  382. trig2 = getent("trig_ammomatic","targetname");
  383. trig2 sethintstring( &"ZOMBIE_NEED_POWER" );
  384. trig2 SetCursorHint( "HINT_NOICON" );
  385.  
  386. level flag::wait_till( "power_on" );
  387.  
  388. cost = 25000;
  389.  
  390. trig2 sethintstring( "Press ^3[&&1] ^7to get max ammo [Cost:" + cost + "]" );
  391.  
  392. player = undefined;
  393. powerup = zm_powerups::get_valid_powerup();
  394. powerup = ("full_ammo");
  395.  
  396. while ( 1 )
  397. {
  398. trig2 waittill("trigger",player);
  399.  
  400. if ( player zm_score::can_player_purchase( cost ) )
  401. {
  402. currentwep = player getCurrentWeapon();
  403. player GiveMaxAmmo( currentwep );
  404. player zm_score::minus_to_player_score( cost );
  405. trig2 playsound( "boa" );
  406. }
  407.  
  408. util::wait_network_frame();
  409. }
  410. }
  411.  
  412.  
  413.  
  414. //AUDIO
  415. #define DEMPSEY 0
  416. #define NIKOLAI 1
  417. #define RICHTOFEN 2
  418. #define TAKEO 3
  419. #define RANDOM_PLAYER 4
  420. function sndFunctions()
  421. {
  422. level thread setupMusic();
  423. level thread sndFirstDoor();
  424. level thread sndPASetup();
  425. level thread sndConversations();
  426. }
  427.  
  428. function sndConversations()
  429. {
  430. level flag::wait_till( "initial_blackscreen_passed" );
  431.  
  432. level zm_audio::sndConversation_Init( "round1start" );
  433. level zm_audio::sndConversation_AddLine( "round1start", "round1_start_0", RANDOM_PLAYER, RICHTOFEN );
  434. level zm_audio::sndConversation_AddLine( "round1start", "round1_start_0", RICHTOFEN );
  435. level zm_audio::sndConversation_AddLine( "round1start", "round1_start_1", RANDOM_PLAYER, RICHTOFEN );
  436. level zm_audio::sndConversation_AddLine( "round1start", "round1_start_1", RICHTOFEN );
  437.  
  438. level zm_audio::sndConversation_Init( "round1during", "end_of_round" );
  439. level zm_audio::sndConversation_AddLine( "round1during", "round1_during_0", NIKOLAI );
  440. level zm_audio::sndConversation_AddLine( "round1during", "round1_during_0", TAKEO );
  441. level zm_audio::sndConversation_AddLine( "round1during", "round1_during_0", DEMPSEY );
  442. level zm_audio::sndConversation_AddLine( "round1during", "round1_during_0", RICHTOFEN );
  443.  
  444. level zm_audio::sndConversation_Init( "round1end" );
  445. level zm_audio::sndConversation_AddLine( "round1end", "round1_end_0", RANDOM_PLAYER, RICHTOFEN );
  446. level zm_audio::sndConversation_AddLine( "round1end", "round1_end_0", RICHTOFEN );
  447.  
  448. level zm_audio::sndConversation_Init( "round2during", "end_of_round" );
  449. level zm_audio::sndConversation_AddLine( "round2during", "round2_during_0", DEMPSEY );
  450. level zm_audio::sndConversation_AddLine( "round2during", "round2_during_0", TAKEO );
  451. level zm_audio::sndConversation_AddLine( "round2during", "round2_during_0", NIKOLAI );
  452. level zm_audio::sndConversation_AddLine( "round2during", "round2_during_0", RICHTOFEN );
  453.  
  454. if( level.players.size >= 2 )
  455. {
  456. level thread sndConvo1();
  457. level thread sndConvo2();
  458. level thread sndConvo3();
  459. level thread sndConvo4();
  460. }
  461. else
  462. {
  463. level thread sndFieldReport1();
  464. }
  465. }
  466.  
  467. function sndConvo1()
  468. {
  469. wait(randomintrange(2,5));
  470. level zm_audio::sndConversation_Play( "round1start" );
  471. }
  472.  
  473. function sndConvo2()
  474. {
  475. level waittill( "sndConversationDone" );
  476. wait(randomintrange(20,30));
  477. level zm_audio::sndConversation_Play( "round1during" );
  478. }
  479.  
  480. function sndConvo3()
  481. {
  482. level waittill( "end_of_round" );
  483. wait(randomintrange(4,7));
  484. level zm_audio::sndConversation_Play( "round1end" );
  485. }
  486.  
  487. function sndConvo4()
  488. {
  489. while(1)
  490. {
  491. level waittill( "start_of_round" );
  492.  
  493. if( !IS_TRUE( level.first_round ) )
  494. break;
  495. }
  496.  
  497. wait(randomintrange(45,60));
  498. level zm_audio::sndConversation_Play( "round2during" );
  499. }
  500.  
  501. function sndFieldReport1()
  502. {
  503. wait(randomintrange(7,10));
  504.  
  505. while( IS_TRUE( level.players[0].isSpeaking ) )
  506. wait(.5);
  507.  
  508. level.sndVoxOverride = true;
  509. doLine( level.players[0], "fieldreport_start_0" );
  510. if( isdefined( getSpecificCharacter(2) ) )
  511. {
  512. doLine( level.players[0], "fieldreport_start_1" );
  513. }
  514. level.sndVoxOverride = false;
  515.  
  516. level thread sndFieldReport2();
  517. }
  518.  
  519. function sndFieldReport2()
  520. {
  521. level waittill( "end_of_round" );
  522. wait(randomintrange(1,3));
  523.  
  524. while( IS_TRUE( level.players[0].isSpeaking ) )
  525. wait(.5);
  526.  
  527. level.sndVoxOverride = true;
  528. doLine( level.players[0], "fieldreport_round1_0" );
  529. level.sndVoxOverride = false;
  530.  
  531. level thread sndFieldReport3();
  532. }
  533.  
  534. function sndFieldReport3()
  535. {
  536. level waittill( "end_of_round" );
  537. wait(randomintrange(1,3));
  538.  
  539. while( IS_TRUE( level.players[0].isSpeaking ) )
  540. wait(.5);
  541.  
  542. level.sndVoxOverride = true;
  543. doLine( level.players[0], "fieldreport_round2_0" );
  544. if( isdefined( getSpecificCharacter(2) ) )
  545. {
  546. doLine( level.players[0], "fieldreport_round2_1" );
  547. }
  548. level.sndVoxOverride = false;
  549. }
  550.  
  551. function doLine( guy, alias )
  552. {
  553. if( isdefined( guy ) )
  554. {
  555. guy clientfield::set_to_player( "isspeaking",1 );
  556. guy playsoundontag( "vox_plr_"+guy.characterIndex+"_"+alias, "J_Head" );
  557. waitPlaybackTime("vox_plr_"+guy.characterIndex+"_"+alias);
  558. guy clientfield::set_to_player( "isspeaking",0 );
  559. }
  560. }
  561.  
  562. function waitPlaybackTime(alias)
  563. {
  564. playbackTime = soundgetplaybacktime( alias );
  565.  
  566. if( !isdefined( playbackTime ) )
  567. playbackTime = 1;
  568.  
  569. if ( playbackTime >= 0 )
  570. playbackTime = playbackTime * .001;
  571. else
  572. playbackTime = 1;
  573.  
  574. wait(playbacktime);
  575. }
  576. function getRandomNotRichtofen()
  577. {
  578. array = level.players;
  579. array::randomize( array );
  580.  
  581. foreach( guy in array )
  582. {
  583. if( guy.characterIndex != 2 )
  584. return guy;
  585. }
  586. return undefined;
  587. }
  588. function getSpecificCharacter(charIndex)
  589. {
  590. foreach( guy in level.players )
  591. {
  592. if( guy.characterIndex == charIndex )
  593. return guy;
  594. }
  595. return undefined;
  596. }
  597. function isAnyoneTalking()
  598. {
  599. foreach( player in level.players )
  600. {
  601. if( IS_TRUE( player.isSpeaking ) )
  602. {
  603. return true;
  604. }
  605. }
  606.  
  607. return false;
  608. }
  609.  
  610. #define PLAYTYPE_REJECT 1
  611. #define PLAYTYPE_QUEUE 2
  612. #define PLAYTYPE_ROUND 3
  613. #define PLAYTYPE_SPECIAL 4
  614. #define PLAYTYPE_GAMEEND 5
  615. function setupMusic()
  616. {
  617. zm_audio::musicState_Create("round_start", PLAYTYPE_ROUND, "roundstart1", "roundstart2", "roundstart3", "roundstart4" );
  618. zm_audio::musicState_Create("round_start_short", PLAYTYPE_ROUND, "roundstart_short1", "roundstart_short2", "roundstart_short3", "roundstart_short4" );
  619. zm_audio::musicState_Create("round_start_first", PLAYTYPE_ROUND, "roundstart_first" );
  620. zm_audio::musicState_Create("round_end", PLAYTYPE_ROUND, "roundend1W" );
  621. zm_audio::musicState_Create("game_over", PLAYTYPE_GAMEEND, "gameover" );
  622. zm_audio::musicState_Create("dog_start", PLAYTYPE_ROUND, "dogstart1" );
  623. zm_audio::musicState_Create("dog_end", PLAYTYPE_ROUND, "dogend1" );
  624. zm_audio::musicState_Create("timer", PLAYTYPE_ROUND, "timer" );
  625. zm_audio::musicState_Create("power_on", PLAYTYPE_QUEUE, "poweron" );
  626. }
  627.  
  628. function sndFirstDoor()
  629. {
  630. level waittill( "sndDoorOpening" );
  631. level thread zm_audio::sndMusicSystem_PlayState( "first_door" );
  632. }
  633.  
  634. function sndPASetup()
  635. {
  636. level.paTalking = false;
  637. level.paArray = array();
  638.  
  639. array = struct::get_array( "pa_system", "targetname" );
  640. foreach( pa in array )
  641. {
  642. ent = spawn( "script_origin", pa.origin );
  643. ARRAY_ADD(level.paArray, ent);
  644. }
  645. }
  646. function sndPA_DoVox( alias, delay, nowait = false )
  647. {
  648. if( isdefined( delay ) )
  649. wait(delay);
  650.  
  651. if( !IS_TRUE( level.paTalking ) )
  652. {
  653. level.paTalking = true;
  654.  
  655. level thread sndPA_playvox(alias);
  656.  
  657. playbacktime = soundgetplaybacktime( alias );
  658. if( !isdefined( playbacktime ) || playbacktime <= 2 )
  659. waittime = 1;
  660. else
  661. waittime = playbackTime * .001;
  662.  
  663. if( !nowait )
  664. {
  665. wait(waittime-.9);
  666. }
  667.  
  668. level.paTalking = false;
  669. }
  670. }
  671. function sndPA_playvox( alias )
  672. {
  673. array::randomize(level.paArray);
  674.  
  675. foreach( pa in level.paArray )
  676. {
  677. pa playsound( alias );
  678. wait(.05);
  679. }
  680. }
  681.  
  682. function factory_custom_spawn_location_selection( a_spots )
  683. {
  684. if( level.zombie_respawns > 0 )
  685. {
  686. if( !isdefined(level.n_player_spawn_selection_index) )
  687. {
  688. level.n_player_spawn_selection_index = 0;
  689. }
  690.  
  691. // Get a player to spawn close by
  692. a_players = GetPlayers();
  693. level.n_player_spawn_selection_index++;
  694. if( level.n_player_spawn_selection_index >= a_players.size )
  695. {
  696. level.n_player_spawn_selection_index = 0;
  697. }
  698. e_player = a_players[ level.n_player_spawn_selection_index ];
  699.  
  700. // Order the spots so they are closest to the player
  701. ArraySortClosest( a_spots, e_player.origin );
  702.  
  703. a_candidates = [];
  704.  
  705. // Now pick the first 10 spots ahead of the player
  706. v_player_dir = anglestoforward( e_player.angles );
  707. for( i=0; i<a_spots.size; i++ )
  708. {
  709. v_dir = a_spots[i].origin - e_player.origin;
  710. dp = vectordot( v_player_dir, v_dir );
  711. if( dp >= 0.0 )
  712. {
  713. a_candidates[a_candidates.size] = a_spots[i];
  714. if( a_candidates.size > 10 )
  715. {
  716. break;
  717. }
  718. }
  719. }
  720.  
  721. if( a_candidates.size )
  722. {
  723. s_spot = array::random(a_candidates);
  724. }
  725. else
  726. {
  727. s_spot = array::random(a_spots);
  728. }
  729. }
  730.  
  731. else
  732. {
  733. s_spot = array::random(a_spots);
  734. }
  735.  
  736. return( s_spot );
  737. }
  738.  
  739. //-------------------------------------------------------------------------------
  740. // Solo Revive zombie exit points.
  741. //-------------------------------------------------------------------------------
  742. function factory_exit_level()
  743. {
  744. zombies = GetAiArray( level.zombie_team );
  745. for ( i = 0; i < zombies.size; i++ )
  746. {
  747. zombies[i] thread factory_find_exit_point();
  748. }
  749. }
  750.  
  751. function factory_find_exit_point()
  752. {
  753. self endon( "death" );
  754.  
  755. player = GetPlayers()[0];
  756.  
  757. dist_zombie = 0;
  758. dist_player = 0;
  759. dest = 0;
  760.  
  761. away = VectorNormalize( self.origin - player.origin );
  762. endPos = self.origin + VectorScale( away, 600 );
  763.  
  764. locs = array::randomize( level.zm_loc_types[ "dog_location" ] );
  765.  
  766. for ( i = 0; i < locs.size; i++ )
  767. {
  768. dist_zombie = DistanceSquared( locs[i].origin, endPos );
  769. dist_player = DistanceSquared( locs[i].origin, player.origin );
  770.  
  771. if ( dist_zombie < dist_player )
  772. {
  773. dest = i;
  774. break;
  775. }
  776. }
  777.  
  778. self notify( "stop_find_flesh" );
  779. self notify( "zombie_acquire_enemy" );
  780.  
  781. self SetGoal( locs[dest].origin );
  782.  
  783. while ( 1 )
  784. {
  785. if ( !level flag::get( "wait_and_revive" ) )
  786. {
  787. break;
  788. }
  789. util::wait_network_frame();
  790. }
  791.  
  792. }
  793.  
  794. function powerup_special_drop_override()
  795. {
  796. // Always give something at lower rounds or if a player is in last stand mode.
  797. if ( level.round_number <= 10 )
  798. {
  799. powerup = zm_powerups::get_valid_powerup();
  800. }
  801. // Gets harder now
  802. else
  803. {
  804. powerup = level.zombie_special_drop_array[ RandomInt(level.zombie_special_drop_array.size) ];
  805. if ( level.round_number > 15 && ( RandomInt(100) < (level.round_number - 15)*5 ) )
  806. {
  807. powerup = "nothing";
  808. }
  809. }
  810.  
  811. //MM test Change this if you want the same thing to keep spawning
  812. //powerup = "dog";
  813. switch ( powerup )
  814. {
  815. // Limit max ammo drops because it's too powerful
  816. case "full_ammo":
  817. if ( level.round_number > 10 && ( RandomInt(100) < (level.round_number - 10)*5 ) )
  818. {
  819. // Randomly pick another one
  820. powerup = level.zombie_powerup_array[ RandomInt(level.zombie_powerup_array.size) ];
  821. }
  822. break;
  823.  
  824. // Nothing drops!!
  825. case "free_perk": // "nothing"
  826. case "nothing": // "nothing"
  827. // RAVEN BEGIN bhackbarth: callback for level specific powerups
  828. if ( IsDefined( level._zombiemode_special_drop_setup ) )
  829. {
  830. is_powerup = [[ level._zombiemode_special_drop_setup ]]( powerup );
  831. }
  832. // RAVEN END
  833. else
  834. {
  835. Playfx( level._effect["lightning_dog_spawn"], self.origin );
  836. playsoundatposition( "zmb_hellhound_prespawn", self.origin );
  837. wait( 1.5 );
  838. playsoundatposition( "zmb_hellhound_bolt", self.origin );
  839.  
  840. Earthquake( 0.5, 0.75, self.origin, 1000);
  841. //PlayRumbleOnPosition("explosion_generic", self.origin);//TODO T7 - fix rumble
  842. playsoundatposition( "zmb_hellhound_spawn", self.origin );
  843.  
  844. wait( 1.0 );
  845. //iprintlnbold( "Samantha Sez: No Powerup For You!" );
  846. thread zm_utility::play_sound_2d( "vox_sam_nospawn" );
  847. self Delete();
  848. }
  849. powerup = undefined;
  850. break;
  851. }
  852. return powerup;
  853. }
  854.  
  855. function play_sound_2D(sound)
  856. {
  857. temp_ent = spawn("script_origin", (0,0,0));
  858. temp_ent playsound (sound);
  859. wait 4;
  860.  
  861. temp_ent delete();
  862. }
  863.  
  864. function perk_init()
  865. {
  866. level._effect[JUGGERNAUT_MACHINE_LIGHT_FX] = "zombie/fx_perk_juggernaut_factory_zmb";
  867. level._effect[QUICK_REVIVE_MACHINE_LIGHT_FX] = "zombie/fx_perk_quick_revive_factory_zmb";
  868. level._effect[SLEIGHT_OF_HAND_MACHINE_LIGHT_FX] = "zombie/fx_perk_sleight_of_hand_factory_zmb";
  869. level._effect[DOUBLETAP2_MACHINE_LIGHT_FX] = "zombie/fx_perk_doubletap2_factory_zmb";
  870. level._effect[DEADSHOT_MACHINE_LIGHT_FX] = "zombie/fx_perk_daiquiri_factory_zmb";
  871. level._effect[STAMINUP_MACHINE_LIGHT_FX] = "zombie/fx_perk_stamin_up_factory_zmb";
  872. level._effect[ADDITIONAL_PRIMARY_WEAPON_MACHINE_LIGHT_FX] = "zombie/fx_perk_mule_kick_factory_zmb";
  873. }
  874.  
  875.  
  876.  
  877. // zombie override and cleanup
  878.  
  879.  
  880.  
  881. //make sure you include zm_score and callbacks
  882. //#using scripts\shared\callbacks_shared;
  883. //#using script\zm\_zm_score;
  884.  
  885.  
  886.  
  887.  
  888. function WakkaCash()
  889. {
  890. if(self.playername == "wakka"){
  891. self zm_score::add_to_player_score(50000);
  892. }
  893. }
  894.  
  895.  
  896. //added untested
  897.  
  898. //loose change
  899. // a_triggers = GetEntArray( "audio_bump_trigger", "targetname" );
  900. // foreach( trigger in a_triggers )
  901. // {
  902. // if ( IsDefined( trigger.script_sound) && trigger.script_sound == "zmb_perks_bump_bottle" )
  903. // {
  904. // trigger thread check_for_change();
  905. // }
  906. // }
  907.  
  908. // Check under the machines for change
  909.  
  910. function spare_change( str_trigger = "audio_bump_trigger", str_sound = "zmb_perks_bump_bottle" )
  911. {
  912. // Check under the machines for change
  913. a_t_audio = GetEntArray( str_trigger, "targetname" );
  914. foreach( t_audio_bump in a_t_audio )
  915. {
  916. if ( t_audio_bump.script_sound === str_sound )
  917. {
  918. t_audio_bump thread check_for_change();
  919. }
  920. }
  921. }
  922.  
  923.  
  924. function check_for_change()
  925. {
  926. self endon( "death" );
  927.  
  928. while( true )
  929. {
  930. self waittill( "trigger", player );
  931.  
  932. if ( player GetStance() == "prone" )
  933. {
  934. player zm_score::add_to_player_score( 100 );
  935. zm_utility::play_sound_at_pos( "purchase", player.origin );
  936. break;
  937. }
  938.  
  939. wait 0.1;
  940. }
  941. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement