buyable end game not working in game

broken avatar :(
Created 2607 days ago
by jzob1234
0 Members and 1 Guest are viewing this topic.
4,806 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 5 August 2012
Last active: 1543 days ago
Posts
304
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
im aggressive
Signature
:D
×
jzob1234's Groups
jzob1234's Contact & Social Linksjzobjzob123
[You are not allowed to view external links. Register or Login to see them] this is what hapens

plz help thank you
broken avatar :(
×
broken avatar :(
[UGX] Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 8 days ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
Signature
[You are not allowed to view external links. Register or Login to see them]
(Click to enter portfolio)
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
paste your mapname.gsc in a code box so I can see how you placed your code.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 5 August 2012
Last active: 1543 days ago
Posts
304
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
im aggressive
×
jzob1234's Groups
jzob1234's Contact & Social Linksjzobjzob123
paste your mapname.gsc in a code box so I can see how you placed your code.
/*
Der Frost / Nazi Zombie Sniperbolt Tutorial Version 2.0
Scripter: Sparks
Tutorial: Sniperbolt

Version 1.0 (9/24/2009 7:51:18 PM)
-- Initial Release Of Source Files
*/

// Tutorial From Sniperbolt!

// Utilities
#include common_scripts\utility;
#include maps\_utility;
#include maps\_zombiemode_utility;
#include maps\_zombiemode_zone_manager;
#include maps\_music;

// DLC3 Utilities
#include maps\dlc3_code;
#include maps\dlc3_teleporter;

main()
{
level.DLC3 = spawnStruct(); // Leave This Line Or Else It Breaks Everything

// Must Change These To Your Maps
level.DLC3.createArt = maps\createart\nazi_zombie_backyard_art::main;
level.DLC3.createFX = maps\createfx\nazi_zombie_backyard_fx::main;
// level.DLC3.myFX = ::preCacheMyFX;

/*--------------------
FX
----------------------*/
DLC3_FX();

/*--------------------
LEVEL VARIABLES
----------------------*/

// Variable Containing Helpful Text For Modders -- Don't Remove
level.modderHelpText = [];

//
// Change Or Tweak All Of These LEVEL.DLC3 Variables Below For Your Level If You Wish
//

// Edit The Value In Mod.STR For Your Level Introscreen Place
level.DLC3.introString = &"nazi zombie tes";

// Weapons. Pointer function automatically loads weapons used in Der Riese.
level.DLC3.weapons = maps\dlc3_code::include_weapons;

// Power Ups. Pointer function automatically loads power ups used in Der Riese.
level.DLC3.powerUps =  maps\dlc3_code::include_powerups;

// Adjusts how much melee damage a player with the perk will do, needs only be set once. Stock is 1000.
level.DLC3.perk_altMeleeDamage = 1000;

// Adjusts barrier search override. Stock is 400.
level.DLC3.barrierSearchOverride = 400;

// Adjusts power up drop max per round. Stock is 3.
level.DLC3.powerUpDropMax = 3;

// _loadout Variables
level.DLC3.useCoopHeroes = true;

// Bridge Feature
level.DLC3.useBridge = false;

// Hell Hounds
level.DLC3.useHellHounds = true;

// Mixed Rounds
level.DLC3.useMixedRounds = true;

// Magic Boxes -- The Script_Noteworthy Value Names On Purchase Trigger In Radiant
boxArray = [];
boxArray[ boxArray.size ] = "start_chest";
boxArray[ boxArray.size ] = "chest1";
boxArray[ boxArray.size ] = "chest2";
boxArray[ boxArray.size ] = "chest3";
boxArray[ boxArray.size ] = "chest4";
boxArray[ boxArray.size ] = "chest5";
level.DLC3.PandoraBoxes = boxArray;

// Initial Zone(s) -- Zone(s) You Want Activated At Map Start
zones = [];
zones[ zones.size ] = "start_zone";
level.DLC3.initialZones = zones;

// Electricity Switch -- If False Map Will Start With Power On
level.DLC3.useElectricSwitch = true;

// Electric Traps
level.DLC3.useElectricTraps = true;

// _zombiemode_weapons Variables
level.DLC3.usePandoraBoxLight = true;
level.DLC3.useChestPulls = true;
level.DLC3.useChestMoves = true;
level.DLC3.useWeaponSpawn = true;
level.DLC3.useGiveWeapon = true;

// _zombiemode_spawner Varibles
level.DLC3.riserZombiesGoToDoorsFirst = true;
level.DLC3.riserZombiesInActiveZonesOnly = true;
level.DLC3.assureNodes = true;

// _zombiemode_perks Variables
level.DLC3.perksNeedPowerOn = true;

// _zombiemode_devgui Variables
level.DLC3.powerSwitch = true;

/*--------------------
FUNCTION CALLS - PRE _Load
----------------------*/
level thread DLC3_threadCalls();

/*--------------------
ZOMBIE MODE
----------------------*/
[[level.DLC3.weapons]]();
[[level.DLC3.powerUps]]();
maps\_zombiemode::main();
trig = GetEnt("end_game", "targetname");
trig thread end_game();
maps\buy_powerup::main();
/*--------------------
FUNCTION CALLS - POST _Load
----------------------*/
level.zone_manager_init_func = ::dlc3_zone_init;
level thread DLC3_threadCalls2();
}

dlc3_zone_init()
{

add_adjacent_zone( "initial_zone", "zone1", "enter_zone1" );
add_adjacent_zone( "zone1", "zone2", "enter_zone2" );
/*
=============
///ScriptDocBegin
"Name: add_adjacent_zone( <zone_1>, <zone_2>, <flag>, <one_way> )"
"Summary: Sets up adjacent zones."
"MandatoryArg: <zone_1>: Name of first Info_Volume"
"MandatoryArg: <zone_2>: Name of second Info_Volume"
"MandatoryArg: <flag>: Flag to be set to initiate zones"
"OptionalArg: <one_way>: Make <zone_1> adjacent to <zone_2>. Defaults to false."
"Example: add_adjacent_zone( "receiver_zone", "outside_east_zone", "enter_outside_east" );"
///ScriptDocEnd
=============
*/

// Outside East Door
//add_adjacent_zone( "receiver_zone", "outside_east_zone", "enter_outside_east" );
}

end_game()
{
    user = undefined;
    cost = 20000;                                        //change to cost that you want

    self setCursorHint("HINT_NOICON");
    self UseTriggerRequireLookAt();
    self setHintString("The power must be activated first");                //remove line if you want it to work without power

    flag_wait( "electricity_on" );                                //remove line if you want it to work without power

    self setHintString("press &&1 to End the Game [Cost: "+cost+"]");            //text hint trigger

    while(1)
    {
        self waittill("trigger", user);
        if( is_player_valid(user) && user.score >= cost )
        {
            play_sound_at_pos( "cha_ching", self.origin );
            user thread maps\_zombiemode_score::minus_to_player_score( cost );
            self delete();

            level notify( "end_game" );
                        level notify("tom_planes");
            level.tom_victory = true;
        }
        else
        {
            play_sound_at_pos( "no_cha_ching", self.origin );
        }
    }
}
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 5 August 2012
Last active: 1543 days ago
Posts
304
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
im aggressive
×
jzob1234's Groups
jzob1234's Contact & Social Linksjzobjzob123
this is my _zombiemode.gsc jest in case theirs something wrong in it

#include maps\_anim; 
#include maps\_utility;
#include common_scripts\utility;
#include maps\_music;
#include maps\_zombiemode_utility;
#include maps\_busing;

#using_animtree( "generic_human" );

main(init_zombie_spawner_name)
{
precache_shaders();
precache_models();

PrecacheItem( "fraggrenade" );
PrecacheItem( "colt" );

init_strings();
init_levelvars();
init_animscripts();
init_sounds();
init_shellshocks();
init_flags();

//Limit zombie to 24 max, must have for network purposes
SetAILimit( 24 );
// the initial spawners
if( !IsDefined( init_zombie_spawner_name) )
{
level.enemy_spawns = getEntArray( "zombie_spawner_init", "targetname" );
}
else
{
level.enemy_spawns = getEntArray( init_zombie_spawner_name, "targetname" );
}

level.zombie_rise_spawners = [];

//maps\_destructible_type94truck::init();

level.custom_introscreen = ::zombie_intro_screen;
level.custom_intermission = ::player_intermission;
level.reset_clientdvars = ::onPlayerConnect_clientDvars;

init_fx();


// load map defaults
maps\_load::main();

level.hudelem_count = 0;
// Call the other zombiemode scripts
if( level.script == "nazi_zombie_sumpf" )
{
maps\_zombiemode_weapons_sumpf::init();
}
else
{
maps\_zombiemode_weapons::init();
}
maps\_zombiemode_blockers_new::init();
maps\_zombiemode_spawner::init();
maps\_zombiemode_powerups::init();
maps\_zombiemode_radio::init();
maps\_zombiemode_perks::init();
maps\_zombiemode_tesla::init();
maps\_zombiemode_bowie::bowie_init();
maps\_zombiemode_cymbal_monkey::init();
maps\_zombiemode_betty::init();
maps\_zombiemode_timer::init();
maps\_zombiemode_auto_turret::init();

/#
maps\_zombiemode_devgui::init();
#/

init_utility();

// register a client system...
maps\_utility::registerClientSys("zombify");

// level thread coop_player_spawn_placement();

// zombie ai and anim inits
init_anims();

if( isDefined( level.custom_ai_type ) )
{
for( i = 0; i < level.custom_ai_type.size; i++ )
{
[[ level.custom_ai_type[i] ]]();
}
}


// Sets up function pointers for animscripts to refer to
level.playerlaststand_func = ::player_laststand;
// level.global_kill_func = maps\_zombiemode_spawner::zombie_death;
level.global_damage_func = maps\_zombiemode_spawner::zombie_damage;
level.global_damage_func_ads = maps\_zombiemode_spawner::zombie_damage_ads;
level.overridePlayerKilled = ::player_killed_override;
level.overridePlayerDamage = ::player_damage_override;

level.melee_miss_func = maps\_zombiemode::zombiemode_melee_miss;

if( !IsDefined( level.Player_Spawn_func ) )
{
level.Player_Spawn_func = ::coop_player_spawn_placement;
}

level thread [[level.Player_Spawn_func]]();
// used to a check in last stand for players to become zombies
level.is_zombie_level = true;
level.player_becomes_zombie = ::zombify_player;

// so we dont get the uber colt when we're knocked out
level.laststandpistol = "colt";

level.round_start_time = 0;

level thread onPlayerConnect();

init_dvars();
initZombieLeaderboardData();


flag_wait( "all_players_connected" );

bbPrint( "sessions: mapname %s gametype zom isserver 1", level.script );



//thread zombie_difficulty_ramp_up();

// Start the Zombie MODE!
level thread end_game();
level thread round_start();
level thread players_playing();
if ( IsDefined( level.crawlers_enabled ) && level.crawlers_enabled == 1 )
{
level thread crawler_round_tracker();
}

//chrisp - adding spawning vo
level thread spawn_vo();

//add ammo tracker for VO
level thread track_players_ammo_count();

//level thread prevent_near_origin();

DisableGrenadeSuicide();

level.startInvulnerableTime = GetDvarInt( "player_deathInvulnerableTime" );

// Do a SaveGame, so we can restart properly when we die
SaveGame( "zombie_start", &"AUTOSAVE_LEVELSTART", "", true );

// TESTING
// wait( 3 );
// level thread intermission();
// thread testing_spawner_bug();

if(!IsDefined(level.eggs) )
{
level.eggs = 0;
}
}

zombiemode_melee_miss()
{
if( isDefined( self.enemy.curr_pay_turret ) )
{
self.enemy DoDamage( (60 / GetDvarFloat("player_damageMultiplier")), self.origin, self, self );
}
}

/*------------------------------------
chrisp - adding vo to track players ammo
------------------------------------*/
track_players_ammo_count()
{
self endon("disconnect");
self endon("death");
if(!IsDefined (level.player_ammo_low))
{
level.player_ammo_low = 0;
}
if(!IsDefined(level.player_ammo_out))
{
level.player_ammo_out = 0;
}
while(1)
{
players = get_players();
for(i=0;i<players.size;i++)
{

weap = players[i] getcurrentweapon();
//iprintln("current weapon: " + weap);
//iprintlnbold(weap);
//Excludes all Perk based 'weapons' so that you don't get low ammo spam.
if(!isDefined(weap) || weap == "none" || weap == "zombie_perk_bottle_doubletap" || weap == "zombie_perk_bottle_jugg" || weap == "zombie_perk_bottle_revive" || weap == "zombie_perk_bottle_sleight" || weap == "mine_bouncing_betty" || weap == "syrette" || weap == "zombie_knuckle_crack" || weap == "zombie_bowie_flourish" )
{
continue;
}
//iprintln("checking ammo for " + weap);
if ( players[i] GetAmmoCount( weap ) > 5)
{
continue;
}
if ( players[i] maps\_laststand::player_is_in_laststand() )
{
continue;
}
else if (players[i] GetAmmoCount( weap ) < 5 && players[i] GetAmmoCount( weap ) > 0)
{
if (level.player_ammo_low == 0)
{
level.player_ammo_low = 1;
players[i] thread add_low_ammo_dialog();
players[i] thread ammo_dialog_timer();
level waittill("send_dialog_reminder");
level.player_ammo_low = 0;
}

}
else if (players[i] GetAmmoCount( weap ) == 0)
{
if(!isDefined(weap) || weap == "none")
{
continue;
}
level.player_ammo_out = 1;
players[i] thread add_no_ammo_dialog( weap );
//put in this wait to keep the game from spamming about being low on ammo.
wait(20);
level.player_ammo_out = 0;
}
else
{
continue;
}
}
wait(.5);
}
}
ammo_dialog_timer()
{
level endon ("ammo_out");
while(1)
{
wait(20);
level notify ("send_dialog_reminder");

}

}
add_low_ammo_dialog()
{
index = maps\_zombiemode_weapons::get_player_index(self);
player_index = "plr_" + index + "_";
if(!IsDefined (self.vox_ammo_low))
{
num_variants = maps\_zombiemode_spawner::get_number_variants(player_index + "vox_ammo_low");
self.vox_ammo_low = [];
for(i=0;i<num_variants;i++)
{
self.vox_ammo_low[self.vox_ammo_low.size] = "vox_ammo_low_" + i;
}
self.vox_ammo_low_available = self.vox_ammo_low;
}
sound_to_play = random(self.vox_ammo_low_available);

self.vox_ammo_low_available = array_remove(self.vox_ammo_low_available,sound_to_play);

if (self.vox_ammo_low_available.size < 1 )
{
self.vox_ammo_low_available = self.vox_ammo_low;
}

self maps\_zombiemode_spawner::do_player_playdialog(player_index, sound_to_play, 0.25);



}
add_no_ammo_dialog( weap )
{
self endon( "disconnect" );

// Let's pause here a couple of seconds to see if we're really out of ammo.
// If you take a weapon, there's a second or two where your current weapon
// will be set to no ammo while you switch to the new one.
wait(2);

curr_weap = self getcurrentweapon();
if ( !IsDefined(curr_weap) || curr_weap != weap || self GetAmmoCount( curr_weap ) != 0 )
{
// False alarm
return;
}


index = maps\_zombiemode_weapons::get_player_index(self);
player_index = "plr_" + index + "_";
if(!IsDefined (self.vox_ammo_out))
{
num_variants = maps\_zombiemode_spawner::get_number_variants(player_index + "vox_ammo_out");
self.vox_ammo_out = [];
for(i=0;i<num_variants;i++)
{
self.vox_ammo_out[self.vox_ammo_out.size] = "vox_ammo_out_" + i;
}
self.vox_ammo_out_available = self.vox_ammo_out;
}
sound_to_play = random(self.vox_ammo_out_available);

self.vox_ammo_out_available = array_remove(self.vox_ammo_out_available,sound_to_play);

if (self.vox_ammo_out_available.size < 1 )
{
self.vox_ammo_out_available = self.vox_ammo_out;
}

self maps\_zombiemode_spawner::do_player_playdialog(player_index, sound_to_play, 0.25);



}
/*------------------------------------
audio plays when more than 1 player connects
------------------------------------*/
spawn_vo()
{
//not sure if we need this
wait(1);

players = getplayers();

//just pick a random player for now and play some vo
if(players.size > 1)
{
player = random(players);
index = maps\_zombiemode_weapons::get_player_index(player);
player thread spawn_vo_player(index,players.size);
}

}

spawn_vo_player(index,num)
{
sound = "plr_" + index + "_vox_" + num +"play";
self playsound(sound, "sound_done");
self waittill("sound_done");
}

testing_spawner_bug()
{
wait( 0.1 );
level.round_number = 7;

spawners = [];
spawners[0] = GetEnt( "testy", "targetname" );
while( 1 )
{
wait( 1 );
level.enemy_spawns = spawners;
}
}

precache_shaders()
{
PrecacheShader( "hud_chalk_1" );
PrecacheShader( "hud_chalk_2" );
PrecacheShader( "hud_chalk_3" );
PrecacheShader( "hud_chalk_4" );
PrecacheShader( "hud_chalk_5" );
}

precache_models()
{
precachemodel( "char_ger_honorgd_zomb_behead" );
precachemodel( "char_ger_zombieeye" );
PrecacheModel( "tag_origin" );
}

init_shellshocks()
{
level.player_killed_shellshock = "zombie_death";
PrecacheShellshock( level.player_killed_shellshock );
}

init_strings()
{
PrecacheString( &"ZOMBIE_WEAPONCOSTAMMO" );
PrecacheString( &"ZOMBIE_ROUND" );
PrecacheString( &"SCRIPT_PLUS" );
PrecacheString( &"ZOMBIE_GAME_OVER" );
PrecacheString( &"ZOMBIE_SURVIVED_ROUND" );
PrecacheString( &"ZOMBIE_SURVIVED_ROUNDS" );

add_zombie_hint( "undefined", &"ZOMBIE_UNDEFINED" );

// Random Treasure Chest
add_zombie_hint( "default_treasure_chest_950", &"ZOMBIE_RANDOM_WEAPON_950" );

// Barrier Pieces
add_zombie_hint( "default_buy_barrier_piece_10", &"ZOMBIE_BUTTON_BUY_BACK_BARRIER_10" );
add_zombie_hint( "default_buy_barrier_piece_20", &"ZOMBIE_BUTTON_BUY_BACK_BARRIER_20" );
add_zombie_hint( "default_buy_barrier_piece_50", &"ZOMBIE_BUTTON_BUY_BACK_BARRIER_50" );
add_zombie_hint( "default_buy_barrier_piece_100", &"ZOMBIE_BUTTON_BUY_BACK_BARRIER_100" );

// REWARD Barrier Pieces
add_zombie_hint( "default_reward_barrier_piece", &"ZOMBIE_BUTTON_REWARD_BARRIER" );
add_zombie_hint( "default_reward_barrier_piece_10", &"ZOMBIE_BUTTON_REWARD_BARRIER_10" );
add_zombie_hint( "default_reward_barrier_piece_20", &"ZOMBIE_BUTTON_REWARD_BARRIER_20" );
add_zombie_hint( "default_reward_barrier_piece_30", &"ZOMBIE_BUTTON_REWARD_BARRIER_30" );
add_zombie_hint( "default_reward_barrier_piece_40", &"ZOMBIE_BUTTON_REWARD_BARRIER_40" );
add_zombie_hint( "default_reward_barrier_piece_50", &"ZOMBIE_BUTTON_REWARD_BARRIER_50" );

// Debris
add_zombie_hint( "default_buy_debris_100", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_100" );
add_zombie_hint( "default_buy_debris_200", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_200" );
add_zombie_hint( "default_buy_debris_250", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_250" );
add_zombie_hint( "default_buy_debris_500", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_500" );
add_zombie_hint( "default_buy_debris_750", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_750" );
add_zombie_hint( "default_buy_debris_1000", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_1000" );
add_zombie_hint( "default_buy_debris_1250", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_1250" );
add_zombie_hint( "default_buy_debris_1500", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_1500" );
add_zombie_hint( "default_buy_debris_1750", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_1750" );
add_zombie_hint( "default_buy_debris_2000", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_2000" );
add_zombie_hint( "default_buy_debris_2500", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_2500" );
add_zombie_hint( "default_buy_debris_3000", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_3000" );
add_zombie_hint( "default_buy_debris_3500", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_3500" );
add_zombie_hint( "default_buy_debris_4000", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_4000" );

// Doors
add_zombie_hint( "default_buy_door_100", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_100" );
add_zombie_hint( "default_buy_door_200", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_200" );
add_zombie_hint( "default_buy_door_250", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_250" );
add_zombie_hint( "default_buy_door_500", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_500" );
add_zombie_hint( "default_buy_door_750", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_750" );
add_zombie_hint( "default_buy_door_1000", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_1000" );
add_zombie_hint( "default_buy_door_1250", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_1250" );
add_zombie_hint( "default_buy_door_1500", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_1500" );
add_zombie_hint( "default_buy_door_1750", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_1750" );
add_zombie_hint( "default_buy_door_2000", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_2000" );
add_zombie_hint( "default_buy_door_2500", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_2500" );
add_zombie_hint( "default_buy_door_3000", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_3000" );
add_zombie_hint( "default_buy_door_3500", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_3500" );
add_zombie_hint( "default_buy_door_4000", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_4000" );

// Areas
add_zombie_hint( "default_buy_area_100", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_100" );
add_zombie_hint( "default_buy_area_200", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_200" );
add_zombie_hint( "default_buy_area_250", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_250" );
add_zombie_hint( "default_buy_area_500", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_500" );
add_zombie_hint( "default_buy_area_750", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_750" );
add_zombie_hint( "default_buy_area_1000", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_1000" );
add_zombie_hint( "default_buy_area_1250", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_1250" );
add_zombie_hint( "default_buy_area_1500", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_1500" );
add_zombie_hint( "default_buy_area_1750", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_1750" );
add_zombie_hint( "default_buy_area_2000", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_2000" );
}

init_sounds()
{
add_sound( "end_of_round", "round_over" );
add_sound( "end_of_game", "mx_game_over" ); //Had to remove this and add a music state switch so that we can add other musical elements.
add_sound( "chalk_one_up", "chalk" );
add_sound( "purchase", "cha_ching" );
add_sound( "no_purchase", "no_cha_ching" );

// Zombification
// TODO need to vary these up
add_sound( "playerzombie_usebutton_sound", "attack_vocals" );
add_sound( "playerzombie_attackbutton_sound", "attack_vocals" );
add_sound( "playerzombie_adsbutton_sound", "attack_vocals" );

// Head gib
add_sound( "zombie_head_gib", "zombie_head_gib" );

// Blockers
add_sound( "rebuild_barrier_piece", "repair_boards" );
add_sound( "rebuild_barrier_hover", "boards_float" );
add_sound( "debris_hover_loop", "couch_loop" );
add_sound( "break_barrier_piece", "break_boards" );
add_sound("blocker_end_move", "board_slam");
add_sound( "barrier_rebuild_slam", "board_slam" );

// Doors
add_sound( "door_slide_open", "door_slide_open" );
add_sound( "door_rotate_open", "door_slide_open" );

// Debris
add_sound( "debris_move", "weap_wall" );

// Random Weapon Chest
add_sound( "open_chest", "lid_open" );
add_sound( "music_chest", "music_box" );
add_sound( "close_chest", "lid_close" );

// Weapons on walls
add_sound( "weapon_show", "weap_wall" );

}

init_levelvars()
{
level.intermission = false;
level.dog_intermission = false;
level.zombie_total = 0;
level.no_laststandmissionfail = true;

level.zombie_vars = [];

// Default to not zombify the player till further support
set_zombie_var( "zombify_player", false );

set_zombie_var( "below_world_check", -1000 );

// Respawn in the spectators in between rounds
set_zombie_var( "spectators_respawn", true );

// Round
set_zombie_var( "zombie_use_failsafe", true );
set_zombie_var( "zombie_round_time", 30 );
set_zombie_var( "zombie_between_round_time", 4 );
set_zombie_var( "zombie_intermission_time", 15 );

// Spawning
set_zombie_var( "zombie_spawn_delay", 2 );



// AI
set_zombie_var( "zombie_health_increase", 100 );
set_zombie_var( "zombie_health_increase_percent", 10, 100 );
set_zombie_var( "zombie_health_start", 150 );
set_zombie_var( "zombie_max_ai", 24 );
set_zombie_var( "zombie_ai_per_player", 6 );

// Scoring
set_zombie_var( "zombie_score_start", 100 );
/#
if( GetDvarInt( "zombie_cheat" ) >= 1 )
{
set_zombie_var( "zombie_score_start", 100000 );
}
#/
set_zombie_var( "zombie_score_kill", 50 );
set_zombie_var( "zombie_score_damage", 5 );
set_zombie_var( "zombie_score_bonus_melee", 80 );
set_zombie_var( "zombie_score_bonus_head", 50 );
set_zombie_var( "zombie_score_bonus_neck", 20 );
set_zombie_var( "zombie_score_bonus_torso", 10 );
set_zombie_var( "zombie_score_bonus_burn", 10 );

set_zombie_var( "penalty_no_revive_percent", 10, 100 );
set_zombie_var( "penalty_died_percent", 0, 100 );
set_zombie_var( "penalty_downed_percent", 5, 100 );

set_zombie_var( "zombie_flame_dmg_point_delay", 500 );

if ( IsSplitScreen() )
{
set_zombie_var( "zombie_timer_offset", 280 ); // hud offsets
}
}

init_dvars()
{
level.zombiemode = true;

//coder mod: tkeegan - new code dvar
setSavedDvar( "zombiemode", "1" );
SetDvar( "ui_gametype", "zom" );
setSavedDvar( "fire_world_damage", "0" );
setSavedDvar( "fire_world_damage_rate", "0" );
setSavedDvar( "fire_world_damage_duration", "0" );

if( GetDvar( "zombie_debug" ) == "" )
{
SetDvar( "zombie_debug", "0" );
}

if( GetDvar( "zombie_cheat" ) == "" )
{
SetDvar( "zombie_cheat", "0" );
}

if(getdvar("magic_chest_movable") == "")
{
SetDvar( "magic_chest_movable", "1" );
}

if(getdvar("magic_box_explore_only") == "")
{
SetDvar( "magic_box_explore_only", "1" );
}

SetDvar( "revive_trigger_radius", "60" );
}

initZombieLeaderboardData()
{
// Initializing Leaderboard Stat Variables
level.zombieLeaderboardStatVariable["nazi_zombie_prototype"]["highestwave"] = "nz_prototype_highestwave";
level.zombieLeaderboardStatVariable["nazi_zombie_prototype"]["timeinwave"] = "nz_prototype_timeinwave";
level.zombieLeaderboardStatVariable["nazi_zombie_prototype"]["totalpoints"] = "nz_prototype_totalpoints";

level.zombieLeaderboardStatVariable["nazi_zombie_asylum"]["highestwave"] = "nz_asylum_highestwave";
level.zombieLeaderboardStatVariable["nazi_zombie_asylum"]["timeinwave"] = "nz_asylum_timeinwave";
level.zombieLeaderboardStatVariable["nazi_zombie_asylum"]["totalpoints"] = "nz_asylum_totalpoints";

level.zombieLeaderboardStatVariable["nazi_zombie_sumpf"]["highestwave"] = "nz_sumpf_highestwave";
level.zombieLeaderboardStatVariable["nazi_zombie_sumpf"]["timeinwave"] = "nz_sumpf_timeinwave";
level.zombieLeaderboardStatVariable["nazi_zombie_sumpf"]["totalpoints"] = "nz_sumpf_totalpoints";

level.zombieLeaderboardStatVariable["nazi_zombie_factory"]["highestwave"] = "nz_factory_highestwave";
level.zombieLeaderboardStatVariable["nazi_zombie_factory"]["timeinwave"] = "nz_factory_timeinwave";
level.zombieLeaderboardStatVariable["nazi_zombie_factory"]["totalpoints"] = "nz_factory_totalpoints";

// Initializing Leaderboard Number
level.zombieLeaderboardNumber["nazi_zombie_prototype"]["waves"] = 13;
level.zombieLeaderboardNumber["nazi_zombie_prototype"]["points"] = 14;

level.zombieLeaderboardNumber["nazi_zombie_asylum"]["waves"] = 15;
level.zombieLeaderboardNumber["nazi_zombie_asylum"]["points"] = 16;

level.zombieLeaderboardNumber["nazi_zombie_sumpf"]["waves"] = 17;
level.zombieLeaderboardNumber["nazi_zombie_sumpf"]["points"] = 18;

level.zombieLeaderboardNumber["nazi_zombie_factory"]["waves"] = 19;
level.zombieLeaderboardNumber["nazi_zombie_factory"]["points"] = 20;
}


init_flags()
{
flag_init("spawn_point_override");
flag_init("electricity_on");
flag_init("crawler_round");
}


init_fx()
{
level._effect["wood_chunk_destory"] = loadfx( "impacts/large_woodhit" );

level._effect["edge_fog"] = LoadFx( "env/smoke/fx_fog_zombie_amb" );
level._effect["chest_light"] = LoadFx( "env/light/fx_ray_sun_sm_short" );

level._effect["eye_glow"] = LoadFx( "misc/fx_zombie_eye_single" );

level._effect["zombie_grain"] = LoadFx( "misc/fx_zombie_grain_cloud" );

level._effect["headshot"] = LoadFX( "impacts/flesh_hit_head_fatal_lg_exit" );
level._effect["headshot_nochunks"] = LoadFX( "misc/fx_zombie_bloodsplat" );
level._effect["bloodspurt"] = LoadFX( "misc/fx_zombie_bloodspurt" );
level._effect["tesla_head_light"] = Loadfx( "maps/zombie/fx_zombie_tesla_neck_spurt");

level._effect["rise_burst_water"] = LoadFx("maps/zombie/fx_zombie_body_wtr_burst");
level._effect["rise_billow_water"] = LoadFx("maps/zombie/fx_zombie_body_wtr_billowing");
level._effect["rise_dust_water"] = LoadFx("maps/zombie/fx_zombie_body_wtr_falling");

level._effect["rise_burst"] = LoadFx("maps/mp_maps/fx_mp_zombie_hand_dirt_burst");
level._effect["rise_billow"] = LoadFx("maps/mp_maps/fx_mp_zombie_body_dirt_billowing");
level._effect["rise_dust"] = LoadFx("maps/mp_maps/fx_mp_zombie_body_dust_falling");

// Flamethrower
level._effect["character_fire_pain_sm"]              = loadfx( "env/fire/fx_fire_player_sm_1sec" );
level._effect["character_fire_death_sm"]              = loadfx( "env/fire/fx_fire_player_md" );
level._effect["character_fire_death_torso"] = loadfx( "env/fire/fx_fire_player_torso" );
}

// zombie specific anims

init_standard_zombie_anims()
{
// deaths
level.scr_anim["zombie"]["death1"] = %ai_zombie_death_v1;
level.scr_anim["zombie"]["death2"] = %ai_zombie_death_v2;
level.scr_anim["zombie"]["death3"] = %ai_zombie_crawl_death_v1;
level.scr_anim["zombie"]["death4"] = %ai_zombie_crawl_death_v2;

// run cycles

level.scr_anim["zombie"]["walk1"] = %ai_zombie_walk_v1;
level.scr_anim["zombie"]["walk2"] = %ai_zombie_walk_v2;
level.scr_anim["zombie"]["walk3"] = %ai_zombie_walk_v3;
level.scr_anim["zombie"]["walk4"] = %ai_zombie_walk_v4;

level.scr_anim["zombie"]["run1"] = %ai_zombie_walk_fast_v1;
level.scr_anim["zombie"]["run2"] = %ai_zombie_walk_fast_v2;
level.scr_anim["zombie"]["run3"] = %ai_zombie_walk_fast_v3;
level.scr_anim["zombie"]["run4"] = %ai_zombie_run_v2;
level.scr_anim["zombie"]["run5"] = %ai_zombie_run_v4;
level.scr_anim["zombie"]["run6"] = %ai_zombie_run_v3;
//level.scr_anim["zombie"]["run4"] = %ai_zombie_run_v1;
//level.scr_anim["zombie"]["run6"] = %ai_zombie_run_v4;

level.scr_anim["zombie"]["sprint1"] = %ai_zombie_sprint_v1;
level.scr_anim["zombie"]["sprint2"] = %ai_zombie_sprint_v2;
level.scr_anim["zombie"]["sprint3"] = %ai_zombie_sprint_v1;
level.scr_anim["zombie"]["sprint4"] = %ai_zombie_sprint_v2;
//level.scr_anim["zombie"]["sprint3"] = %ai_zombie_sprint_v3;
//level.scr_anim["zombie"]["sprint3"] = %ai_zombie_sprint_v4;
//level.scr_anim["zombie"]["sprint4"] = %ai_zombie_sprint_v5;

// run cycles in prone
level.scr_anim["zombie"]["crawl1"] = %ai_zombie_crawl;
level.scr_anim["zombie"]["crawl2"] = %ai_zombie_crawl_v1;
level.scr_anim["zombie"]["crawl3"] = %ai_zombie_crawl_v2;
level.scr_anim["zombie"]["crawl4"] = %ai_zombie_crawl_v3;
level.scr_anim["zombie"]["crawl5"] = %ai_zombie_crawl_v4;
level.scr_anim["zombie"]["crawl6"] = %ai_zombie_crawl_v5;
level.scr_anim["zombie"]["crawl_hand_1"] = %ai_zombie_walk_on_hands_a;
level.scr_anim["zombie"]["crawl_hand_2"] = %ai_zombie_walk_on_hands_b;




level.scr_anim["zombie"]["crawl_sprint1"] = %ai_zombie_crawl_sprint;
level.scr_anim["zombie"]["crawl_sprint2"] = %ai_zombie_crawl_sprint_1;
level.scr_anim["zombie"]["crawl_sprint3"] = %ai_zombie_crawl_sprint_2;

if( !isDefined( level._zombie_melee ) )
{
level._zombie_melee = [];
}
if( !isDefined( level._zombie_walk_melee ) )
{
level._zombie_walk_melee = [];
}
if( !isDefined( level._zombie_run_melee ) )
{
level._zombie_run_melee = [];
}

level._zombie_melee["zombie"] = [];
level._zombie_walk_melee["zombie"] = [];
level._zombie_run_melee["zombie"] = [];

level._zombie_melee["zombie"][0] = %ai_zombie_attack_forward_v1;
level._zombie_melee["zombie"][1] = %ai_zombie_attack_forward_v2;
level._zombie_melee["zombie"][2] = %ai_zombie_attack_v1;
level._zombie_melee["zombie"][3] = %ai_zombie_attack_v2;
level._zombie_melee["zombie"][4] = %ai_zombie_attack_v1;
level._zombie_melee["zombie"][5] = %ai_zombie_attack_v4;
level._zombie_melee["zombie"][6] = %ai_zombie_attack_v6;
level._zombie_run_melee["zombie"][0] = %ai_zombie_run_attack_v1;
level._zombie_run_melee["zombie"][1] = %ai_zombie_run_attack_v2;
level._zombie_run_melee["zombie"][2] = %ai_zombie_run_attack_v3;
level.scr_anim["zombie"]["walk5"] = %ai_zombie_walk_v6;
level.scr_anim["zombie"]["walk6"] = %ai_zombie_walk_v7;
level.scr_anim["zombie"]["walk7"] = %ai_zombie_walk_v8;
level.scr_anim["zombie"]["walk8"] = %ai_zombie_walk_v9;

if( isDefined( level.zombie_anim_override ) )
{
[[ level.zombie_anim_override ]]();
}

level._zombie_walk_melee["zombie"][0] = %ai_zombie_walk_attack_v1;
level._zombie_walk_melee["zombie"][1] = %ai_zombie_walk_attack_v2;
level._zombie_walk_melee["zombie"][2] = %ai_zombie_walk_attack_v3;
level._zombie_walk_melee["zombie"][3] = %ai_zombie_walk_attack_v4;

// melee in crawl
if( !isDefined( level._zombie_melee_crawl ) )
{
level._zombie_melee_crawl = [];
}
level._zombie_melee_crawl["zombie"] = [];
level._zombie_melee_crawl["zombie"][0] = %ai_zombie_attack_crawl;
level._zombie_melee_crawl["zombie"][1] = %ai_zombie_attack_crawl_lunge;

if( !isDefined( level._zombie_stumpy_melee ) )
{
level._zombie_stumpy_melee = [];
}
level._zombie_stumpy_melee["zombie"] = [];
level._zombie_stumpy_melee["zombie"][0] = %ai_zombie_walk_on_hands_shot_a;
level._zombie_stumpy_melee["zombie"][1] = %ai_zombie_walk_on_hands_shot_b;
//level._zombie_melee_crawl["zombie"][2] = %ai_zombie_crawl_attack_A;

// tesla deaths
if( !isDefined( level._zombie_tesla_death ) )
{
level._zombie_tesla_death = [];
}
level._zombie_tesla_death["zombie"] = [];
level._zombie_tesla_death["zombie"][0] = %ai_zombie_tesla_death_a;
level._zombie_tesla_death["zombie"][1] = %ai_zombie_tesla_death_b;
level._zombie_tesla_death["zombie"][2] = %ai_zombie_tesla_death_c;
level._zombie_tesla_death["zombie"][3] = %ai_zombie_tesla_death_d;
level._zombie_tesla_death["zombie"][4] = %ai_zombie_tesla_death_e;

if( !isDefined( level._zombie_tesla_crawl_death ) )
{
level._zombie_tesla_crawl_death = [];
}
level._zombie_tesla_crawl_death["zombie"] = [];
level._zombie_tesla_crawl_death["zombie"][0] = %ai_zombie_tesla_crawl_death_a;
level._zombie_tesla_crawl_death["zombie"][1] = %ai_zombie_tesla_crawl_death_b;

// deaths
if( !isDefined( level._zombie_deaths ) )
{
level._zombie_deaths = [];
}
level._zombie_deaths["zombie"] = [];
level._zombie_deaths["zombie"][0] = %ch_dazed_a_death;
level._zombie_deaths["zombie"][1] = %ch_dazed_b_death;
level._zombie_deaths["zombie"][2] = %ch_dazed_c_death;
level._zombie_deaths["zombie"][3] = %ch_dazed_d_death;

/*
ground crawl
*/

if( !isDefined( level._zombie_rise_anims ) )
{
level._zombie_rise_anims = [];
}

// set up the arrays
level._zombie_rise_anims["zombie"] = [];

//level._zombie_rise_anims["zombie"][1]["walk"][0] = %ai_zombie_traverse_ground_v1_crawl;
level._zombie_rise_anims["zombie"][1]["walk"][0] = %ai_zombie_traverse_ground_v1_walk;

//level._zombie_rise_anims["zombie"][1]["run"][0] = %ai_zombie_traverse_ground_v1_crawlfast;
level._zombie_rise_anims["zombie"][1]["run"][0] = %ai_zombie_traverse_ground_v1_run;

level._zombie_rise_anims["zombie"][1]["sprint"][0] = %ai_zombie_traverse_ground_climbout_fast;

//level._zombie_rise_anims["zombie"][2]["walk"][0] = %ai_zombie_traverse_ground_v2_walk; //!broken
level._zombie_rise_anims["zombie"][2]["walk"][0] = %ai_zombie_traverse_ground_v2_walk_altA;
//level._zombie_rise_anims["zombie"][2]["walk"][2] = %ai_zombie_traverse_ground_v2_walk_altB;//!broken

// ground crawl death
if( !isDefined( level._zombie_rise_death_anims ) )
{
level._zombie_rise_death_anims = [];
}

level._zombie_rise_death_anims["zombie"] = [];

level._zombie_rise_death_anims["zombie"][1]["in"][0] = %ai_zombie_traverse_ground_v1_deathinside;
level._zombie_rise_death_anims["zombie"][1]["in"][1] = %ai_zombie_traverse_ground_v1_deathinside_alt;

level._zombie_rise_death_anims["zombie"][1]["out"][0] = %ai_zombie_traverse_ground_v1_deathoutside;
level._zombie_rise_death_anims["zombie"][1]["out"][1] = %ai_zombie_traverse_ground_v1_deathoutside_alt;

level._zombie_rise_death_anims["zombie"][2]["in"][0] = %ai_zombie_traverse_ground_v2_death_low;
level._zombie_rise_death_anims["zombie"][2]["in"][1] = %ai_zombie_traverse_ground_v2_death_low_alt;

level._zombie_rise_death_anims["zombie"][2]["out"][0] = %ai_zombie_traverse_ground_v2_death_high;
level._zombie_rise_death_anims["zombie"][2]["out"][1] = %ai_zombie_traverse_ground_v2_death_high_alt;

//taunts
if( !isDefined( level._zombie_run_taunt ) )
{
level._zombie_run_taunt = [];
}
if( !isDefined( level._zombie_board_taunt ) )
{
level._zombie_board_taunt = [];
}
level._zombie_run_taunt["zombie"] = [];
level._zombie_board_taunt["zombie"] = [];

//level._zombie_taunt["zombie"][0] = %ai_zombie_taunts_1;
//level._zombie_taunt["zombie"][1] = %ai_zombie_taunts_4;
//level._zombie_taunt["zombie"][2] = %ai_zombie_taunts_5b;
//level._zombie_taunt["zombie"][3] = %ai_zombie_taunts_5c;
//level._zombie_taunt["zombie"][4] = %ai_zombie_taunts_5d;
//level._zombie_taunt["zombie"][5] = %ai_zombie_taunts_5e;
//level._zombie_taunt["zombie"][6] = %ai_zombie_taunts_5f;
//level._zombie_taunt["zombie"][7] = %ai_zombie_taunts_7;
//level._zombie_taunt["zombie"][8] = %ai_zombie_taunts_9;
//level._zombie_taunt["zombie"][8] = %ai_zombie_taunts_11;
//level._zombie_taunt["zombie"][8] = %ai_zombie_taunts_12;

level._zombie_board_taunt["zombie"][0] = %ai_zombie_taunts_4;
level._zombie_board_taunt["zombie"][1] = %ai_zombie_taunts_7;
level._zombie_board_taunt["zombie"][2] = %ai_zombie_taunts_9;
level._zombie_board_taunt["zombie"][3] = %ai_zombie_taunts_5b;
level._zombie_board_taunt["zombie"][4] = %ai_zombie_taunts_5c;
level._zombie_board_taunt["zombie"][5] = %ai_zombie_taunts_5d;
level._zombie_board_taunt["zombie"][6] = %ai_zombie_taunts_5e;
level._zombie_board_taunt["zombie"][7] = %ai_zombie_taunts_5f;
}

init_anims()
{
init_standard_zombie_anims();
}

// Initialize any animscript related variables
init_animscripts()
{
// Setup the animscripts, then override them (we call this just incase an AI has not yet spawned)
animscripts\init::firstInit();

anim.idleAnimArray ["stand"] = [];
anim.idleAnimWeights ["stand"] = [];
anim.idleAnimArray ["stand"][0][0] = %ai_zombie_idle_v1_delta;
anim.idleAnimWeights ["stand"][0][0] = 10;

anim.idleAnimArray ["crouch"] = [];
anim.idleAnimWeights ["crouch"] = [];
anim.idleAnimArray ["crouch"][0][0] = %ai_zombie_idle_crawl_delta;
anim.idleAnimWeights ["crouch"][0][0] = 10;
}

// Handles the intro screen
zombie_intro_screen( string1, string2, string3, string4, string5 )
{
flag_wait( "all_players_connected" );

wait( 1 );

//TUEY Set music state to Splash Screencompass
setmusicstate( "SPLASH_SCREEN" );
wait (0.2);
//TUEY Set music state to WAVE_1
// setmusicstate("WAVE_1");
}

players_playing()
{
// initialize level.players_playing
players = get_players();
level.players_playing = players.size;

wait( 20 );

players = get_players();
level.players_playing = players.size;
}

//
// NETWORK SECTION ====================================================================== //
//

watchGrenadeThrow()
{
self endon( "disconnect" );
self endon( "death" );

while(1)
{
self waittill("grenade_fire", grenade);

if(isdefined(grenade))
{
if(self maps\_laststand::player_is_in_laststand())
{
grenade delete();
}
}
}
}

onPlayerConnect()
{
for( ;; )
{
level waittill( "connecting", player );

player.entity_num = player GetEntityNumber();
player thread onPlayerSpawned();
player thread onPlayerDisconnect();
player thread player_revive_monitor();

//player thread watchGrenadeThrow();

player.score = level.zombie_vars["zombie_score_start"];
player.score_total = player.score;
player.old_score = player.score;

player.is_zombie = false;
player.initialized = false;
player.zombification_time = 0;
}
}

onPlayerConnect_clientDvars()
{
self SetClientDvars( "cg_deadChatWithDead", "1",
"cg_deadChatWithTeam", "1",
"cg_deadHearTeamLiving", "1",
"cg_deadHearAllLiving", "1",
"cg_everyoneHearsEveryone", "1",
"compass", "0",
"hud_showStance", "0",
"cg_thirdPerson", "0",
"cg_fov", "65",
"cg_thirdPersonAngle", "0",
"ammoCounterHide", "0",
"miniscoreboardhide", "0",
"ui_hud_hardcore", "0" );

self SetDepthOfField( 0, 0, 512, 4000, 4, 0 );
}

onPlayerDisconnect()
{
self waittill( "disconnect" );
self remove_from_spectate_list();
}

onPlayerSpawned()
{
self endon( "disconnect" );

for( ;; )
{
self waittill( "spawned_player" );



self SetClientDvars( "cg_thirdPerson", "0",
"cg_fov", "65",
"cg_thirdPersonAngle", "0" );

self SetDepthOfField( 0, 0, 512, 4000, 4, 0 );

self add_to_spectate_list();

if( isdefined( self.initialized ) )
{
if( self.initialized == false )
{
self.initialized = true;
// self maps\_zombiemode_score::create_player_score_hud();

// set the initial score on the hud
self maps\_zombiemode_score::set_player_score_hud( true );
self thread player_zombie_breadcrumb();

//Init stat tracking variables
self.stats["kills"] = 0;
self.stats["score"] = 0;
self.stats["downs"] = 0;
self.stats["revives"] = 0;
self.stats["perks"] = 0;
self.stats["headshots"] = 0;
self.stats["zombie_gibs"] = 0;
}
}
}
}


//
// Keep track of players going down and getting revived
player_revive_monitor()
{
self endon( "disconnect" );

while (1)
{
self waittill( "player_revived", reviver );

if ( IsDefined(reviver) )
{
// Check to see how much money you lost from being down.
points = self.score_lost_when_downed;
if ( points > 300 )
{
points = 300;
}
reviver maps\_zombiemode_score::add_to_player_score( points );
self.score_lost_when_downed = 0;
}
}
}


player_laststand()
{
self maps\_zombiemode_score::player_downed_penalty();

if( IsDefined( self.intermission ) && self.intermission )
{
maps\_challenges_coop::doMissionCallback( "playerDied", self );

level waittill( "forever" );
}
}

spawnSpectator()
{
self endon( "disconnect" );
self endon( "spawned_spectator" );
self notify( "spawned" );
self notify( "end_respawn" );

if( level.intermission )
{
return;
}

if( IsDefined( level.no_spectator ) && level.no_spectator )
{
wait( 3 );
ExitLevel();
}

// The check_for_level_end looks for this
self.is_zombie = true;

// Remove all reviving abilities
self notify ( "zombified" );

if( IsDefined( self.revivetrigger ) )
{
self.revivetrigger delete();
self.revivetrigger = undefined;
}

self.zombification_time = getTime(); //set time when player died

resetTimeout();

// Stop shellshock and rumble
self StopShellshock();
self StopRumble( "damage_heavy" );

self.sessionstate = "spectator";
self.spectatorclient = -1;

self remove_from_spectate_list();

self.maxhealth = self.health;
self.shellshocked = false;
self.inWater = false;
self.friendlydamage = undefined;
self.hasSpawned = true;
self.spawnTime = getTime();
self.afk = false;

println( "*************************Zombie Spectator***" );
self detachAll();

self setSpectatePermissions( true );
self thread spectator_thread();

self Spawn( self.origin, self.angles );
self notify( "spawned_spectator" );
}

setSpectatePermissions( isOn )
{
self AllowSpectateTeam( "allies", isOn );
self AllowSpectateTeam( "axis", false );
self AllowSpectateTeam( "freelook", false );
self AllowSpectateTeam( "none", false );
}

spectator_thread()
{
self endon( "disconnect" );
self endon( "spawned_player" );

if( IsSplitScreen() )
{
last_alive = undefined;
players = get_players();

for( i = 0; i < players.size; i++ )
{
if( !players[i].is_zombie )
{
last_alive = players[i];
}
}

share_screen( last_alive, true );

return;
}

self thread spectator_toggle_3rd_person();
}

spectator_toggle_3rd_person()
{
self endon( "disconnect" );
self endon( "spawned_player" );

third_person = true;
self set_third_person( true );
// self NotifyOnCommand( "toggle_3rd_person", "weapnext" );

// while( 1 )
// {
// self waittill( "toggle_3rd_person" );
//
// if( third_person )
// {
// third_person = false;
// self set_third_person( false );
// wait( 0.5 );
// }
// else
// {
// third_person = true;
// self set_third_person( true );
// wait( 0.5 );
// }
// }
}


set_third_person( value )
{
if( value )
{
self SetClientDvars( "cg_thirdPerson", "1",
"cg_fov", "40",
"cg_thirdPersonAngle", "354" );

self setDepthOfField( 0, 128, 512, 4000, 6, 1.8 );
}
else
{
self SetClientDvars( "cg_thirdPerson", "0",
"cg_fov", "65",
"cg_thirdPersonAngle", "0" );

self setDepthOfField( 0, 0, 512, 4000, 4, 0 );
}
}

spectators_respawn()
{
level endon( "between_round_over" );

if( !IsDefined( level.zombie_vars["spectators_respawn"] ) || !level.zombie_vars["spectators_respawn"] )
{
return;
}

if( !IsDefined( level.custom_spawnPlayer ) )
{
// Custom spawn call for when they respawn from spectator
level.custom_spawnPlayer = ::spectator_respawn;
}

while( 1 )
{
players = get_players();
for( i = 0; i < players.size; i++ )
{
if( players[i].sessionstate == "spectator" )
{
players[i] [[level.spawnPlayer]]();
if( isDefined( players[i].has_altmelee ) && players[i].has_altmelee )
{
players[i] SetPerk( "specialty_altmelee" );
}
if (isDefined(level.script) && level.round_number > 6 && players[i].score < 1500)
{
players[i].old_score = players[i].score;
players[i].score = 1500;
players[i] maps\_zombiemode_score::set_player_score_hud();
}
}
}

wait( 1 );
}
}

spectator_respawn()
{
println( "*************************Respawn Spectator***" );
assert( IsDefined( self.spectator_respawn ) );

origin = self.spectator_respawn.origin;
angles = self.spectator_respawn.angles;

self setSpectatePermissions( false );

new_origin = undefined;


new_origin = check_for_valid_spawn_near_team( self );


if( IsDefined( new_origin ) )
{
self Spawn( new_origin, angles );
}
else
{
self Spawn( origin, angles );
}


if( IsSplitScreen() )
{
last_alive = undefined;
players = get_players();

for( i = 0; i < players.size; i++ )
{
if( !players[i].is_zombie )
{
last_alive = players[i];
}
}

share_screen( last_alive, false );
}

self.has_betties = undefined;
self.is_burning = undefined;

// The check_for_level_end looks for this
self.is_zombie = false;
self.ignoreme = false;

setClientSysState("lsm", "0", self); // Notify client last stand ended.
self RevivePlayer();

self notify( "spawned_player" );

// Penalize the player when we respawn, since he 'died'
self maps\_zombiemode_score::player_reduce_points( "died" );

self thread player_zombie_breadcrumb();

return true;
}

check_for_valid_spawn_near_team( revivee )
{

players = get_players();
spawn_points = getstructarray("player_respawn_point", "targetname");
spawn_points = getstructarray("player_respawn_point", "targetname");

if( spawn_points.size == 0 )
return undefined;

for( i = 0; i < players.size; i++ )
{
if( is_player_valid( players[i] ) )
{
for( j = 0 ; j < spawn_points.size; j++ )
{
if( DistanceSquared( players[i].origin, spawn_points[j].origin ) < ( 1000 * 1000 ) && spawn_points[j].locked == false )
{
spawn_array = getstructarray( spawn_points[j].target, "targetname" );

for( k = 0; k < spawn_array.size; k++ )
{
if( spawn_array[k].script_int == (revivee.entity_num + 1) )
{
return spawn_array[k].origin;
}
}

return spawn_array[0].origin;
}

}

}

}

return undefined;

}


get_players_on_team(exclude)
{

teammates = [];

players = get_players();
for(i=0;i<players.size;i++)
{
//check to see if other players on your team are alive and not waiting to be revived
if(players[i].spawn_side == self.spawn_side && !isDefined(players[i].revivetrigger) && players[i] != exclude )
{
teammates[teammates.size] = players[i];
}
}

return teammates;
}



get_safe_breadcrumb_pos( player )
{
players = get_players();
valid_players = [];

min_dist = 150 * 150;
for( i = 0; i < players.size; i++ )
{
if( !is_player_valid( players[i] ) )
{
continue;
}

valid_players[valid_players.size] = players[i];
}

for( i = 0; i < valid_players.size; i++ )
{
count = 0;
for( q = 1; q < player.zombie_breadcrumbs.size; q++ )
{
if( DistanceSquared( player.zombie_breadcrumbs[q], valid_players[i].origin ) < min_dist )
{
continue;
}

count++;
if( count == valid_players.size )
{
return player.zombie_breadcrumbs[q];
}
}
}

return undefined;
}

round_spawning()
{
level endon( "intermission" );
/#
level endon( "kill_round" );
#/

if( level.intermission )
{
return;
}

if( level.enemy_spawns.size < 1 )
{
ASSERTMSG( "No spawners with targetname zombie_spawner in map." );
return;
}

/#
if ( GetDVarInt( "zombie_cheat" ) == 2 || GetDVarInt( "zombie_cheat" ) >= 4 )
{
return;
}
#/

ai_calculate_health();

count = 0;

//CODER MOD: TOMMY K
players = get_players();
for( i = 0; i < players.size; i++ )
{
players[i].zombification_time = 0;
}

max = level.zombie_vars["zombie_max_ai"];

multiplier = level.round_number / 5;
if( multiplier < 1 )
{
multiplier = 1;
}

// After round 10, exponentially have more AI attack the player
if( level.round_number >= 10 )
{
multiplier *= level.round_number * 0.15;
}

player_num = get_players().size;

if( player_num == 1 )
{
max += int( ( 0.5 * level.zombie_vars["zombie_ai_per_player"] ) * multiplier );
}
else
{
max += int( ( ( player_num - 1 ) * level.zombie_vars["zombie_ai_per_player"] ) * multiplier );
}



if(level.round_number < 3 && level.script == "nazi_zombie_asylum")
{
if(get_players().size > 1)
{

max = get_players().size * 3 + level.round_number;

}
else
{

max = 6;

}
}
else if ( level.first_round )
{
max = int( max * 0.2 );
}
else if (level.round_number < 3)
{
max = int( max * 0.4 );
}
else if (level.round_number < 4)
{
max = int( max * 0.6 );
}
else if (level.round_number < 5)
{
max = int( max * 0.8 );
}


level.zombie_total = max;
mixed_spawns = 0; // Number of mixed spawns this round.  Currently means number of dogs in a mixed round

// DEBUG HACK:
//max = 1;
old_spawn = undefined;
while( count < max )
{

spawn_point = level.enemy_spawns[RandomInt( level.enemy_spawns.size )];

if( !IsDefined( old_spawn ) )
{
old_spawn = spawn_point;
}
else if( Spawn_point == old_spawn )
{
spawn_point = level.enemy_spawns[RandomInt( level.enemy_spawns.size )];
}
old_spawn = spawn_point;

// iPrintLn(spawn_point.targetname + " " + level.zombie_vars["zombie_spawn_delay"]);
while( get_enemy_count() > 31 )
{
wait( 0.05 );
}

// MM Mix in dog spawns...
if ( IsDefined( level.mixed_rounds_enabled ) && level.mixed_rounds_enabled == 1 )
{
spawn_dog = false;
if ( level.round_number > 30 )
{
if ( RandomInt(100) < 3 )
{
spawn_dog = false;
}
}
else if ( level.round_number > 25 && mixed_spawns < 3 )
{
if ( RandomInt(100) < 2 )
{
spawn_dog = false;
}
}
else if ( level.round_number > 20 && mixed_spawns < 2 )
{
if ( RandomInt(100) < 2 )
{
spawn_dog = false;
}
}
else if ( level.round_number > 15 && mixed_spawns < 1 )
{
if ( RandomInt(100) < 1 )
{
spawn_dog = false;
}
}

if ( spawn_dog )
{
keys = GetArrayKeys( level.zones );
for ( i=0; i<keys.size; i++ )
{
if ( level.zones[ keys[i] ].is_occupied )
{
akeys = GetArrayKeys( level.zones[ keys[i] ].adjacent_zones );
for ( k=0; k<akeys.size; k++ )
{
if ( level.zones[ akeys[k] ].is_active &&
!level.zones[ akeys[k] ].is_occupied &&
level.zones[ akeys[k] ].dog_locations.size > 0 )
{
maps\_zombiemode_dogs::special_dog_spawn( undefined, 1 );
level.zombie_total--;
wait_network_frame();
}
}
}
}
}
}

ai = spawn_zombie( spawn_point );
if( IsDefined( ai ) )
{
level.zombie_total--;
ai thread round_spawn_failsafe();
count++;
}
wait( level.zombie_vars["zombie_spawn_delay"] );
wait_network_frame();
}

if( level.round_number > 3 )
{
zombies = getaiarray( "axis" );
while( zombies.size > 0 )
{
if( zombies.size == 1 && zombies[0].has_legs == true )
{
var = randomintrange(1, 4);
zombies[0] set_run_anim( "sprint" + var );                       
zombies[0].run_combatanim = level.scr_anim[zombies[0].animname]["sprint" + var];
}
wait(0.5);
zombies = getaiarray("axis");
}

}

}

// TESTING: spawn one zombie at a time
round_spawning_test()
{
while (true)
{
spawn_point = level.enemy_spawns[RandomInt( level.enemy_spawns.size )]; // grab a random spawner

ai = spawn_zombie( spawn_point );
ai waittill("death");

wait 5;
}
}
/////////////////////////////////////////////////////////

round_text( text )
{
if( level.first_round )
{
intro = true;
}
else
{
intro = false;
}

hud = create_simple_hud();
hud.horzAlign = "center";
hud.vertAlign = "middle";
hud.alignX = "center";
hud.alignY = "middle";
hud.y = -100;
hud.foreground = 1;
hud.fontscale = 16.0;
hud.alpha = 0;
hud.color = ( 1, 1, 1 );

hud SetText( text );
hud FadeOverTime( 1.5 );
hud.alpha = 1;
wait( 1.5 );

if( intro )
{
wait( 1 );
level notify( "intro_change_color" );
}

hud FadeOverTime( 3 );
//hud.color = ( 0.8, 0, 0 );
hud.color = ( 0.423, 0.004, 0 );
wait( 3 );

if( intro )
{
level waittill( "intro_hud_done" );
}

hud FadeOverTime( 1.5 );
hud.alpha = 0;
wait( 1.5 );
hud destroy();
}

round_start()
{
level.zombie_health = level.zombie_vars["zombie_health_start"];
level.round_number = 1;
level.first_round = true;

// so players get init'ed with grenades
players = get_players();
for (i = 0; i < players.size; i++)
{
players[i] giveweapon( "stielhandgranate" );
players[i] setweaponammoclip( "stielhandgranate", 0);
}

level.chalk_hud1 = create_chalk_hud();
level.chalk_hud2 = create_chalk_hud( 64 );

// level waittill( "introscreen_done" );

level.round_spawn_func = ::round_spawning;

/#
if (GetDVarInt("zombie_rise_test"))
{
level.round_spawn_func = ::round_spawning_test; // FOR TESTING, one zombie at a time, no round advancement
}
#/

level thread round_think();
}


create_chalk_hud( x )
{
if( !IsDefined( x ) )
{
x = 0;
}

hud = create_simple_hud();
hud.alignX = "left";
hud.alignY = "bottom";
hud.horzAlign = "left";
hud.vertAlign = "bottom";
hud.color = ( 0.423, 0.004, 0 );
hud.x = x;
hud.alpha = 0;

hud SetShader( "hud_chalk_1", 64, 64 );

return hud;
}
play_intro_VO()
{

wait(3);
players = getplayers();
for(i=0;i<players.size;i++)
{
index = maps\_zombiemode_weapons::get_player_index(players[i]);
player_index = "plr_" + index + "_";
sound_to_play = "vox_name_int_0";
players[i] maps\_zombiemode_spawner::do_player_playdialog(player_index, sound_to_play, 0.05);
wait(0.7);
}

//Plays a random start line on one of the characters
// i = randomintrange(0,players.size);
// players[i] playsound ("plr_" + i + "_vox_start" + "_" + randomintrange(0, variation_count));

}

//
// Let's the players know that you need power to open these
play_door_dialog()
{
level endon( "electricity_on" );
self endon ("warning_dialog");
timer = 0;

while(1)
{
wait(0.05);
players = get_players();
for(i = 0; i < players.size; i++)
{
dist = distancesquared(players[i].origin, self.origin );
if(dist > 70*70)
{
timer =0;
continue;
}
while(dist < 70*70 && timer < 3)
{
wait(0.5);
timer++;
}
if(dist > 70*70 && timer >= 3)
{
self playsound("door_deny");
players[i] thread do_player_vo("vox_start", 5);
wait(3);
broken avatar :(
×
broken avatar :(
[UGX] Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 8 days ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
you were very close to correct. put:
trig = GetEnt("end_game", "targetname");
trig thread end_game();
before
maps\_zombemode::main();

also you took the endgame function out of your _zombiemode. you were suppose to replace the original with toms edited function.
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 5 August 2012
Last active: 1543 days ago
Posts
304
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
im aggressive
×
jzob1234's Groups
jzob1234's Contact & Social Linksjzobjzob123
you were very close to correct. put:
trig = GetEnt("end_game", "targetname");
trig thread end_game();
before
maps\_zombemode::main();

also you took the endgame function out of your _zombiemode. you were suppose to replace the original with toms edited function.
thank you i will try this once i have the time but if it dose not work i will say so  :poker:
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 5 August 2012
Last active: 1543 days ago
Posts
304
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
im aggressive
×
jzob1234's Groups
jzob1234's Contact & Social Linksjzobjzob123
i did what you said still hapens  :poker:

[You are not allowed to view external links. Register or Login to see them]
broken avatar :(
×
broken avatar :(
[UGX] Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 8 days ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
i did what you said still hapens  :poker:

[You are not allowed to view external links. Register or Login to see them]
show me your _zombiemode.gsc now so I can see the change you made. also make the the triggers KVP is correct(dumb question but it happens)
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 5 August 2012
Last active: 1543 days ago
Posts
304
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
im aggressive
×
jzob1234's Groups
jzob1234's Contact & Social Linksjzobjzob123
 [code#include maps\_anim; 
#include maps\_utility;
#include common_scripts\utility;
#include maps\_music;
#include maps\_zombiemode_utility;
#include maps\_busing;

#using_animtree( "generic_human" );

main(init_zombie_spawner_name)
{
precache_shaders();
precache_models();

PrecacheItem( "fraggrenade" );
PrecacheItem( "colt" );

init_strings();
init_levelvars();
init_animscripts();
init_sounds();
init_shellshocks();
init_flags();

//Limit zombie to 24 max, must have for network purposes
SetAILimit( 24 );
// the initial spawners
if( !IsDefined( init_zombie_spawner_name) )
{
level.enemy_spawns = getEntArray( "zombie_spawner_init", "targetname" );
}
else
{
level.enemy_spawns = getEntArray( init_zombie_spawner_name, "targetname" );
}

level.zombie_rise_spawners = [];

//maps\_destructible_type94truck::init();

level.custom_introscreen = ::zombie_intro_screen;
level.custom_intermission = ::player_intermission;
level.reset_clientdvars = ::onPlayerConnect_clientDvars;

init_fx();


// load map defaults
maps\_load::main();

level.hudelem_count = 0;
// Call the other zombiemode scripts
if( level.script == "nazi_zombie_sumpf" )
{
maps\_zombiemode_weapons_sumpf::init();
}
else
{
maps\_zombiemode_weapons::init();
}
maps\_zombiemode_blockers_new::init();
maps\_zombiemode_spawner::init();
maps\_zombiemode_powerups::init();
maps\_zombiemode_radio::init();
maps\_zombiemode_perks::init();
maps\_zombiemode_tesla::init();
maps\_zombiemode_dogs::init();
maps\_zombiemode_bowie::bowie_init();
maps\_zombiemode_cymbal_monkey::init();
maps\_zombiemode_betty::init();
maps\_zombiemode_timer::init();
maps\_zombiemode_auto_turret::init();

/#
maps\_zombiemode_devgui::init();
#/

init_utility();

// register a client system...
maps\_utility::registerClientSys("zombify");

// level thread coop_player_spawn_placement();

// zombie ai and anim inits
init_anims();

if( isDefined( level.custom_ai_type ) )
{
for( i = 0; i < level.custom_ai_type.size; i++ )
{
[[ level.custom_ai_type[i] ]]();
}
}


// Sets up function pointers for animscripts to refer to
level.playerlaststand_func = ::player_laststand;
// level.global_kill_func = maps\_zombiemode_spawner::zombie_death;
level.global_damage_func = maps\_zombiemode_spawner::zombie_damage;
level.global_damage_func_ads = maps\_zombiemode_spawner::zombie_damage_ads;
level.overridePlayerKilled = ::player_killed_override;
level.overridePlayerDamage = ::player_damage_override;

level.melee_miss_func = maps\_zombiemode::zombiemode_melee_miss;

if( !IsDefined( level.Player_Spawn_func ) )
{
level.Player_Spawn_func = ::coop_player_spawn_placement;
}

level thread [[level.Player_Spawn_func]]();
// used to a check in last stand for players to become zombies
level.is_zombie_level = true;
level.player_becomes_zombie = ::zombify_player;

// so we dont get the uber colt when we're knocked out
level.laststandpistol = "colt";

level.round_start_time = 0;

level thread onPlayerConnect();

init_dvars();
initZombieLeaderboardData();


flag_wait( "all_players_connected" );

bbPrint( "sessions: mapname %s gametype zom isserver 1", level.script );



//thread zombie_difficulty_ramp_up();

// Start the Zombie MODE!
level thread end_game();
level thread round_start();
level thread players_playing();
if ( IsDefined( level.crawlers_enabled ) && level.crawlers_enabled == 1 )
{
level thread crawler_round_tracker();
}

//chrisp - adding spawning vo
level thread spawn_vo();

//add ammo tracker for VO
level thread track_players_ammo_count();

//level thread prevent_near_origin();

DisableGrenadeSuicide();

level.startInvulnerableTime = GetDvarInt( "player_deathInvulnerableTime" );

// Do a SaveGame, so we can restart properly when we die
SaveGame( "zombie_start", &"AUTOSAVE_LEVELSTART", "", true );

// TESTING
// wait( 3 );
// level thread intermission();
// thread testing_spawner_bug();

if(!IsDefined(level.eggs) )
{
level.eggs = 0;
}
}

zombiemode_melee_miss()
{
if( isDefined( self.enemy.curr_pay_turret ) )
{
self.enemy DoDamage( (60 / GetDvarFloat("player_damageMultiplier")), self.origin, self, self );
}
}

/*------------------------------------
chrisp - adding vo to track players ammo
------------------------------------*/
track_players_ammo_count()
{
self endon("disconnect");
self endon("death");
if(!IsDefined (level.player_ammo_low))
{
level.player_ammo_low = 0;
}
if(!IsDefined(level.player_ammo_out))
{
level.player_ammo_out = 0;
}
while(1)
{
players = get_players();
for(i=0;i<players.size;i++)
{

weap = players[i] getcurrentweapon();
//iprintln("current weapon: " + weap);
//iprintlnbold(weap);
//Excludes all Perk based 'weapons' so that you don't get low ammo spam.
if(!isDefined(weap) || weap == "none" || weap == "zombie_perk_bottle_doubletap" || weap == "zombie_perk_bottle_jugg" || weap == "zombie_perk_bottle_revive" || weap == "zombie_perk_bottle_sleight" || weap == "mine_bouncing_betty" || weap == "syrette" || weap == "zombie_knuckle_crack" || weap == "zombie_bowie_flourish" )
{
continue;
}
//iprintln("checking ammo for " + weap);
if ( players[i] GetAmmoCount( weap ) > 5)
{
continue;
}
if ( players[i] maps\_laststand::player_is_in_laststand() )
{
continue;
}
else if (players[i] GetAmmoCount( weap ) < 5 && players[i] GetAmmoCount( weap ) > 0)
{
if (level.player_ammo_low == 0)
{
level.player_ammo_low = 1;
players[i] thread add_low_ammo_dialog();
players[i] thread ammo_dialog_timer();
level waittill("send_dialog_reminder");
level.player_ammo_low = 0;
}

}
else if (players[i] GetAmmoCount( weap ) == 0)
{
if(!isDefined(weap) || weap == "none")
{
continue;
}
level.player_ammo_out = 1;
players[i] thread add_no_ammo_dialog( weap );
//put in this wait to keep the game from spamming about being low on ammo.
wait(20);
level.player_ammo_out = 0;
}
else
{
continue;
}
}
wait(.5);
}
}
ammo_dialog_timer()
{
level endon ("ammo_out");
while(1)
{
wait(20);
level notify ("send_dialog_reminder");

}

}
add_low_ammo_dialog()
{
index = maps\_zombiemode_weapons::get_player_index(self);
player_index = "plr_" + index + "_";
if(!IsDefined (self.vox_ammo_low))
{
num_variants = maps\_zombiemode_spawner::get_number_variants(player_index + "vox_ammo_low");
self.vox_ammo_low = [];
for(i=0;i<num_variants;i++)
{
self.vox_ammo_low[self.vox_ammo_low.size] = "vox_ammo_low_" + i;
}
self.vox_ammo_low_available = self.vox_ammo_low;
}
sound_to_play = random(self.vox_ammo_low_available);

self.vox_ammo_low_available = array_remove(self.vox_ammo_low_available,sound_to_play);

if (self.vox_ammo_low_available.size < 1 )
{
self.vox_ammo_low_available = self.vox_ammo_low;
}

self maps\_zombiemode_spawner::do_player_playdialog(player_index, sound_to_play, 0.25);



}
add_no_ammo_dialog( weap )
{
self endon( "disconnect" );

// Let's pause here a couple of seconds to see if we're really out of ammo.
// If you take a weapon, there's a second or two where your current weapon
// will be set to no ammo while you switch to the new one.
wait(2);

curr_weap = self getcurrentweapon();
if ( !IsDefined(curr_weap) || curr_weap != weap || self GetAmmoCount( curr_weap ) != 0 )
{
// False alarm
return;
}


index = maps\_zombiemode_weapons::get_player_index(self);
player_index = "plr_" + index + "_";
if(!IsDefined (self.vox_ammo_out))
{
num_variants = maps\_zombiemode_spawner::get_number_variants(player_index + "vox_ammo_out");
self.vox_ammo_out = [];
for(i=0;i<num_variants;i++)
{
self.vox_ammo_out[self.vox_ammo_out.size] = "vox_ammo_out_" + i;
}
self.vox_ammo_out_available = self.vox_ammo_out;
}
sound_to_play = random(self.vox_ammo_out_available);

self.vox_ammo_out_available = array_remove(self.vox_ammo_out_available,sound_to_play);

if (self.vox_ammo_out_available.size < 1 )
{
self.vox_ammo_out_available = self.vox_ammo_out;
}

self maps\_zombiemode_spawner::do_player_playdialog(player_index, sound_to_play, 0.25);



}
/*------------------------------------
audio plays when more than 1 player connects
------------------------------------*/
spawn_vo()
{
//not sure if we need this
wait(1);

players = getplayers();

//just pick a random player for now and play some vo
if(players.size > 1)
{
player = random(players);
index = maps\_zombiemode_weapons::get_player_index(player);
player thread spawn_vo_player(index,players.size);
}

}

spawn_vo_player(index,num)
{
sound = "plr_" + index + "_vox_" + num +"play";
self playsound(sound, "sound_done");
self waittill("sound_done");
}

testing_spawner_bug()
{
wait( 0.1 );
level.round_number = 7;

spawners = [];
spawners[0] = GetEnt( "testy", "targetname" );
while( 1 )
{
wait( 1 );
level.enemy_spawns = spawners;
}
}

precache_shaders()
{
PrecacheShader( "hud_chalk_1" );
PrecacheShader( "hud_chalk_2" );
PrecacheShader( "hud_chalk_3" );
PrecacheShader( "hud_chalk_4" );
PrecacheShader( "hud_chalk_5" );
}

precache_models()
{
precachemodel( "char_ger_honorgd_zomb_behead" );
precachemodel( "char_ger_zombieeye" );
PrecacheModel( "tag_origin" );
}

init_shellshocks()
{
level.player_killed_shellshock = "zombie_death";
PrecacheShellshock( level.player_killed_shellshock );
}

init_strings()
{
PrecacheString( &"ZOMBIE_WEAPONCOSTAMMO" );
PrecacheString( &"ZOMBIE_ROUND" );
PrecacheString( &"SCRIPT_PLUS" );
PrecacheString( &"ZOMBIE_GAME_OVER" );
PrecacheString( &"ZOMBIE_SURVIVED_ROUND" );
PrecacheString( &"ZOMBIE_SURVIVED_ROUNDS" );

add_zombie_hint( "undefined", &"ZOMBIE_UNDEFINED" );

// Random Treasure Chest
add_zombie_hint( "default_treasure_chest_950", &"ZOMBIE_RANDOM_WEAPON_950" );

// Barrier Pieces
add_zombie_hint( "default_buy_barrier_piece_10", &"ZOMBIE_BUTTON_BUY_BACK_BARRIER_10" );
add_zombie_hint( "default_buy_barrier_piece_20", &"ZOMBIE_BUTTON_BUY_BACK_BARRIER_20" );
add_zombie_hint( "default_buy_barrier_piece_50", &"ZOMBIE_BUTTON_BUY_BACK_BARRIER_50" );
add_zombie_hint( "default_buy_barrier_piece_100", &"ZOMBIE_BUTTON_BUY_BACK_BARRIER_100" );

// REWARD Barrier Pieces
add_zombie_hint( "default_reward_barrier_piece", &"ZOMBIE_BUTTON_REWARD_BARRIER" );
add_zombie_hint( "default_reward_barrier_piece_10", &"ZOMBIE_BUTTON_REWARD_BARRIER_10" );
add_zombie_hint( "default_reward_barrier_piece_20", &"ZOMBIE_BUTTON_REWARD_BARRIER_20" );
add_zombie_hint( "default_reward_barrier_piece_30", &"ZOMBIE_BUTTON_REWARD_BARRIER_30" );
add_zombie_hint( "default_reward_barrier_piece_40", &"ZOMBIE_BUTTON_REWARD_BARRIER_40" );
add_zombie_hint( "default_reward_barrier_piece_50", &"ZOMBIE_BUTTON_REWARD_BARRIER_50" );

// Debris
add_zombie_hint( "default_buy_debris_100", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_100" );
add_zombie_hint( "default_buy_debris_200", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_200" );
add_zombie_hint( "default_buy_debris_250", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_250" );
add_zombie_hint( "default_buy_debris_500", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_500" );
add_zombie_hint( "default_buy_debris_750", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_750" );
add_zombie_hint( "default_buy_debris_1000", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_1000" );
add_zombie_hint( "default_buy_debris_1250", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_1250" );
add_zombie_hint( "default_buy_debris_1500", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_1500" );
add_zombie_hint( "default_buy_debris_1750", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_1750" );
add_zombie_hint( "default_buy_debris_2000", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_2000" );

// Doors
add_zombie_hint( "default_buy_door_100", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_100" );
add_zombie_hint( "default_buy_door_200", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_200" );
add_zombie_hint( "default_buy_door_250", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_250" );
add_zombie_hint( "default_buy_door_500", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_500" );
add_zombie_hint( "default_buy_door_750", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_750" );
add_zombie_hint( "default_buy_door_1000", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_1000" );
add_zombie_hint( "default_buy_door_1250", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_1250" );
add_zombie_hint( "default_buy_door_1500", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_1500" );
add_zombie_hint( "default_buy_door_1750", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_1750" );
add_zombie_hint( "default_buy_door_2000", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_2000" );

// Areas
add_zombie_hint( "default_buy_area_100", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_100" );
add_zombie_hint( "default_buy_area_200", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_200" );
add_zombie_hint( "default_buy_area_250", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_250" );
add_zombie_hint( "default_buy_area_500", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_500" );
add_zombie_hint( "default_buy_area_750", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_750" );
add_zombie_hint( "default_buy_area_1000", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_1000" );
add_zombie_hint( "default_buy_area_1250", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_1250" );
add_zombie_hint( "default_buy_area_1500", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_1500" );
add_zombie_hint( "default_buy_area_1750", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_1750" );
add_zombie_hint( "default_buy_area_2000", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_2000" );
}

init_sounds()
{
add_sound( "end_of_round", "round_over" );
add_sound( "end_of_game", "mx_game_over" ); //Had to remove this and add a music state switch so that we can add other musical elements.
add_sound( "chalk_one_up", "chalk" );
add_sound( "purchase", "cha_ching" );
add_sound( "no_purchase", "no_cha_ching" );

// Zombification
// TODO need to vary these up
add_sound( "playerzombie_usebutton_sound", "attack_vocals" );
add_sound( "playerzombie_attackbutton_sound", "attack_vocals" );
add_sound( "playerzombie_adsbutton_sound", "attack_vocals" );

// Head gib
add_sound( "zombie_head_gib", "zombie_head_gib" );

// Blockers
add_sound( "rebuild_barrier_piece", "repair_boards" );
add_sound( "rebuild_barrier_hover", "boards_float" );
add_sound( "debris_hover_loop", "couch_loop" );
add_sound( "break_barrier_piece", "break_boards" );
add_sound("blocker_end_move", "board_slam");
add_sound( "barrier_rebuild_slam", "board_slam" );

// Doors
add_sound( "door_slide_open", "door_slide_open" );
add_sound( "door_rotate_open", "door_slide_open" );

// Debris
add_sound( "debris_move", "weap_wall" );

// Random Weapon Chest
add_sound( "open_chest", "lid_open" );
add_sound( "music_chest", "music_box" );
add_sound( "close_chest", "lid_close" );

// Weapons on walls
add_sound( "weapon_show", "weap_wall" );

}

init_levelvars()
{
level.intermission = false;
level.dog_intermission = false;
level.zombie_total = 0;
level.no_laststandmissionfail = true;

level.zombie_vars = [];

// Default to not zombify the player till further support
set_zombie_var( "zombify_player", false );

set_zombie_var( "below_world_check", -1000 );

// Respawn in the spectators in between rounds
set_zombie_var( "spectators_respawn", true );

// Round
set_zombie_var( "zombie_use_failsafe", true );
set_zombie_var( "zombie_round_time", 30 );
set_zombie_var( "zombie_between_round_time", 10 );
set_zombie_var( "zombie_intermission_time", 15 );

// Spawning
set_zombie_var( "zombie_spawn_delay", 2 );



// AI
set_zombie_var( "zombie_health_increase", 100 );
set_zombie_var( "zombie_health_increase_percent", 10, 100 );
set_zombie_var( "zombie_health_start", 150 );
set_zombie_var( "zombie_max_ai", 24 );
set_zombie_var( "zombie_ai_per_player", 6 );

// Scoring
set_zombie_var( "zombie_score_start", 500 );
/#
if( GetDvarInt( "zombie_cheat" ) >= 1 )
{
set_zombie_var( "zombie_score_start", 100000 );
}
#/
set_zombie_var( "zombie_score_kill", 50 );
set_zombie_var( "zombie_score_damage", 5 );
set_zombie_var( "zombie_score_bonus_melee", 80 );
set_zombie_var( "zombie_score_bonus_head", 50 );
set_zombie_var( "zombie_score_bonus_neck", 20 );
set_zombie_var( "zombie_score_bonus_torso", 10 );
set_zombie_var( "zombie_score_bonus_burn", 10 );

set_zombie_var( "penalty_no_revive_percent", 10, 100 );
set_zombie_var( "penalty_died_percent", 0, 100 );
set_zombie_var( "penalty_downed_percent", 5, 100 );

set_zombie_var( "zombie_flame_dmg_point_delay", 500 );

if ( IsSplitScreen() )
{
set_zombie_var( "zombie_timer_offset", 280 ); // hud offsets
}
}

init_dvars()
{
level.zombiemode = true;

//coder mod: tkeegan - new code dvar
setSavedDvar( "zombiemode", "1" );
SetDvar( "ui_gametype", "zom" );
setSavedDvar( "fire_world_damage", "0" );
setSavedDvar( "fire_world_damage_rate", "0" );
setSavedDvar( "fire_world_damage_duration", "0" );

if( GetDvar( "zombie_debug" ) == "" )
{
SetDvar( "zombie_debug", "0" );
}

if( GetDvar( "zombie_cheat" ) == "" )
{
SetDvar( "zombie_cheat", "0" );
}

if(getdvar("magic_chest_movable") == "")
{
SetDvar( "magic_chest_movable", "1" );
}

if(getdvar("magic_box_explore_only") == "")
{
SetDvar( "magic_box_explore_only", "1" );
}

SetDvar( "revive_trigger_radius", "60" );
}

initZombieLeaderboardData()
{
// Initializing Leaderboard Stat Variables
level.zombieLeaderboardStatVariable["nazi_zombie_prototype"]["highestwave"] = "nz_prototype_highestwave";
level.zombieLeaderboardStatVariable["nazi_zombie_prototype"]["timeinwave"] = "nz_prototype_timeinwave";
level.zombieLeaderboardStatVariable["nazi_zombie_prototype"]["totalpoints"] = "nz_prototype_totalpoints";

level.zombieLeaderboardStatVariable["nazi_zombie_asylum"]["highestwave"] = "nz_asylum_highestwave";
level.zombieLeaderboardStatVariable["nazi_zombie_asylum"]["timeinwave"] = "nz_asylum_timeinwave";
level.zombieLeaderboardStatVariable["nazi_zombie_asylum"]["totalpoints"] = "nz_asylum_totalpoints";

level.zombieLeaderboardStatVariable["nazi_zombie_sumpf"]["highestwave"] = "nz_sumpf_highestwave";
level.zombieLeaderboardStatVariable["nazi_zombie_sumpf"]["timeinwave"] = "nz_sumpf_timeinwave";
level.zombieLeaderboardStatVariable["nazi_zombie_sumpf"]["totalpoints"] = "nz_sumpf_totalpoints";

level.zombieLeaderboardStatVariable["nazi_zombie_factory"]["highestwave"] = "nz_factory_highestwave";
level.zombieLeaderboardStatVariable["nazi_zombie_factory"]["timeinwave"] = "nz_factory_timeinwave";
level.zombieLeaderboardStatVariable["nazi_zombie_factory"]["totalpoints"] = "nz_factory_totalpoints";

// Initializing Leaderboard Number
level.zombieLeaderboardNumber["nazi_zombie_prototype"]["waves"] = 13;
level.zombieLeaderboardNumber["nazi_zombie_prototype"]["points"] = 14;

level.zombieLeaderboardNumber["nazi_zombie_asylum"]["waves"] = 15;
level.zombieLeaderboardNumber["nazi_zombie_asylum"]["points"] = 16;

level.zombieLeaderboardNumber["nazi_zombie_sumpf"]["waves"] = 17;
level.zombieLeaderboardNumber["nazi_zombie_sumpf"]["points"] = 18;

level.zombieLeaderboardNumber["nazi_zombie_factory"]["waves"] = 19;
level.zombieLeaderboardNumber["nazi_zombie_factory"]["points"] = 20;
}


init_flags()
{
flag_init("spawn_point_override");
flag_init("electricity_on");
flag_init("crawler_round");
}


init_fx()
{
level._effect["wood_chunk_destory"] = loadfx( "impacts/large_woodhit" );

level._effect["edge_fog"] = LoadFx( "env/smoke/fx_fog_zombie_amb" );
level._effect["chest_light"] = LoadFx( "env/light/fx_ray_sun_sm_short" );

level._effect["eye_glow"] = LoadFx( "misc/fx_zombie_eye_single" );

level._effect["zombie_grain"] = LoadFx( "misc/fx_zombie_grain_cloud" );

level._effect["headshot"] = LoadFX( "impacts/flesh_hit_head_fatal_lg_exit" );
level._effect["headshot_nochunks"] = LoadFX( "misc/fx_zombie_bloodsplat" );
level._effect["bloodspurt"] = LoadFX( "misc/fx_zombie_bloodspurt" );
level._effect["tesla_head_light"] = Loadfx( "maps/zombie/fx_zombie_tesla_neck_spurt");

level._effect["rise_burst_water"] = LoadFx("maps/zombie/fx_zombie_body_wtr_burst");
level._effect["rise_billow_water"] = LoadFx("maps/zombie/fx_zombie_body_wtr_billowing");
level._effect["rise_dust_water"] = LoadFx("maps/zombie/fx_zombie_body_wtr_falling");

level._effect["rise_burst"] = LoadFx("maps/mp_maps/fx_mp_zombie_hand_dirt_burst");
level._effect["rise_billow"] = LoadFx("maps/mp_maps/fx_mp_zombie_body_dirt_billowing");
level._effect["rise_dust"] = LoadFx("maps/mp_maps/fx_mp_zombie_body_dust_falling");

// Flamethrower
level._effect["character_fire_pain_sm"]              = loadfx( "env/fire/fx_fire_player_sm_1sec" );
level._effect["character_fire_death_sm"]              = loadfx( "env/fire/fx_fire_player_md" );
level._effect["character_fire_death_torso"] = loadfx( "env/fire/fx_fire_player_torso" );
}

// zombie specific anims

init_standard_zombie_anims()
{
// deaths
level.scr_anim["zombie"]["death1"] = %ai_zombie_death_v1;
level.scr_anim["zombie"]["death2"] = %ai_zombie_death_v2;
level.scr_anim["zombie"]["death3"] = %ai_zombie_crawl_death_v1;
level.scr_anim["zombie"]["death4"] = %ai_zombie_crawl_death_v2;

// run cycles

level.scr_anim["zombie"]["walk1"] = %ai_zombie_walk_v1;
level.scr_anim["zombie"]["walk2"] = %ai_zombie_walk_v2;
level.scr_anim["zombie"]["walk3"] = %ai_zombie_walk_v3;
level.scr_anim["zombie"]["walk4"] = %ai_zombie_walk_v4;

level.scr_anim["zombie"]["run1"] = %ai_zombie_walk_fast_v1;
level.scr_anim["zombie"]["run2"] = %ai_zombie_walk_fast_v2;
level.scr_anim["zombie"]["run3"] = %ai_zombie_walk_fast_v3;
level.scr_anim["zombie"]["run4"] = %ai_zombie_run_v2;
level.scr_anim["zombie"]["run5"] = %ai_zombie_run_v4;
level.scr_anim["zombie"]["run6"] = %ai_zombie_run_v3;
//level.scr_anim["zombie"]["run4"] = %ai_zombie_run_v1;
//level.scr_anim["zombie"]["run6"] = %ai_zombie_run_v4;

level.scr_anim["zombie"]["sprint1"] = %ai_zombie_sprint_v1;
level.scr_anim["zombie"]["sprint2"] = %ai_zombie_sprint_v2;
level.scr_anim["zombie"]["sprint3"] = %ai_zombie_sprint_v1;
level.scr_anim["zombie"]["sprint4"] = %ai_zombie_sprint_v2;
//level.scr_anim["zombie"]["sprint3"] = %ai_zombie_sprint_v3;
//level.scr_anim["zombie"]["sprint3"] = %ai_zombie_sprint_v4;
//level.scr_anim["zombie"]["sprint4"] = %ai_zombie_sprint_v5;

// run cycles in prone
level.scr_anim["zombie"]["crawl1"] = %ai_zombie_crawl;
level.scr_anim["zombie"]["crawl2"] = %ai_zombie_crawl_v1;
level.scr_anim["zombie"]["crawl3"] = %ai_zombie_crawl_v2;
level.scr_anim["zombie"]["crawl4"] = %ai_zombie_crawl_v3;
level.scr_anim["zombie"]["crawl5"] = %ai_zombie_crawl_v4;
level.scr_anim["zombie"]["crawl6"] = %ai_zombie_crawl_v5;
level.scr_anim["zombie"]["crawl_hand_1"] = %ai_zombie_walk_on_hands_a;
level.scr_anim["zombie"]["crawl_hand_2"] = %ai_zombie_walk_on_hands_b;




level.scr_anim["zombie"]["crawl_sprint1"] = %ai_zombie_crawl_sprint;
level.scr_anim["zombie"]["crawl_sprint2"] = %ai_zombie_crawl_sprint_1;
level.scr_anim["zombie"]["crawl_sprint3"] = %ai_zombie_crawl_sprint_2;

if( !isDefined( level._zombie_melee ) )
{
level._zombie_melee = [];
}
if( !isDefined( level._zombie_walk_melee ) )
{
level._zombie_walk_melee = [];
}
if( !isDefined( level._zombie_run_melee ) )
{
level._zombie_run_melee = [];
}

level._zombie_melee["zombie"] = [];
level._zombie_walk_melee["zombie"] = [];
level._zombie_run_melee["zombie"] = [];

level._zombie_melee["zombie"][0] = %ai_zombie_attack_forward_v1;
level._zombie_melee["zombie"][1] = %ai_zombie_attack_forward_v2;
level._zombie_melee["zombie"][2] = %ai_zombie_attack_v1;
level._zombie_melee["zombie"][3] = %ai_zombie_attack_v2;
level._zombie_melee["zombie"][4] = %ai_zombie_attack_v1;
level._zombie_melee["zombie"][5] = %ai_zombie_attack_v4;
level._zombie_melee["zombie"][6] = %ai_zombie_attack_v6;
level._zombie_run_melee["zombie"][0] = %ai_zombie_run_attack_v1;
level._zombie_run_melee["zombie"][1] = %ai_zombie_run_attack_v2;
level._zombie_run_melee["zombie"][2] = %ai_zombie_run_attack_v3;
level.scr_anim["zombie"]["walk5"] = %ai_zombie_walk_v6;
level.scr_anim["zombie"]["walk6"] = %ai_zombie_walk_v7;
level.scr_anim["zombie"]["walk7"] = %ai_zombie_walk_v8;
level.scr_anim["zombie"]["walk8"] = %ai_zombie_walk_v9;

if( isDefined( level.zombie_anim_override ) )
{
[[ level.zombie_anim_override ]]();
}

level._zombie_walk_melee["zombie"][0] = %ai_zombie_walk_attack_v1;
level._zombie_walk_melee["zombie"][1] = %ai_zombie_walk_attack_v2;
level._zombie_walk_melee["zombie"][2] = %ai_zombie_walk_attack_v3;
level._zombie_walk_melee["zombie"][3] = %ai_zombie_walk_attack_v4;

// melee in crawl
if( !isDefined( level._zombie_melee_crawl ) )
{
level._zombie_melee_crawl = [];
}
level._zombie_melee_crawl["zombie"] = [];
level._zombie_melee_crawl["zombie"][0] = %ai_zombie_attack_crawl;
level._zombie_melee_crawl["zombie"][1] = %ai_zombie_attack_crawl_lunge;

if( !isDefined( level._zombie_stumpy_melee ) )
{
level._zombie_stumpy_melee = [];
}
level._zombie_stumpy_melee["zombie"] = [];
level._zombie_stumpy_melee["zombie"][0] = %ai_zombie_walk_on_hands_shot_a;
level._zombie_stumpy_melee["zombie"][1] = %ai_zombie_walk_on_hands_shot_b;
//level._zombie_melee_crawl["zombie"][2] = %ai_zombie_crawl_attack_A;

// tesla deaths
if( !isDefined( level._zombie_tesla_death ) )
{
level._zombie_tesla_death = [];
}
level._zombie_tesla_death["zombie"] = [];
level._zombie_tesla_death["zombie"][0] = %ai_zombie_tesla_death_a;
level._zombie_tesla_death["zombie"][1] = %ai_zombie_tesla_death_b;
level._zombie_tesla_death["zombie"][2] = %ai_zombie_tesla_death_c;
level._zombie_tesla_death["zombie"][3] = %ai_zombie_tesla_death_d;
level._zombie_tesla_death["zombie"][4] = %ai_zombie_tesla_death_e;

if( !isDefined( level._zombie_tesla_crawl_death ) )
{
level._zombie_tesla_crawl_death = [];
}
level._zombie_tesla_crawl_death["zombie"] = [];
level._zombie_tesla_crawl_death["zombie"][0] = %ai_zombie_tesla_crawl_death_a;
level._zombie_tesla_crawl_death["zombie"][1] = %ai_zombie_tesla_crawl_death_b;

// deaths
if( !isDefined( level._zombie_deaths ) )
{
level._zombie_deaths = [];
}
level._zombie_deaths["zombie"] = [];
level._zombie_deaths["zombie"][0] = %ch_dazed_a_death;
level._zombie_deaths["zombie"][1] = %ch_dazed_b_death;
level._zombie_deaths["zombie"][2] = %ch_dazed_c_death;
level._zombie_deaths["zombie"][3] = %ch_dazed_d_death;

/*
ground crawl
*/

if( !isDefined( level._zombie_rise_anims ) )
{
level._zombie_rise_anims = [];
}

// set up the arrays
level._zombie_rise_anims["zombie"] = [];

//level._zombie_rise_anims["zombie"][1]["walk"][0] = %ai_zombie_traverse_ground_v1_crawl;
level._zombie_rise_anims["zombie"][1]["walk"][0] = %ai_zombie_traverse_ground_v1_walk;

//level._zombie_rise_anims["zombie"][1]["run"][0] = %ai_zombie_traverse_ground_v1_crawlfast;
level._zombie_rise_anims["zombie"][1]["run"][0] = %ai_zombie_traverse_ground_v1_run;

level._zombie_rise_anims["zombie"][1]["sprint"][0] = %ai_zombie_traverse_ground_climbout_fast;

//level._zombie_rise_anims["zombie"][2]["walk"][0] = %ai_zombie_traverse_ground_v2_walk; //!broken
level._zombie_rise_anims["zombie"][2]["walk"][0] = %ai_zombie_traverse_ground_v2_walk_altA;
//level._zombie_rise_anims["zombie"][2]["walk"][2] = %ai_zombie_traverse_ground_v2_walk_altB;//!broken

// ground crawl death
if( !isDefined( level._zombie_rise_death_anims ) )
{
level._zombie_rise_death_anims = [];
}

level._zombie_rise_death_anims["zombie"] = [];

level._zombie_rise_death_anims["zombie"][1]["in"][0] = %ai_zombie_traverse_ground_v1_deathinside;
level._zombie_rise_death_anims["zombie"][1]["in"][1] = %ai_zombie_traverse_ground_v1_deathinside_alt;

level._zombie_rise_death_anims["zombie"][1]["out"][0] = %ai_zombie_traverse_ground_v1_deathoutside;
level._zombie_rise_death_anims["zombie"][1]["out"][1] = %ai_zombie_traverse_ground_v1_deathoutside_alt;

level._zombie_rise_death_anims["zombie"][2]["in"][0] = %ai_zombie_traverse_ground_v2_death_low;
level._zombie_rise_death_anims["zombie"][2]["in"][1] = %ai_zombie_traverse_ground_v2_death_low_alt;

level._zombie_rise_death_anims["zombie"][2]["out"][0] = %ai_zombie_traverse_ground_v2_death_high;
level._zombie_rise_death_anims["zombie"][2]["out"][1] = %ai_zombie_traverse_ground_v2_death_high_alt;

//taunts
if( !isDefined( level._zombie_run_taunt ) )
{
level._zombie_run_taunt = [];
}
if( !isDefined( level._zombie_board_taunt ) )
{
level._zombie_board_taunt = [];
}
level._zombie_run_taunt["zombie"] = [];
level._zombie_board_taunt["zombie"] = [];

//level._zombie_taunt["zombie"][0] = %ai_zombie_taunts_1;
//level._zombie_taunt["zombie"][1] = %ai_zombie_taunts_4;
//level._zombie_taunt["zombie"][2] = %ai_zombie_taunts_5b;
//level._zombie_taunt["zombie"][3] = %ai_zombie_taunts_5c;
//level._zombie_taunt["zombie"][4] = %ai_zombie_taunts_5d;
//level._zombie_taunt["zombie"][5] = %ai_zombie_taunts_5e;
//level._zombie_taunt["zombie"][6] = %ai_zombie_taunts_5f;
//level._zombie_taunt["zombie"][7] = %ai_zombie_taunts_7;
//level._zombie_taunt["zombie"][8] = %ai_zombie_taunts_9;
//level._zombie_taunt["zombie"][8] = %ai_zombie_taunts_11;
//level._zombie_taunt["zombie"][8] = %ai_zombie_taunts_12;

level._zombie_board_taunt["zombie"][0] = %ai_zombie_taunts_4;
level._zombie_board_taunt["zombie"][1] = %ai_zombie_taunts_7;
level._zombie_board_taunt["zombie"][2] = %ai_zombie_taunts_9;
level._zombie_board_taunt["zombie"][3] = %ai_zombie_taunts_5b;
level._zombie_board_taunt["zombie"][4] = %ai_zombie_taunts_5c;
level._zombie_board_taunt["zombie"][5] = %ai_zombie_taunts_5d;
level._zombie_board_taunt["zombie"][6] = %ai_zombie_taunts_5e;
level._zombie_board_taunt["zombie"][7] = %ai_zombie_taunts_5f;
}

init_anims()
{
init_standard_zombie_anims();
}

// Initialize any animscript related variables
init_animscripts()
{
// Setup the animscripts, then override them (we call this just incase an AI has not yet spawned)
animscripts\init::firstInit();

anim.idleAnimArray ["stand"] = [];
anim.idleAnimWeights ["stand"] = [];
anim.idleAnimArray ["stand"][0][0] = %ai_zombie_idle_v1_delta;
anim.idleAnimWeights ["stand"][0][0] = 10;

anim.idleAnimArray ["crouch"] = [];
anim.idleAnimWeights ["crouch"] = [];
anim.idleAnimArray ["crouch"][0][0] = %ai_zombie_idle_crawl_delta;
anim.idleAnimWeights ["crouch"][0][0] = 10;
}

// Handles the intro screen
zombie_intro_screen( string1, string2, string3, string4, string5 )
{
flag_wait( "all_players_connected" );

wait( 1 );

//TUEY Set music state to Splash Screencompass
setmusicstate( "SPLASH_SCREEN" );
wait (0.2);
//TUEY Set music state to WAVE_1
// setmusicstate("WAVE_1");
}

players_playing()
{
// initialize level.players_playing
players = get_players();
level.players_playing = players.size;

wait( 20 );

players = get_players();
level.players_playing = players.size;
}

//
// NETWORK SECTION ====================================================================== //
//

watchGrenadeThrow()
{
self endon( "disconnect" );
self endon( "death" );

while(1)
{
self waittill("grenade_fire", grenade);

if(isdefined(grenade))
{
if(self maps\_laststand::player_is_in_laststand())
{
grenade delete();
}
}
}
}

onPlayerConnect()
{
for( ;; )
{
level waittill( "connecting", player );

player.entity_num = player GetEntityNumber();
player thread onPlayerSpawned();
player thread onPlayerDisconnect();
player thread player_revive_monitor();

//player thread watchGrenadeThrow();

player.score = level.zombie_vars["zombie_score_start"];
player.score_total = player.score;
player.old_score = player.score;

player.is_zombie = false;
player.initialized = false;
player.zombification_time = 0;
}
}

onPlayerConnect_clientDvars()
{
self SetClientDvars( "cg_deadChatWithDead", "1",
"cg_deadChatWithTeam", "1",
"cg_deadHearTeamLiving", "1",
"cg_deadHearAllLiving", "1",
"cg_everyoneHearsEveryone", "1",
"compass", "0",
"hud_showStance", "0",
"cg_thirdPerson", "0",
"cg_fov", "65",
"cg_thirdPersonAngle", "0",
"ammoCounterHide", "0",
"miniscoreboardhide", "0",
"ui_hud_hardcore", "0" );

self SetDepthOfField( 0, 0, 512, 4000, 4, 0 );
}

onPlayerDisconnect()
{
self waittill( "disconnect" );
self remove_from_spectate_list();
}

onPlayerSpawned()
{
self endon( "disconnect" );

for( ;; )
{
self waittill( "spawned_player" );



self SetClientDvars( "cg_thirdPerson", "0",
"cg_fov", "65",
"cg_thirdPersonAngle", "0" );

self SetDepthOfField( 0, 0, 512, 4000, 4, 0 );

self add_to_spectate_list();

if( isdefined( self.initialized ) )
{
if( self.initialized == false )
{
self.initialized = true;
// self maps\_zombiemode_score::create_player_score_hud();

// set the initial score on the hud
self maps\_zombiemode_score::set_player_score_hud( true );
self thread player_zombie_breadcrumb();

//Init stat tracking variables
self.stats["kills"] = 0;
self.stats["score"] = 0;
self.stats["downs"] = 0;
self.stats["revives"] = 0;
self.stats["perks"] = 0;
self.stats["headshots"] = 0;
self.stats["zombie_gibs"] = 0;
}
}
}
}


//
// Keep track of players going down and getting revived
player_revive_monitor()
{
self endon( "disconnect" );

while (1)
{
self waittill( "player_revived", reviver );

if ( IsDefined(reviver) )
{
// Check to see how much money you lost from being down.
points = self.score_lost_when_downed;
if ( points > 300 )
{
points = 300;
}
reviver maps\_zombiemode_score::add_to_player_score( points );
self.score_lost_when_downed = 0;
}
}
}


player_laststand()
{
self maps\_zombiemode_score::player_downed_penalty();

if( IsDefined( self.intermission ) && self.intermission )
{
maps\_challenges_coop::doMissionCallback( "playerDied", self );

level waittill( "forever" );
}
}

spawnSpectator()
{
self endon( "disconnect" );
self endon( "spawned_spectator" );
self notify( "spawned" );
self notify( "end_respawn" );

if( level.intermission )
{
return;
}

if( IsDefined( level.no_spectator ) && level.no_spectator )
{
wait( 3 );
ExitLevel();
}

// The check_for_level_end looks for this
self.is_zombie = true;

// Remove all reviving abilities
self notify ( "zombified" );

if( IsDefined( self.revivetrigger ) )
{
self.revivetrigger delete();
self.revivetrigger = undefined;
}

self.zombification_time = getTime(); //set time when player died

resetTimeout();

// Stop shellshock and rumble
self StopShellshock();
self StopRumble( "damage_heavy" );

self.sessionstate = "spectator";
self.spectatorclient = -1;

self remove_from_spectate_list();

self.maxhealth = self.health;
self.shellshocked = false;
self.inWater = false;
self.friendlydamage = undefined;
self.hasSpawned = true;
self.spawnTime = getTime();
self.afk = false;

println( "*************************Zombie Spectator***" );
self detachAll();

self setSpectatePermissions( true );
self thread spectator_thread();

self Spawn( self.origin, self.angles );
self notify( "spawned_spectator" );
}

setSpectatePermissions( isOn )
{
self AllowSpectateTeam( "allies", isOn );
self AllowSpectateTeam( "axis", false );
self AllowSpectateTeam( "freelook", false );
self AllowSpectateTeam( "none", false );
}

spectator_thread()
{
self endon( "disconnect" );
self endon( "spawned_player" );

if( IsSplitScreen() )
{
last_alive = undefined;
players = get_players();

for( i = 0; i < players.size; i++ )
{
if( !players[i].is_zombie )
{
last_alive = players[i];
}
}

share_screen( last_alive, true );

return;
}

self thread spectator_toggle_3rd_person();
}

spectator_toggle_3rd_person()
{
self endon( "disconnect" );
self endon( "spawned_player" );

third_person = true;
self set_third_person( true );
// self NotifyOnCommand( "toggle_3rd_person", "weapnext" );

// while( 1 )
// {
// self waittill( "toggle_3rd_person" );
//
// if( third_person )
// {
// third_person = false;
// self set_third_person( false );
// wait( 0.5 );
// }
// else
// {
// third_person = true;
// self set_third_person( true );
// wait( 0.5 );
// }
// }
}


set_third_person( value )
{
if( value )
{
self SetClientDvars( "cg_thirdPerson", "1",
"cg_fov", "40",
"cg_thirdPersonAngle", "354" );

self setDepthOfField( 0, 128, 512, 4000, 6, 1.8 );
}
else
{
self SetClientDvars( "cg_thirdPerson", "0",
"cg_fov", "65",
"cg_thirdPersonAngle", "0" );

self setDepthOfField( 0, 0, 512, 4000, 4, 0 );
}
}

spectators_respawn()
{
level endon( "between_round_over" );

if( !IsDefined( level.zombie_vars["spectators_respawn"] ) || !level.zombie_vars["spectators_respawn"] )
{
return;
}

if( !IsDefined( level.custom_spawnPlayer ) )
{
// Custom spawn call for when they respawn from spectator
level.custom_spawnPlayer = ::spectator_respawn;
}

while( 1 )
{
players = get_players();
for( i = 0; i < players.size; i++ )
{
if( players[i].sessionstate == "spectator" )
{
players[i] [[level.spawnPlayer]]();
if( isDefined( players[i].has_altmelee ) && players[i].has_altmelee )
{
players[i] SetPerk( "specialty_altmelee" );
}
if (isDefined(level.script) && level.round_number > 6 && players[i].score < 1500)
{
players[i].old_score = players[i].score;
players[i].score = 1500;
players[i] maps\_zombiemode_score::set_player_score_hud();
}
}
}

wait( 1 );
}
}

spectator_respawn()
{
println( "*************************Respawn Spectator***" );
assert( IsDefined( self.spectator_respawn ) );

origin = self.spectator_respawn.origin;
angles = self.spectator_respawn.angles;

self setSpectatePermissions( false );

new_origin = undefined;


new_origin = check_for_valid_spawn_near_team( self );


if( IsDefined( new_origin ) )
{
self Spawn( new_origin, angles );
}
else
{
self Spawn( origin, angles );
}


if( IsSplitScreen() )
{
last_alive = undefined;
players = get_players();

for( i = 0; i < players.size; i++ )
{
if( !players[i].is_zombie )
{
last_alive = players[i];
}
}

share_screen( last_alive, false );
}

self.has_betties = undefined;
self.is_burning = undefined;

// The check_for_level_end looks for this
self.is_zombie = false;
self.ignoreme = false;

setClientSysState("lsm", "0", self); // Notify client last stand ended.
self RevivePlayer();

self notify( "spawned_player" );

// Penalize the player when we respawn, since he 'died'
self maps\_zombiemode_score::player_reduce_points( "died" );

self thread player_zombie_breadcrumb();

return true;
}

check_for_valid_spawn_near_team( revivee )
{

players = get_players();
spawn_points = getstructarray("player_respawn_point", "targetname");

if( spawn_points.size == 0 )
return undefined;

for( i = 0; i < players.size; i++ )
{
if( is_player_valid( players[i] ) )
{
for( j = 0 ; j < spawn_points.size; j++ )
{
if( DistanceSquared( players[i].origin, spawn_points[j].origin ) < ( 1000 * 1000 ) && spawn_points[j].locked == false )
{
spawn_array = getstructarray( spawn_points[j].target, "targetname" );

for( k = 0; k < spawn_array.size; k++ )
{
if( spawn_array[k].script_int == (revivee.entity_num + 1) )
{
return spawn_array[k].origin;
}
}

return spawn_array[0].origin;
}

}

}

}

return undefined;

}


get_players_on_team(exclude)
{

teammates = [];

players = get_players();
for(i=0;i<players.size;i++)
{
//check to see if other players on your team are alive and not waiting to be revived
if(players[i].spawn_side == self.spawn_side && !isDefined(players[i].revivetrigger) && players[i] != exclude )
{
teammates[teammates.size] = players[i];
}
}

return teammates;
}



get_safe_breadcrumb_pos( player )
{
players = get_players();
valid_players = [];

min_dist = 150 * 150;
for( i = 0; i < players.size; i++ )
{
if( !is_player_valid( players[i] ) )
{
continue;
}

valid_players[valid_players.size] = players[i];
}

for( i = 0; i < valid_players.size; i++ )
{
count = 0;
for( q = 1; q < player.zombie_breadcrumbs.size; q++ )
{
if( DistanceSquared( player.zombie_breadcrumbs[q], valid_players[i].origin ) < min_dist )
{
continue;
}

count++;
if( count == valid_players.size )
{
return player.zombie_breadcrumbs[q];
}
}
}

return undefined;
}

round_spawning()
{
level endon( "intermission" );
/#
level endon( "kill_round" );
#/

if( level.intermission )
{
return;
}

if( level.enemy_spawns.size < 1 )
{
ASSERTMSG( "No spawners with targetname zombie_spawner in map." );
return;
}

/#
if ( GetDVarInt( "zombie_cheat" ) == 2 || GetDVarInt( "zombie_cheat" ) >= 4 )
{
return;
}
#/

ai_calculate_health();

count = 0;

//CODER MOD: TOMMY K
players = get_players();
for( i = 0; i < players.size; i++ )
{
players[i].zombification_time = 0;
}

max = level.zombie_vars["zombie_max_ai"];

multiplier = level.round_number / 5;
if( multiplier < 1 )
{
multiplier = 1;
}

// After round 10, exponentially have more AI attack the player
if( level.round_number >= 10 )
{
multiplier *= level.round_number * 0.15;
}

player_num = get_players().size;

if( player_num == 1 )
{
max += int( ( 0.5 * level.zombie_vars["zombie_ai_per_player"] ) * multiplier );
}
else
{
max += int( ( ( player_num - 1 ) * level.zombie_vars["zombie_ai_per_player"] ) * multiplier );
}



if(level.round_number < 3 && level.script == "nazi_zombie_asylum")
{
if(get_players().size > 1)
{

max = get_players().size * 3 + level.round_number;

}
else
{

max = 6;

}
}
else if ( level.first_round )
{
max = int( max * 0.2 );
}
else if (level.round_number < 3)
{
max = int( max * 0.4 );
}
else if (level.round_number < 4)
{
max = int( max * 0.6 );
}
else if (level.round_number < 5)
{
max = int( max * 0.8 );
}


level.zombie_total = max;
mixed_spawns = 0; // Number of mixed spawns this round.  Currently means number of dogs in a mixed round

// DEBUG HACK:
//max = 1;
old_spawn = undefined;
while( count < max )
{

spawn_point = level.enemy_spawns[RandomInt( level.enemy_spawns.size )];

if( !IsDefined( old_spawn ) )
{
old_spawn = spawn_point;
}
else if( Spawn_point == old_spawn )
{
spawn_point = level.enemy_spawns[RandomInt( level.enemy_spawns.size )];
}
old_spawn = spawn_point;

// iPrintLn(spawn_point.targetname + " " + level.zombie_vars["zombie_spawn_delay"]);
while( get_enemy_count() > 31 )
{
wait( 0.05 );
}

// MM Mix in dog spawns...
if ( IsDefined( level.mixed_rounds_enabled ) && level.mixed_rounds_enabled == 1 )
{
spawn_dog = false;
if ( level.round_number > 30 )
{
if ( RandomInt(100) < 3 )
{
spawn_dog = true;
}
}
else if ( level.round_number > 25 && mixed_spawns < 3 )
{
if ( RandomInt(100) < 2 )
{
spawn_dog = true;
}
}
else if ( level.round_number > 20 && mixed_spawns < 2 )
{
if ( RandomInt(100) < 2 )
{
spawn_dog = true;
}
}
else if ( level.round_number > 15 && mixed_spawns < 1 )
{
if ( RandomInt(100) < 1 )
{
spawn_dog = true;
}
}

if ( spawn_dog )
{
keys = GetArrayKeys( level.zones );
for ( i=0; i<keys.size; i++ )
{
if ( level.zones[ keys[i] ].is_occupied )
{
akeys = GetArrayKeys( level.zones[ keys[i] ].adjacent_zones );
for ( k=0; k<akeys.size; k++ )
{
if ( level.zones[ akeys[k] ].is_active &&
!level.zones[ akeys[k] ].is_occupied &&
level.zones[ akeys[k] ].dog_locations.size > 0 )
{
maps\_zombiemode_dogs::special_dog_spawn( undefined, 1 );
level.zombie_total--;
wait_network_frame();
}
}
}
}
}
}

ai = spawn_zombie( spawn_point );
if( IsDefined( ai ) )
{
level.zombie_total--;
ai thread round_spawn_failsafe();
count++;
}
wait( level.zombie_vars["zombie_spawn_delay"] );
wait_network_frame();
}

if( level.round_number > 3 )
{
zombies = getaiarray( "axis" );
while( zombies.size > 0 )
{
if( zombies.size == 1 && zombies[0].has_legs == true )
{
var = randomintrange(1, 4);
zombies[0] set_run_anim( "sprint" + var );                       
zombies[0].run_combatanim = level.scr_anim[zombies[0].animname]["sprint" + var];
}
wait(0.5);
zombies = getaiarray("axis");
}

}

}

// TESTING: spawn one zombie at a time
round_spawning_test()
{
while (true)
{
spawn_point = level.enemy_spawns[RandomInt( level.enemy_spawns.size )]; // grab a random spawner

ai = spawn_zombie( spawn_point );
ai waittill("death");

wait 5;
}
}
/////////////////////////////////////////////////////////

round_text( text )
{
if( level.first_round )
{
intro = true;
}
else
{
intro = false;
}

hud = create_simple_hud();
hud.horzAlign = "center";
hud.vertAlign = "middle";
hud.alignX = "center";
hud.alignY = "middle";
hud.y = -100;
hud.foreground = 1;
hud.fontscale = 16.0;
hud.alpha = 0;
hud.color = ( 1, 1, 1 );

hud SetText( text );
hud FadeOverTime( 1.5 );
hud.alpha = 1;
wait( 1.5 );

if( intro )
{
wait( 1 );
level notify( "intro_change_color" );
}

hud FadeOverTime( 3 );
//hud.color = ( 0.8, 0, 0 );
hud.color = ( 0.423, 0.004, 0 );
wait( 3 );

if( intro )
{
level waittill( "intro_hud_done" );
}

hud FadeOverTime( 1.5 );
hud.alpha = 0;
wait( 1.5 );
hud destroy();
}

round_start()
{
level.zombie_health = level.zombie_vars["zombie_health_start"];
level.round_number = 1;
level.first_round = true;

// so players get init'ed with grenades
players = get_players();
for (i = 0; i < players.size; i++)
{
players[i] giveweapon( "stielhandgranate" );
players[i] setweaponammoclip( "stielhandgranate", 0);
}

level.chalk_hud1 = create_chalk_hud();
level.chalk_hud2 = create_chalk_hud( 64 );

// level waittill( "introscreen_done" );

level.round_spawn_func = ::round_spawning;

/#
if (GetDVarInt("zombie_rise_test"))
{
level.round_spawn_func = ::round_spawning_test; // FOR TESTING, one zombie at a time, no round advancement
}
#/

level thread round_think();
}


create_chalk_hud( x )
{
if( !IsDefined( x ) )
{
x = 0;
}

hud = create_simple_hud();
hud.alignX = "left";
hud.alignY = "bottom";
hud.horzAlign = "left";
hud.vertAlign = "bottom";
hud.color = ( 0.423, 0.004, 0 );
hud.x = x;
hud.alpha = 0;

hud SetShader( "hud_chalk_1", 64, 64 );

return hud;
}
play_intro_VO()
{

wait(3);
players = getplayers();
for(i=0;i<players.size;i++)
{
index = maps\_zombiemode_weapons::get_player_index(players[i]);
player_index = "plr_" + index + "_";
sound_to_play = "vox_name_int_0";
players[i] maps\_zombiemode_spawner::do_player_playdialog(player_index, sound_to_play, 0.05);
wait(0.7);
}

//Plays a random start line on one of the characters
// i = randomintrange(0,players.size);
// players[i] playsound ("plr_" + i + "_vox_start" + "_" + randomintrange(0, variation_count));

}

//
// Let's the players know that you need power to open these
play_door_dialog()
{
level endon( "electricity_on" );
self endon ("warning_dialog");
timer = 0;

while(1)
{
wait(0.05);
players = get_players();
for(i = 0; i < players.size; i++)
{
dist = distancesquared(players[i].origin, self.origin );
if(dist > 70*70)
{
timer =0;
continue;
}
while(dist < 70*70 && timer < 3)
{
wait(0.5);
timer++;
}
if(dist > 70*70 && timer >= 3)
{
self playsound("door_deny");
players[i] thread do_player_vo("vox_start", 5);
wait(3);
self notify ("warning_dialog");
//iprintlnbold("warning_given");
}
}
}
}

wait_until_first_player()
{
players = get_players();
if( !IsDefined( players[0] ) )
{
level waittill( "first_player_ready" );
}
}
chalk_one_up()
{

if(!IsDefined(level.doground_nomusic))
{
level.doground_nomusic = 0;
}
if( level.first_round )
{
intro = true;
//Play the intro sound at the beginning of the round
//level thread play_intro_VO(); (commented out for Corky)

}
else
{
intro = false;
}

round = undefined;
if( intro )
{
round = create_simple_hud();
round.alignX = "center";
round.alignY = "bottom";
round.horzAlign = "center";
round.vertAlign = "bottom";
round.fontscale = 16;
round.color = ( 1, 1, 1 );
round.x = 0;
round.y [code]
Last Edit: August 31, 2012, 07:25:48 pm by jzob123
broken avatar :(
×
broken avatar :(
[UGX] Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 8 days ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
you still have no end_game function.....
Last Edit: August 31, 2012, 07:35:53 pm by SajeOne
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 5 August 2012
Last active: 1543 days ago
Posts
304
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
im aggressive
×
jzob1234's Groups
jzob1234's Contact & Social Linksjzobjzob123
you still have no end_game function.....
zm is down for me so can you post the function plz?
broken avatar :(
×
broken avatar :(
[UGX] Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 8 days ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
zm is down for me so can you post the function plz?
sending you a pm
Last Edit: August 31, 2012, 08:14:28 pm by SajeOne
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 5 August 2012
Last active: 1543 days ago
Posts
304
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
im aggressive
×
jzob1234's Groups
jzob1234's Contact & Social Linksjzobjzob123
hopefully you havent done any massive changes to your _zombiemode.gsc(keep a backup of the version you have). replace ALL the code in your _zombiemode.gsc in mod/maps with:
#include maps\_anim; 
#include maps\_utility;
#include common_scripts\utility;
#include maps\_music;
#include maps\_zombiemode_utility;
#include maps\_busing;

#using_animtree( "generic_human" );

main(init_zombie_spawner_name)
{
precache_shaders();
precache_models();

PrecacheItem( "fraggrenade" );
PrecacheItem( "colt" );

init_strings();
init_levelvars();
init_animscripts();
init_sounds();
init_shellshocks();
init_flags();

//Limit zombie to 24 max, must have for network purposes
SetAILimit( 24 );
// the initial spawners
if( !IsDefined( init_zombie_spawner_name) )
{
level.enemy_spawns = getEntArray( "zombie_spawner_init", "targetname" );
}
else
{
level.enemy_spawns = getEntArray( init_zombie_spawner_name, "targetname" );
}

level.zombie_rise_spawners = [];

//maps\_destructible_type94truck::init();

level.custom_introscreen = ::zombie_intro_screen;
level.custom_intermission = ::player_intermission;
level.reset_clientdvars = ::onPlayerConnect_clientDvars;

init_fx();


// load map defaults
maps\_load::main();

level.hudelem_count = 0;
// Call the other zombiemode scripts
if( level.script == "nazi_zombie_sumpf" )
{
maps\_zombiemode_weapons_sumpf::init();
}
else
{
maps\_zombiemode_weapons::init();
}
maps\_zombiemode_blockers_new::init();
maps\_zombiemode_spawner::init();
maps\_zombiemode_powerups::init();
maps\_zombiemode_radio::init();
maps\_zombiemode_perks::init();
maps\_zombiemode_tesla::init();
maps\_zombiemode_dogs::init();
maps\_zombiemode_bowie::bowie_init();
maps\_zombiemode_cymbal_monkey::init();
maps\_zombiemode_betty::init();
maps\_zombiemode_timer::init();
maps\_zombiemode_auto_turret::init();

/#
maps\_zombiemode_devgui::init();
#/

init_utility();

// register a client system...
maps\_utility::registerClientSys("zombify");

// level thread coop_player_spawn_placement();

// zombie ai and anim inits
init_anims();

if( isDefined( level.custom_ai_type ) )
{
for( i = 0; i < level.custom_ai_type.size; i++ )
{
[[ level.custom_ai_type[i] ]]();
}
}


// Sets up function pointers for animscripts to refer to
level.playerlaststand_func = ::player_laststand;
// level.global_kill_func = maps\_zombiemode_spawner::zombie_death;
level.global_damage_func = maps\_zombiemode_spawner::zombie_damage;
level.global_damage_func_ads = maps\_zombiemode_spawner::zombie_damage_ads;
level.overridePlayerKilled = ::player_killed_override;
level.overridePlayerDamage = ::player_damage_override;

level.melee_miss_func = maps\_zombiemode::zombiemode_melee_miss;

if( !IsDefined( level.Player_Spawn_func ) )
{
level.Player_Spawn_func = ::coop_player_spawn_placement;
}

level thread [[level.Player_Spawn_func]]();
// used to a check in last stand for players to become zombies
level.is_zombie_level = true;
level.player_becomes_zombie = ::zombify_player;

// so we dont get the uber colt when we're knocked out
level.laststandpistol = "colt";

level.round_start_time = 0;

level thread onPlayerConnect();

init_dvars();
initZombieLeaderboardData();


flag_wait( "all_players_connected" );

bbPrint( "sessions: mapname %s gametype zom isserver 1", level.script );



//thread zombie_difficulty_ramp_up();

// Start the Zombie MODE!
level thread end_game();
level thread round_start();
level thread players_playing();
if ( IsDefined( level.crawlers_enabled ) && level.crawlers_enabled == 1 )
{
level thread crawler_round_tracker();
}

//chrisp - adding spawning vo
level thread spawn_vo();

//add ammo tracker for VO
level thread track_players_ammo_count();

//level thread prevent_near_origin();

DisableGrenadeSuicide();

level.startInvulnerableTime = GetDvarInt( "player_deathInvulnerableTime" );

// Do a SaveGame, so we can restart properly when we die
SaveGame( "zombie_start", &"AUTOSAVE_LEVELSTART", "", true );

// TESTING
// wait( 3 );
// level thread intermission();
// thread testing_spawner_bug();

if(!IsDefined(level.eggs) )
{
level.eggs = 0;
}
}

zombiemode_melee_miss()
{
if( isDefined( self.enemy.curr_pay_turret ) )
{
self.enemy DoDamage( (60 / GetDvarFloat("player_damageMultiplier")), self.origin, self, self );
}
}

/*------------------------------------
chrisp - adding vo to track players ammo
------------------------------------*/
track_players_ammo_count()
{
self endon("disconnect");
self endon("death");
if(!IsDefined (level.player_ammo_low))
{
level.player_ammo_low = 0;
}
if(!IsDefined(level.player_ammo_out))
{
level.player_ammo_out = 0;
}
while(1)
{
players = get_players();
for(i=0;i<players.size;i++)
{

weap = players[i] getcurrentweapon();
//iprintln("current weapon: " + weap);
//iprintlnbold(weap);
//Excludes all Perk based 'weapons' so that you don't get low ammo spam.
if(!isDefined(weap) || weap == "none" || weap == "zombie_perk_bottle_doubletap" || weap == "zombie_perk_bottle_jugg" || weap == "zombie_perk_bottle_revive" || weap == "zombie_perk_bottle_sleight" || weap == "mine_bouncing_betty" || weap == "syrette" || weap == "zombie_knuckle_crack" || weap == "zombie_bowie_flourish" )
{
continue;
}
//iprintln("checking ammo for " + weap);
if ( players[i] GetAmmoCount( weap ) > 5)
{
continue;
}
if ( players[i] maps\_laststand::player_is_in_laststand() )
{
continue;
}
else if (players[i] GetAmmoCount( weap ) < 5 && players[i] GetAmmoCount( weap ) > 0)
{
if (level.player_ammo_low == 0)
{
level.player_ammo_low = 1;
players[i] thread add_low_ammo_dialog();
players[i] thread ammo_dialog_timer();
level waittill("send_dialog_reminder");
level.player_ammo_low = 0;
}

}
else if (players[i] GetAmmoCount( weap ) == 0)
{
if(!isDefined(weap) || weap == "none")
{
continue;
}
level.player_ammo_out = 1;
players[i] thread add_no_ammo_dialog( weap );
//put in this wait to keep the game from spamming about being low on ammo.
wait(20);
level.player_ammo_out = 0;
}
else
{
continue;
}
}
wait(.5);
}
}
ammo_dialog_timer()
{
level endon ("ammo_out");
while(1)
{
wait(20);
level notify ("send_dialog_reminder");

}

}
add_low_ammo_dialog()
{
index = maps\_zombiemode_weapons::get_player_index(self);
player_index = "plr_" + index + "_";
if(!IsDefined (self.vox_ammo_low))
{
num_variants = maps\_zombiemode_spawner::get_number_variants(player_index + "vox_ammo_low");
self.vox_ammo_low = [];
for(i=0;i<num_variants;i++)
{
self.vox_ammo_low[self.vox_ammo_low.size] = "vox_ammo_low_" + i;
}
self.vox_ammo_low_available = self.vox_ammo_low;
}
sound_to_play = random(self.vox_ammo_low_available);

self.vox_ammo_low_available = array_remove(self.vox_ammo_low_available,sound_to_play);

if (self.vox_ammo_low_available.size < 1 )
{
self.vox_ammo_low_available = self.vox_ammo_low;
}

self maps\_zombiemode_spawner::do_player_playdialog(player_index, sound_to_play, 0.25);



}
add_no_ammo_dialog( weap )
{
self endon( "disconnect" );

// Let's pause here a couple of seconds to see if we're really out of ammo.
// If you take a weapon, there's a second or two where your current weapon
// will be set to no ammo while you switch to the new one.
wait(2);

curr_weap = self getcurrentweapon();
if ( !IsDefined(curr_weap) || curr_weap != weap || self GetAmmoCount( curr_weap ) != 0 )
{
// False alarm
return;
}


index = maps\_zombiemode_weapons::get_player_index(self);
player_index = "plr_" + index + "_";
if(!IsDefined (self.vox_ammo_out))
{
num_variants = maps\_zombiemode_spawner::get_number_variants(player_index + "vox_ammo_out");
self.vox_ammo_out = [];
for(i=0;i<num_variants;i++)
{
self.vox_ammo_out[self.vox_ammo_out.size] = "vox_ammo_out_" + i;
}
self.vox_ammo_out_available = self.vox_ammo_out;
}
sound_to_play = random(self.vox_ammo_out_available);

self.vox_ammo_out_available = array_remove(self.vox_ammo_out_available,sound_to_play);

if (self.vox_ammo_out_available.size < 1 )
{
self.vox_ammo_out_available = self.vox_ammo_out;
}

self maps\_zombiemode_spawner::do_player_playdialog(player_index, sound_to_play, 0.25);



}
/*------------------------------------
audio plays when more than 1 player connects
------------------------------------*/
spawn_vo()
{
//not sure if we need this
wait(1);

players = getplayers();

//just pick a random player for now and play some vo
if(players.size > 1)
{
player = random(players);
index = maps\_zombiemode_weapons::get_player_index(player);
player thread spawn_vo_player(index,players.size);
}

}

spawn_vo_player(index,num)
{
sound = "plr_" + index + "_vox_" + num +"play";
self playsound(sound, "sound_done");
self waittill("sound_done");
}

testing_spawner_bug()
{
wait( 0.1 );
level.round_number = 7;

spawners = [];
spawners[0] = GetEnt( "testy", "targetname" );
while( 1 )
{
wait( 1 );
level.enemy_spawns = spawners;
}
}

precache_shaders()
{
PrecacheShader( "hud_chalk_1" );
PrecacheShader( "hud_chalk_2" );
PrecacheShader( "hud_chalk_3" );
PrecacheShader( "hud_chalk_4" );
PrecacheShader( "hud_chalk_5" );
}

precache_models()
{
precachemodel( "char_ger_honorgd_zomb_behead" );
precachemodel( "char_ger_zombieeye" );
PrecacheModel( "tag_origin" );
}

init_shellshocks()
{
level.player_killed_shellshock = "zombie_death";
PrecacheShellshock( level.player_killed_shellshock );
}

init_strings()
{
PrecacheString( &"ZOMBIE_WEAPONCOSTAMMO" );
PrecacheString( &"ZOMBIE_ROUND" );
PrecacheString( &"SCRIPT_PLUS" );
PrecacheString( &"ZOMBIE_GAME_OVER" );
PrecacheString( &"ZOMBIE_SURVIVED_ROUND" );
PrecacheString( &"ZOMBIE_SURVIVED_ROUNDS" );

add_zombie_hint( "undefined", &"ZOMBIE_UNDEFINED" );

// Random Treasure Chest
add_zombie_hint( "default_treasure_chest_950", &"ZOMBIE_RANDOM_WEAPON_950" );

// Barrier Pieces
add_zombie_hint( "default_buy_barrier_piece_10", &"ZOMBIE_BUTTON_BUY_BACK_BARRIER_10" );
add_zombie_hint( "default_buy_barrier_piece_20", &"ZOMBIE_BUTTON_BUY_BACK_BARRIER_20" );
add_zombie_hint( "default_buy_barrier_piece_50", &"ZOMBIE_BUTTON_BUY_BACK_BARRIER_50" );
add_zombie_hint( "default_buy_barrier_piece_100", &"ZOMBIE_BUTTON_BUY_BACK_BARRIER_100" );

// REWARD Barrier Pieces
add_zombie_hint( "default_reward_barrier_piece", &"ZOMBIE_BUTTON_REWARD_BARRIER" );
add_zombie_hint( "default_reward_barrier_piece_10", &"ZOMBIE_BUTTON_REWARD_BARRIER_10" );
add_zombie_hint( "default_reward_barrier_piece_20", &"ZOMBIE_BUTTON_REWARD_BARRIER_20" );
add_zombie_hint( "default_reward_barrier_piece_30", &"ZOMBIE_BUTTON_REWARD_BARRIER_30" );
add_zombie_hint( "default_reward_barrier_piece_40", &"ZOMBIE_BUTTON_REWARD_BARRIER_40" );
add_zombie_hint( "default_reward_barrier_piece_50", &"ZOMBIE_BUTTON_REWARD_BARRIER_50" );

// Debris
add_zombie_hint( "default_buy_debris_100", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_100" );
add_zombie_hint( "default_buy_debris_200", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_200" );
add_zombie_hint( "default_buy_debris_250", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_250" );
add_zombie_hint( "default_buy_debris_500", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_500" );
add_zombie_hint( "default_buy_debris_750", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_750" );
add_zombie_hint( "default_buy_debris_1000", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_1000" );
add_zombie_hint( "default_buy_debris_1250", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_1250" );
add_zombie_hint( "default_buy_debris_1500", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_1500" );
add_zombie_hint( "default_buy_debris_1750", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_1750" );
add_zombie_hint( "default_buy_debris_2000", &"ZOMBIE_BUTTON_BUY_CLEAR_DEBRIS_2000" );

// Doors
add_zombie_hint( "default_buy_door_100", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_100" );
add_zombie_hint( "default_buy_door_200", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_200" );
add_zombie_hint( "default_buy_door_250", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_250" );
add_zombie_hint( "default_buy_door_500", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_500" );
add_zombie_hint( "default_buy_door_750", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_750" );
add_zombie_hint( "default_buy_door_1000", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_1000" );
add_zombie_hint( "default_buy_door_1250", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_1250" );
add_zombie_hint( "default_buy_door_1500", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_1500" );
add_zombie_hint( "default_buy_door_1750", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_1750" );
add_zombie_hint( "default_buy_door_2000", &"ZOMBIE_BUTTON_BUY_OPEN_DOOR_2000" );

// Areas
add_zombie_hint( "default_buy_area_100", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_100" );
add_zombie_hint( "default_buy_area_200", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_200" );
add_zombie_hint( "default_buy_area_250", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_250" );
add_zombie_hint( "default_buy_area_500", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_500" );
add_zombie_hint( "default_buy_area_750", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_750" );
add_zombie_hint( "default_buy_area_1000", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_1000" );
add_zombie_hint( "default_buy_area_1250", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_1250" );
add_zombie_hint( "default_buy_area_1500", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_1500" );
add_zombie_hint( "default_buy_area_1750", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_1750" );
add_zombie_hint( "default_buy_area_2000", &"ZOMBIE_BUTTON_BUY_OPEN_AREA_2000" );
}

init_sounds()
{
add_sound( "end_of_round", "round_over" );
add_sound( "end_of_game", "mx_game_over" ); //Had to remove this and add a music state switch so that we can add other musical elements.
add_sound( "chalk_one_up", "chalk" );
add_sound( "purchase", "cha_ching" );
add_sound( "no_purchase", "no_cha_ching" );

// Zombification
// TODO need to vary these up
add_sound( "playerzombie_usebutton_sound", "attack_vocals" );
add_sound( "playerzombie_attackbutton_sound", "attack_vocals" );
add_sound( "playerzombie_adsbutton_sound", "attack_vocals" );

// Head gib
add_sound( "zombie_head_gib", "zombie_head_gib" );

// Blockers
add_sound( "rebuild_barrier_piece", "repair_boards" );
add_sound( "rebuild_barrier_hover", "boards_float" );
add_sound( "debris_hover_loop", "couch_loop" );
add_sound( "break_barrier_piece", "break_boards" );
add_sound("blocker_end_move", "board_slam");
add_sound( "barrier_rebuild_slam", "board_slam" );

// Doors
add_sound( "door_slide_open", "door_slide_open" );
add_sound( "door_rotate_open", "door_slide_open" );

// Debris
add_sound( "debris_move", "weap_wall" );

// Random Weapon Chest
add_sound( "open_chest", "lid_open" );
add_sound( "music_chest", "music_box" );
add_sound( "close_chest", "lid_close" );

// Weapons on walls
add_sound( "weapon_show", "weap_wall" );

}

init_levelvars()
{
level.intermission = false;
level.dog_intermission = false;
level.zombie_total = 0;
level.no_laststandmissionfail = true;

level.zombie_vars = [];

// Default to not zombify the player till further support
set_zombie_var( "zombify_player", false );

set_zombie_var( "below_world_check", -1000 );

// Respawn in the spectators in between rounds
set_zombie_var( "spectators_respawn", true );

// Round
set_zombie_var( "zombie_use_failsafe", true );
set_zombie_var( "zombie_round_time", 30 );
set_zombie_var( "zombie_between_round_time", 10 );
set_zombie_var( "zombie_intermission_time", 15 );

// Spawning
set_zombie_var( "zombie_spawn_delay", 2 );



// AI
set_zombie_var( "zombie_health_increase", 100 );
set_zombie_var( "zombie_health_increase_percent", 10, 100 );
set_zombie_var( "zombie_health_start", 150 );
set_zombie_var( "zombie_max_ai", 24 );
set_zombie_var( "zombie_ai_per_player", 6 );

// Scoring
set_zombie_var( "zombie_score_start", 420 );
/#
if( GetDvarInt( "zombie_cheat" ) >= 1 )
{
set_zombie_var( "zombie_score_start", 100000 );
}
#/
set_zombie_var( "zombie_score_kill", 50 );
set_zombie_var( "zombie_score_damage", 5 );
set_zombie_var( "zombie_score_bonus_melee", 80 );
set_zombie_var( "zombie_score_bonus_head", 50 );
set_zombie_var( "zombie_score_bonus_neck", 20 );
set_zombie_var( "zombie_score_bonus_torso", 10 );
set_zombie_var( "zombie_score_bonus_burn", 10 );

set_zombie_var( "penalty_no_revive_percent", 10, 100 );
set_zombie_var( "penalty_died_percent", 0, 100 );
set_zombie_var( "penalty_downed_percent", 5, 100 );

set_zombie_var( "zombie_flame_dmg_point_delay", 500 );

if ( IsSplitScreen() )
{
set_zombie_var( "zombie_timer_offset", 280 ); // hud offsets
}
}

init_dvars()
{
level.zombiemode = true;

//coder mod: tkeegan - new code dvar
setSavedDvar( "zombiemode", "1" );
SetDvar( "ui_gametype", "zom" );
setSavedDvar( "fire_world_damage", "0" );
setSavedDvar( "fire_world_damage_rate", "0" );
setSavedDvar( "fire_world_damage_duration", "0" );

if( GetDvar( "zombie_debug" ) == "" )
{
SetDvar( "zombie_debug", "0" );
}

if( GetDvar( "zombie_cheat" ) == "" )
{
SetDvar( "zombie_cheat", "0" );
}

if(getdvar("magic_chest_movable") == "")
{
SetDvar( "magic_chest_movable", "1" );
}

if(getdvar("magic_box_explore_only") == "")
{
SetDvar( "magic_box_explore_only", "1" );
}

SetDvar( "revive_trigger_radius", "60" );
}

initZombieLeaderboardData()
{
// Initializing Leaderboard Stat Variables
level.zombieLeaderboardStatVariable["nazi_zombie_prototype"]["highestwave"] = "nz_prototype_highestwave";
level.zombieLeaderboardStatVariable["nazi_zombie_prototype"]["timeinwave"] = "nz_prototype_timeinwave";
level.zombieLeaderboardStatVariable["nazi_zombie_prototype"]["totalpoints"] = "nz_prototype_totalpoints";

level.zombieLeaderboardStatVariable["nazi_zombie_asylum"]["highestwave"] = "nz_asylum_highestwave";
level.zombieLeaderboardStatVariable["nazi_zombie_asylum"]["timeinwave"] = "nz_asylum_timeinwave";
level.zombieLeaderboardStatVariable["nazi_zombie_asylum"]["totalpoints"] = "nz_asylum_totalpoints";

level.zombieLeaderboardStatVariable["nazi_zombie_sumpf"]["highestwave"] = "nz_sumpf_highestwave";
level.zombieLeaderboardStatVariable["nazi_zombie_sumpf"]["timeinwave"] = "nz_sumpf_timeinwave";
level.zombieLeaderboardStatVariable["nazi_zombie_sumpf"]["totalpoints"] = "nz_sumpf_totalpoints";

level.zombieLeaderboardStatVariable["nazi_zombie_factory"]["highestwave"] = "nz_factory_highestwave";
level.zombieLeaderboardStatVariable["nazi_zombie_factory"]["timeinwave"] = "nz_factory_timeinwave";
level.zombieLeaderboardStatVariable["nazi_zombie_factory"]["totalpoints"] = "nz_factory_totalpoints";

// Initializing Leaderboard Number
level.zombieLeaderboardNumber["nazi_zombie_prototype"]["waves"] = 13;
level.zombieLeaderboardNumber["nazi_zombie_prototype"]["points"] = 14;

level.zombieLeaderboardNumber["nazi_zombie_asylum"]["waves"] = 15;
level.zombieLeaderboardNumber["nazi_zombie_asylum"]["points"] = 16;

level.zombieLeaderboardNumber["nazi_zombie_sumpf"]["waves"] = 17;
level.zombieLeaderboardNumber["nazi_zombie_sumpf"]["points"] = 18;

level.zombieLeaderboardNumber["nazi_zombie_factory"]["waves"] = 19;
level.zombieLeaderboardNumber["nazi_zombie_factory"]["points"] = 20;
}


init_flags()
{
flag_init("spawn_point_override");
flag_init("electricity_on");
flag_init("crawler_round");
}


init_fx()
{
level._effect["wood_chunk_destory"] = loadfx( "impacts/large_woodhit" );

level._effect["edge_fog"] = LoadFx( "env/smoke/fx_fog_zombie_amb" );
level._effect["chest_light"] = LoadFx( "env/light/fx_ray_sun_sm_short" );

level._effect["eye_glow"] = LoadFx( "misc/fx_zombie_eye_single" );

level._effect["zombie_grain"] = LoadFx( "misc/fx_zombie_grain_cloud" );

level._effect["headshot"] = LoadFX( "impacts/flesh_hit_head_fatal_lg_exit" );
level._effect["headshot_nochunks"] = LoadFX( "misc/fx_zombie_bloodsplat" );
level._effect["bloodspurt"] = LoadFX( "misc/fx_zombie_bloodspurt" );
level._effect["tesla_head_light"] = Loadfx( "maps/zombie/fx_zombie_tesla_neck_spurt");

level._effect["rise_burst_water"] = LoadFx("maps/zombie/fx_zombie_body_wtr_burst");
level._effect["rise_billow_water"] = LoadFx("maps/zombie/fx_zombie_body_wtr_billowing");
level._effect["rise_dust_water"] = LoadFx("maps/zombie/fx_zombie_body_wtr_falling");

level._effect["rise_burst"] = LoadFx("maps/mp_maps/fx_mp_zombie_hand_dirt_burst");
level._effect["rise_billow"] = LoadFx("maps/mp_maps/fx_mp_zombie_body_dirt_billowing");
level._effect["rise_dust"] = LoadFx("maps/mp_maps/fx_mp_zombie_body_dust_falling");

// Flamethrower
level._effect["character_fire_pain_sm"]              = loadfx( "env/fire/fx_fire_player_sm_1sec" );
level._effect["character_fire_death_sm"]              = loadfx( "env/fire/fx_fire_player_md" );
level._effect["character_fire_death_torso"] = loadfx( "env/fire/fx_fire_player_torso" );
}

// zombie specific anims

init_standard_zombie_anims()
{
// deaths
level.scr_anim["zombie"]["death1"] = %ai_zombie_death_v1;
level.scr_anim["zombie"]["death2"] = %ai_zombie_death_v2;
level.scr_anim["zombie"]["death3"] = %ai_zombie_crawl_death_v1;
level.scr_anim["zombie"]["death4"] = %ai_zombie_crawl_death_v2;

// run cycles

level.scr_anim["zombie"]["walk1"] = %ai_zombie_walk_v1;
level.scr_anim["zombie"]["walk2"] = %ai_zombie_walk_v2;
level.scr_anim["zombie"]["walk3"] = %ai_zombie_walk_v3;
level.scr_anim["zombie"]["walk4"] = %ai_zombie_walk_v4;

level.scr_anim["zombie"]["run1"] = %ai_zombie_walk_fast_v1;
level.scr_anim["zombie"]["run2"] = %ai_zombie_walk_fast_v2;
level.scr_anim["zombie"]["run3"] = %ai_zombie_walk_fast_v3;
level.scr_anim["zombie"]["run4"] = %ai_zombie_run_v2;
level.scr_anim["zombie"]["run5"] = %ai_zombie_run_v4;
level.scr_anim["zombie"]["run6"] = %ai_zombie_run_v3;
//level.scr_anim["zombie"]["run4"] = %ai_zombie_run_v1;
//level.scr_anim["zombie"]["run6"] = %ai_zombie_run_v4;

level.scr_anim["zombie"]["sprint1"] = %ai_zombie_sprint_v1;
level.scr_anim["zombie"]["sprint2"] = %ai_zombie_sprint_v2;
level.scr_anim["zombie"]["sprint3"] = %ai_zombie_sprint_v1;
level.scr_anim["zombie"]["sprint4"] = %ai_zombie_sprint_v2;
//level.scr_anim["zombie"]["sprint3"] = %ai_zombie_sprint_v3;
//level.scr_anim["zombie"]["sprint3"] = %ai_zombie_sprint_v4;
//level.scr_anim["zombie"]["sprint4"] = %ai_zombie_sprint_v5;

// run cycles in prone
level.scr_anim["zombie"]["crawl1"] = %ai_zombie_crawl;
level.scr_anim["zombie"]["crawl2"] = %ai_zombie_crawl_v1;
level.scr_anim["zombie"]["crawl3"] = %ai_zombie_crawl_v2;
level.scr_anim["zombie"]["crawl4"] = %ai_zombie_crawl_v3;
level.scr_anim["zombie"]["crawl5"] = %ai_zombie_crawl_v4;
level.scr_anim["zombie"]["crawl6"] = %ai_zombie_crawl_v5;
level.scr_anim["zombie"]["crawl_hand_1"] = %ai_zombie_walk_on_hands_a;
level.scr_anim["zombie"]["crawl_hand_2"] = %ai_zombie_walk_on_hands_b;




level.scr_anim["zombie"]["crawl_sprint1"] = %ai_zombie_crawl_sprint;
level.scr_anim["zombie"]["crawl_sprint2"] = %ai_zombie_crawl_sprint_1;
level.scr_anim["zombie"]["crawl_sprint3"] = %ai_zombie_crawl_sprint_2;

if( !isDefined( level._zombie_melee ) )
{
level._zombie_melee = [];
}
if( !isDefined( level._zombie_walk_melee ) )
{
level._zombie_walk_melee = [];
}
if( !isDefined( level._zombie_run_melee ) )
{
level._zombie_run_melee = [];
}

level._zombie_melee["zombie"] = [];
level._zombie_walk_melee["zombie"] = [];
level._zombie_run_melee["zombie"] = [];

level._zombie_melee["zombie"][0] = %ai_zombie_attack_forward_v1;
level._zombie_melee["zombie"][1] = %ai_zombie_attack_forward_v2;
level._zombie_melee["zombie"][2] = %ai_zombie_attack_v1;
level._zombie_melee["zombie"][3] = %ai_zombie_attack_v2;
level._zombie_melee["zombie"][4] = %ai_zombie_attack_v1;
level._zombie_melee["zombie"][5] = %ai_zombie_attack_v4;
level._zombie_melee["zombie"][6] = %ai_zombie_attack_v6;
level._zombie_run_melee["zombie"][0] = %ai_zombie_run_attack_v1;
level._zombie_run_melee["zombie"][1] = %ai_zombie_run_attack_v2;
level._zombie_run_melee["zombie"][2] = %ai_zombie_run_attack_v3;
level.scr_anim["zombie"]["walk5"] = %ai_zombie_walk_v6;
level.scr_anim["zombie"]["walk6"] = %ai_zombie_walk_v7;
level.scr_anim["zombie"]["walk7"] = %ai_zombie_walk_v8;
level.scr_anim["zombie"]["walk8"] = %ai_zombie_walk_v9;

if( isDefined( level.zombie_anim_override ) )
{
[[ level.zombie_anim_override ]]();
}

level._zombie_walk_melee["zombie"][0] = %ai_zombie_walk_attack_v1;
level._zombie_walk_melee["zombie"][1] = %ai_zombie_walk_attack_v2;
level._zombie_walk_melee["zombie"][2] = %ai_zombie_walk_attack_v3;
level._zombie_walk_melee["zombie"][3] = %ai_zombie_walk_attack_v4;

// melee in crawl
if( !isDefined( level._zombie_melee_crawl ) )
{
level._zombie_melee_crawl = [];
}
level._zombie_melee_crawl["zombie"] = [];
level._zombie_melee_crawl["zombie"][0] = %ai_zombie_attack_crawl;
level._zombie_melee_crawl["zombie"][1] = %ai_zombie_attack_crawl_lunge;

if( !isDefined( level._zombie_stumpy_melee ) )
{
level._zombie_stumpy_melee = [];
}
level._zombie_stumpy_melee["zombie"] = [];
level._zombie_stumpy_melee["zombie"][0] = %ai_zombie_walk_on_hands_shot_a;
level._zombie_stumpy_melee["zombie"][1] = %ai_zombie_walk_on_hands_shot_b;
//level._zombie_melee_crawl["zombie"][2] = %ai_zombie_crawl_attack_A;

// tesla deaths
if( !isDefined( level._zombie_tesla_death ) )
{
level._zombie_tesla_death = [];
}
level._zombie_tesla_death["zombie"] = [];
level._zombie_tesla_death["zombie"][0] = %ai_zombie_tesla_death_a;
level._zombie_tesla_death["zombie"][1] = %ai_zombie_tesla_death_b;
level._zombie_tesla_death["zombie"][2] = %ai_zombie_tesla_death_c;
level._zombie_tesla_death["zombie"][3] = %ai_zombie_tesla_death_d;
level._zombie_tesla_death["zombie"][4] = %ai_zombie_tesla_death_e;

if( !isDefined( level._zombie_tesla_crawl_death ) )
{
level._zombie_tesla_crawl_death = [];
}
level._zombie_tesla_crawl_death["zombie"] = [];
level._zombie_tesla_crawl_death["zombie"][0] = %ai_zombie_tesla_crawl_death_a;
level._zombie_tesla_crawl_death["zombie"][1] = %ai_zombie_tesla_crawl_death_b;

// deaths
if( !isDefined( level._zombie_deaths ) )
{
level._zombie_deaths = [];
}
level._zombie_deaths["zombie"] = [];
level._zombie_deaths["zombie"][0] = %ch_dazed_a_death;
level._zombie_deaths["zombie"][1] = %ch_dazed_b_death;
level._zombie_deaths["zombie"][2] = %ch_dazed_c_death;
level._zombie_deaths["zombie"][3] = %ch_dazed_d_death;

/*
ground crawl
*/

if( !isDefined( level._zombie_rise_anims ) )
{
level._zombie_rise_anims = [];
}

// set up the arrays
level._zombie_rise_anims["zombie"] = [];

//level._zombie_rise_anims["zombie"][1]["walk"][0] = %ai_zombie_traverse_ground_v1_crawl;
level._zombie_rise_anims["zombie"][1]["walk"][0] = %ai_zombie_traverse_ground_v1_walk;

//level._zombie_rise_anims["zombie"][1]["run"][0] = %ai_zombie_traverse_ground_v1_crawlfast;
level._zombie_rise_anims["zombie"][1]["run"][0] = %ai_zombie_traverse_ground_v1_run;

level._zombie_rise_anims["zombie"][1]["sprint"][0] = %ai_zombie_traverse_ground_climbout_fast;

//level._zombie_rise_anims["zombie"][2]["walk"][0] = %ai_zombie_traverse_ground_v2_walk; //!broken
level._zombie_rise_anims["zombie"][2]["walk"][0] = %ai_zombie_traverse_ground_v2_walk_altA;
//level._zombie_rise_anims["zombie"][2]["walk"][2] = %ai_zombie_traverse_ground_v2_walk_altB;//!broken

// ground crawl death
if( !isDefined( level._zombie_rise_death_anims ) )
{
level._zombie_rise_death_anims = [];
}

level._zombie_rise_death_anims["zombie"] = [];

level._zombie_rise_death_anims["zombie"][1]["in"][0] = %ai_zombie_traverse_ground_v1_deathinside;
level._zombie_rise_death_anims["zombie"][1]["in"][1] = %ai_zombie_traverse_ground_v1_deathinside_alt;

level._zombie_rise_death_anims["zombie"][1]["out"][0] = %ai_zombie_traverse_ground_v1_deathoutside;
level._zombie_rise_death_anims["zombie"][1]["out"][1] = %ai_zombie_traverse_ground_v1_deathoutside_alt;

level._zombie_rise_death_anims["zombie"][2]["in"][0] = %ai_zombie_traverse_ground_v2_death_low;
level._zombie_rise_death_anims["zombie"][2]["in"][1] = %ai_zombie_traverse_ground_v2_death_low_alt;

level._zombie_rise_death_anims["zombie"][2]["out"][0] = %ai_zombie_traverse_ground_v2_death_high;
level._zombie_rise_death_anims["zombie"][2]["out"][1] = %ai_zombie_traverse_ground_v2_death_high_alt;

//taunts
if( !isDefined( level._zombie_run_taunt ) )
{
level._zombie_run_taunt = [];
}
if( !isDefined( level._zombie_board_taunt ) )
{
level._zombie_board_taunt = [];
}
level._zombie_run_taunt["zombie"] = [];
level._zombie_board_taunt["zombie"] = [];

//level._zombie_taunt["zombie"][0] = %ai_zombie_taunts_1;
//level._zombie_taunt["zombie"][1] = %ai_zombie_taunts_4;
//level._zombie_taunt["zombie"][2] = %ai_zombie_taunts_5b;
//level._zombie_taunt["zombie"][3] = %ai_zombie_taunts_5c;
//level._zombie_taunt["zombie"][4] = %ai_zombie_taunts_5d;
//level._zombie_taunt["zombie"][5] = %ai_zombie_taunts_5e;
//level._zombie_taunt["zombie"][6] = %ai_zombie_taunts_5f;
//level._zombie_taunt["zombie"][7] = %ai_zombie_taunts_7;
//level._zombie_taunt["zombie"][8] = %ai_zombie_taunts_9;
//level._zombie_taunt["zombie"][8] = %ai_zombie_taunts_11;
//level._zombie_taunt["zombie"][8] = %ai_zombie_taunts_12;

level._zombie_board_taunt["zombie"][0] = %ai_zombie_taunts_4;
level._zombie_board_taunt["zombie"][1] = %ai_zombie_taunts_7;
level._zombie_board_taunt["zombie"][2] = %ai_zombie_taunts_9;
level._zombie_board_taunt["zombie"][3] = %ai_zombie_taunts_5b;
level._zombie_board_taunt["zombie"][4] = %ai_zombie_taunts_5c;
level._zombie_board_taunt["zombie"][5] = %ai_zombie_taunts_5d;
level._zombie_board_taunt["zombie"][6] = %ai_zombie_taunts_5e;
level._zombie_board_taunt["zombie"][7] = %ai_zombie_taunts_5f;
}

init_anims()
{
init_standard_zombie_anims();
}

// Initialize any animscript related variables
init_animscripts()
{
// Setup the animscripts, then override them (we call this just incase an AI has not yet spawned)
animscripts\init::firstInit();

anim.idleAnimArray ["stand"] = [];
anim.idleAnimWeights ["stand"] = [];
anim.idleAnimArray ["stand"][0][0] = %ai_zombie_idle_v1_delta;
anim.idleAnimWeights ["stand"][0][0] = 10;

anim.idleAnimArray ["crouch"] = [];
anim.idleAnimWeights ["crouch"] = [];
anim.idleAnimArray ["crouch"][0][0] = %ai_zombie_idle_crawl_delta;
anim.idleAnimWeights ["crouch"][0][0] = 10;
}

// Handles the intro screen
zombie_intro_screen( string1, string2, string3, string4, string5 )
{
flag_wait( "all_players_connected" );

wait( 1 );

//TUEY Set music state to Splash Screencompass
setmusicstate( "SPLASH_SCREEN" );
wait (0.2);
//TUEY Set music state to WAVE_1
// setmusicstate("WAVE_1");
}

players_playing()
{
// initialize level.players_playing
players = get_players();
level.players_playing = players.size;

wait( 20 );

players = get_players();
level.players_playing = players.size;
}

//
// NETWORK SECTION ====================================================================== //
//

watchGrenadeThrow()
{
self endon( "disconnect" );
self endon( "death" );

while(1)
{
self waittill("grenade_fire", grenade);

if(isdefined(grenade))
{
if(self maps\_laststand::player_is_in_laststand())
{
grenade delete();
}
}
}
}

onPlayerConnect()
{
for( ;; )
{
level waittill( "connecting", player );

player.entity_num = player GetEntityNumber();
player thread onPlayerSpawned();
player thread onPlayerDisconnect();
player thread player_revive_monitor();

//player thread watchGrenadeThrow();

player.score = level.zombie_vars["zombie_score_start"];
player.score_total = player.score;
player.old_score = player.score;

player.is_zombie = false;
player.initialized = false;
player.zombification_time = 0;
}
}

onPlayerConnect_clientDvars()
{
self SetClientDvars( "cg_deadChatWithDead", "1",
"cg_deadChatWithTeam", "1",
"cg_deadHearTeamLiving", "1",
"cg_deadHearAllLiving", "1",
"cg_everyoneHearsEveryone", "1",
"compass", "0",
"hud_showStance", "0",
"cg_thirdPerson", "0",
"cg_fov", "65",
"cg_thirdPersonAngle", "0",
"ammoCounterHide", "0",
"miniscoreboardhide", "0",
"ui_hud_hardcore", "0" );

self SetDepthOfField( 0, 0, 512, 4000, 4, 0 );
}

onPlayerDisconnect()
{
self waittill( "disconnect" );
self remove_from_spectate_list();
}

onPlayerSpawned()
{
self endon( "disconnect" );

for( ;; )
{
self waittill( "spawned_player" );



self SetClientDvars( "cg_thirdPerson", "0",
"cg_fov", "65",
"cg_thirdPersonAngle", "0" );

self SetDepthOfField( 0, 0, 512, 4000, 4, 0 );

self add_to_spectate_list();

if( isdefined( self.initialized ) )
{
if( self.initialized == false )
{
self.initialized = true;
// self maps\_zombiemode_score::create_player_score_hud();

// set the initial score on the hud
self maps\_zombiemode_score::set_player_score_hud( true );
self thread player_zombie_breadcrumb();

//Init stat tracking variables
self.stats["kills"] = 0;
self.stats["score"] = 0;
self.stats["downs"] = 0;
self.stats["revives"] = 0;
self.stats["perks"] = 0;
self.stats["headshots"] = 0;
self.stats["zombie_gibs"] = 0;
}
}
}
}


//
// Keep track of players going down and getting revived
player_revive_monitor()
{
self endon( "disconnect" );

while (1)
{
self waittill( "player_revived", reviver );

if ( IsDefined(reviver) )
{
// Check to see how much money you lost from being down.
points = self.score_lost_when_downed;
if ( points > 300 )
{
points = 300;
}
reviver maps\_zombiemode_score::add_to_player_score( points );
self.score_lost_when_downed = 0;
}
}
}


player_laststand()
{
self maps\_zombiemode_score::player_downed_penalty();

if( IsDefined( self.intermission ) && self.intermission )
{
maps\_challenges_coop::doMissionCallback( "playerDied", self );

level waittill( "forever" );
}
}

spawnSpectator()
{
self endon( "disconnect" );
self endon( "spawned_spectator" );
self notify( "spawned" );
self notify( "end_respawn" );

if( level.intermission )
{
return;
}

if( IsDefined( level.no_spectator ) && level.no_spectator )
{
wait( 3 );
ExitLevel();
}

// The check_for_level_end looks for this
self.is_zombie = true;

// Remove all reviving abilities
self notify ( "zombified" );

if( IsDefined( self.revivetrigger ) )
{
self.revivetrigger delete();
self.revivetrigger = undefined;
}

self.zombification_time = getTime(); //set time when player died

resetTimeout();

// Stop shellshock and rumble
self StopShellshock();
self StopRumble( "damage_heavy" );

self.sessionstate = "spectator";
self.spectatorclient = -1;

self remove_from_spectate_list();

self.maxhealth = self.health;
self.shellshocked = false;
self.inWater = false;
self.friendlydamage = undefined;
self.hasSpawned = true;
self.spawnTime = getTime();
self.afk = false;

println( "*************************Zombie Spectator***" );
self detachAll();

self setSpectatePermissions( true );
self thread spectator_thread();

self Spawn( self.origin, self.angles );
self notify( "spawned_spectator" );
}

setSpectatePermissions( isOn )
{
self AllowSpectateTeam( "allies", isOn );
self AllowSpectateTeam( "axis", false );
self AllowSpectateTeam( "freelook", false );
self AllowSpectateTeam( "none", false );
}

spectator_thread()
{
self endon( "disconnect" );
self endon( "spawned_player" );

if( IsSplitScreen() )
{
last_alive = undefined;
players = get_players();

for( i = 0; i < players.size; i++ )
{
if( !players[i].is_zombie )
{
last_alive = players[i];
}
}

share_screen( last_alive, true );

return;
}

self thread spectator_toggle_3rd_person();
}

spectator_toggle_3rd_person()
{
self endon( "disconnect" );
self endon( "spawned_player" );

third_person = true;
self set_third_person( true );
// self NotifyOnCommand( "toggle_3rd_person", "weapnext" );

// while( 1 )
// {
// self waittill( "toggle_3rd_person" );
//
// if( third_person )
// {
// third_person = false;
// self set_third_person( false );
// wait( 0.5 );
// }
// else
// {
// third_person = true;
// self set_third_person( true );
// wait( 0.5 );
// }
// }
}


set_third_person( value )
{
if( value )
{
self SetClientDvars( "cg_thirdPerson", "1",
"cg_fov", "40",
"cg_thirdPersonAngle", "354" );

self setDepthOfField( 0, 128, 512, 4000, 6, 1.8 );
}
else
{
self SetClientDvars( "cg_thirdPerson", "0",
"cg_fov", "65",
"cg_thirdPersonAngle", "0" );

self setDepthOfField( 0, 0, 512, 4000, 4, 0 );
}
}

spectators_respawn()
{
level endon( "between_round_over" );

if( !IsDefined( level.zombie_vars["spectators_respawn"] ) || !level.zombie_vars["spectators_respawn"] )
{
return;
}

if( !IsDefined( level.custom_spawnPlayer ) )
{
// Custom spawn call for when they respawn from spectator
level.custom_spawnPlayer = ::spectator_respawn;
}

while( 1 )
{
players = get_players();
for( i = 0; i < players.size; i++ )
{
if( players[i].sessionstate == "spectator" )
{
players[i] [[level.spawnPlayer]]();
if( isDefined( players[i].has_altmelee ) && players[i].has_altmelee )
{
players[i] SetPerk( "specialty_altmelee" );
}
if (isDefined(level.script) && level.round_number > 6 && players[i].score < 1500)
{
players[i].old_score = players[i].score;
players[i].score = 1500;
players[i] maps\_zombiemode_score::set_player_score_hud();
}
}
}

wait( 1 );
}
}

spectator_respawn()
{
println( "*************************Respawn Spectator***" );
assert( IsDefined( self.spectator_respawn ) );

origin = self.spectator_respawn.origin;
angles = self.spectator_respawn.angles;

self setSpectatePermissions( false );

new_origin = undefined;


new_origin = check_for_valid_spawn_near_team( self );


if( IsDefined( new_origin ) )
{
self Spawn( new_origin, angles );
}
else
{
self Spawn( origin, angles );
}


if( IsSplitScreen() )
{
last_alive = undefined;
players = get_players();

for( i = 0; i < players.size; i++ )
{
if( !players[i].is_zombie )
{
last_alive = players[i];
}
}

share_screen( last_alive, false );
}

self.has_betties = undefined;
self.is_burning = undefined;

// The check_for_level_end looks for this
self.is_zombie = false;
self.ignoreme = false;

setClientSysState("lsm", "0", self); // Notify client last stand ended.
self RevivePlayer();

self notify( "spawned_player" );

// Penalize the player when we respawn, since he 'died'
self maps\_zombiemode_score::player_reduce_points( "died" );

self thread player_zombie_breadcrumb();

return true;
}

check_for_valid_spawn_near_team( revivee )
{

players = get_players();
spawn_points = getstructarray("player_respawn_point", "targetname");

if( spawn_points.size == 0 )
return undefined;

for( i = 0; i < players.size; i++ )
{
if( is_player_valid( players[i] ) )
{
for( j = 0 ; j < spawn_points.size; j++ )
{
if( DistanceSquared( players[i].origin, spawn_points[j].origin ) < ( 1000 * 1000 ) && spawn_points[j].locked == false )
{
spawn_array = getstructarray( spawn_points[j].target, "targetname" );

for( k = 0; k < spawn_array.size; k++ )
{
if( spawn_array[k].script_int == (revivee.entity_num + 1) )
{
return spawn_array[k].origin;
}
}

return spawn_array[0].origin;
}

}

}

}

return undefined;

}


get_players_on_team(exclude)
{

teammates = [];

players = get_players();
for(i=0;i<players.size;i++)
{
//check to see if other players on your team are alive and not waiting to be revived
if(players[i].spawn_side == self.spawn_side && !isDefined(players[i].revivetrigger) && players[i] != exclude )
{
teammates[teammates.size] = players[i];
}
}

return teammates;
}



get_safe_breadcrumb_pos( player )
{
players = get_players();
valid_players = [];

min_dist = 150 * 150;
for( i = 0; i < players.size; i++ )
{
if( !is_player_valid( players[i] ) )
{
continue;
}

valid_players[valid_players.size] = players[i];
}

for( i = 0; i < valid_players.size; i++ )
{
count = 0;
for( q = 1; q < player.zombie_breadcrumbs.size; q++ )
{
if( DistanceSquared( player.zombie_breadcrumbs[q], valid_players[i].origin ) < min_dist )
{
continue;
}

count++;
if( count == valid_players.size )
{
return player.zombie_breadcrumbs[q];
}
}
}

return undefined;
}

round_spawning()
{
level endon( "intermission" );
/#
level endon( "kill_round" );
#/

if( level.intermission )
{
return;
}

if( level.enemy_spawns.size < 1 )
{
ASSERTMSG( "No spawners with targetname zombie_spawner in map." );
return;
}

/#
if ( GetDVarInt( "zombie_cheat" ) == 2 || GetDVarInt( "zombie_cheat" ) >= 4 )
{
return;
}
#/

ai_calculate_health();

count = 0;

//CODER MOD: TOMMY K
players = get_players();
for( i = 0; i < players.size; i++ )
{
players[i].zombification_time = 0;
}

max = level.zombie_vars["zombie_max_ai"];

multiplier = level.round_number / 5;
if( multiplier < 1 )
{
multiplier = 1;
}

// After round 10, exponentially have more AI attack the player
if( level.round_number >= 10 )
{
multiplier *= level.round_number * 0.15;
}

player_num = get_players().size;

if( player_num == 1 )
{
max += int( ( 0.5 * level.zombie_vars["zombie_ai_per_player"] ) * multiplier );
}
else
{
max += int( ( ( player_num - 1 ) * level.zombie_vars["zombie_ai_per_player"] ) * multiplier );
}



if(level.round_number < 3 && level.script == "nazi_zombie_asylum")
{
if(get_players().size > 1)
{

max = get_players().size * 3 + level.round_number;

}
else
{

max = 6;

}
}
else if ( level.first_round )
{
max = int( max * 0.2 );
}
else if (level.round_number < 3)
{
max = int( max * 0.4 );
}
else if (level.round_number < 4)
{
max = int( max * 0.6 );
}
else if (level.round_number < 5)
{
max = int( max * 0.8 );
}


level.zombie_total = max;
mixed_spawns = 0; // Number of mixed spawns this round.  Currently means number of dogs in a mixed round

// DEBUG HACK:
//max = 1;
old_spawn = undefined;
while( count < max )
{

spawn_point = level.enemy_spawns[RandomInt( level.enemy_spawns.size )];

if( !IsDefined( old_spawn ) )
{
old_spawn = spawn_point;
}
else if( Spawn_point == old_spawn )
{
spawn_point = level.enemy_spawns[RandomInt( level.enemy_spawns.size )];
}
old_spawn = spawn_point;

// iPrintLn(spawn_point.targetname + " " + level.zombie_vars["zombie_spawn_delay"]);
while( get_enemy_count() > 31 )
{
wait( 0.05 );
}

// MM Mix in dog spawns...
if ( IsDefined( level.mixed_rounds_enabled ) && level.mixed_rounds_enabled == 1 )
{
spawn_dog = false;
if ( level.round_number > 30 )
{
if ( RandomInt(100) < 3 )
{
spawn_dog = true;
}
}
else if ( level.round_number > 25 && mixed_spawns < 3 )
{
if ( RandomInt(100) < 2 )
{
spawn_dog = true;
}
}
else if ( level.round_number > 20 && mixed_spawns < 2 )
{
if ( RandomInt(100) < 2 )
{
spawn_dog = true;
}
}
else if ( level.round_number > 15 && mixed_spawns < 1 )
{
if ( RandomInt(100) < 1 )
{
spawn_dog = true;
}
}

if ( spawn_dog )
{
keys = GetArrayKeys( level.zones );
for ( i=0; i<keys.size; i++ )
{
if ( level.zones[ keys[i] ].is_occupied )
{
akeys = GetArrayKeys( level.zones[ keys[i] ].adjacent_zones );
for ( k=0; k<akeys.size; k++ )
{
if ( level.zones[ akeys[k] ].is_active &&
!level.zones[ akeys[k] ].is_occupied &&
level.zones[ akeys[k] ].dog_locations.size > 0 )
{
maps\_zombiemode_dogs::special_dog_spawn( undefined, 1 );
level.zombie_total--;
wait_network_frame();
}
}
}
}
}
}

ai = spawn_zombie( spawn_point );
if( IsDefined( ai ) )
{
level.zombie_total--;
ai thread round_spawn_failsafe();
count++;
}
wait( level.zombie_vars["zombie_spawn_delay"] );
wait_network_frame();
}

if( level.round_number > 3 )
{
zombies = getaiarray( "axis" );
while( zombies.size > 0 )
{
if( zombies.size == 1 && zombies[0].has_legs == true )
{
var = randomintrange(1, 4);
zombies[0] set_run_anim( "sprint" + var );                       
zombies[0].run_combatanim = level.scr_anim[zombies[0].animname]["sprint" + var];
}
wait(0.5);
zombies = getaiarray("axis");
}

}

}

// TESTING: spawn one zombie at a time
round_spawning_test()
{
while (true)
{
spawn_point = level.enemy_spawns[RandomInt( level.enemy_spawns.size )]; // grab a random spawner

ai = spawn_zombie( spawn_point );
ai waittill("death");

wait 5;
}
}
/////////////////////////////////////////////////////////

round_text( text )
{
if( level.first_round )
{
intro = true;
}
else
{
intro = false;
}

hud = create_simple_hud();
hud.horzAlign = "center";
hud.vertAlign = "middle";
hud.alignX = "center";
hud.alignY = "middle";
hud.y = -100;
hud.foreground = 1;
hud.fontscale = 16.0;
hud.alpha = 0;
hud.color = ( 1, 1, 1 );

hud SetText( text );
hud FadeOverTime( 1.5 );
hud.alpha = 1;
wait( 1.5 );

if( intro )
{
wait( 1 );
level notify( "intro_change_color" );
}

hud FadeOverTime( 3 );
//hud.color = ( 0.8, 0, 0 );
hud.color = ( 0.423, 0.004, 0 );
wait( 3 );

if( intro )
{
level waittill( "intro_hud_done" );
}

hud FadeOverTime( 1.5 );
hud.alpha = 0;
wait( 1.5 );
hud destroy();
}

round_start()
{
level.zombie_health = level.zombie_vars["zombie_health_start"];
level.round_number = 1;
level.first_round = true;

// so players get init'ed with grenades
players = get_players();
for (i = 0; i < players.size; i++)
{
players[i] giveweapon( "stielhandgranate" );
players[i] setweaponammoclip( "stielhandgranate", 0);
}

level.chalk_hud1 = create_chalk_hud();
level.chalk_hud2 = create_chalk_hud( 64 );

// level waittill( "introscreen_done" );

level.round_spawn_func = ::round_spawning;

/#
if (GetDVarInt("zombie_rise_test"))
{
level.round_spawn_func = ::round_spawning_test; // FOR TESTING, one zombie at a time, no round advancement
}
#/

level thread round_think();
}


create_chalk_hud( x )
{
if( !IsDefined( x ) )
{
x = 0;
}

hud = create_simple_hud();
hud.alignX = "left";
hud.alignY = "bottom";
hud.horzAlign = "left";
hud.vertAlign = "bottom";
hud.color = ( 0.423, 0.004, 0 );
hud.x = x;
hud.alpha = 0;

hud SetShader( "hud_chalk_1", 64, 64 );

return hud;
}
play_intro_VO()
{

wait(3);
players = getplayers();
for(i=0;i<players.size;i++)
{
index = maps\_zombiemode_weapons::get_player_index(players[i]);
player_index = "plr_" + index + "_";
sound_to_play = "vox_name_int_0";
players[i] maps\_zombiemode_spawner::do_player_playdialog(player_index, sound_to_play, 0.05);
wait(0.7);
}

//Plays a random start line on one of the characters
// i = randomintrange(0,players.size);
// players[i] playsound ("plr_" + i + "_vox_start" + "_" + randomintrange(0, variation_count));

}

//
// Let's the players know that you need power to open these
play_door_dialog()
{
level endon( "electricity_on" );
self endon ("warning_dialog");
timer = 0;

while(1)
{
wait(0.05);
players = get_players();
for(i = 0; i < players.size; i++)
{
dist = distancesquared(players[i].origin, self.origin );
if(dist > 70*70)
{
timer =0;
continue;
}
while(dist < 70*70 && timer < 3)
{
wait(0.5);
timer++;
}
if(dist > 70*70 && timer >= 3)
{
self playsound("door_deny");
players[i] thread do_player_vo("vox_start", 5);
wait(3);
self notify ("warning_dialog");
//iprintlnbold("warning_given");
}
}
}
}

wait_until_first_player()
{
players = get_players();
if( !IsDefined( players[0] ) )
{
level waittill( "first_player_ready" );
}
}
chalk_one_up()
{

if(!IsDefined(level.doground_nomusic))
{
level.doground_nomusic = 0;
}
if( level.first_round )
{
intro = true;
//Play the intro sound at the beginning of the round
//level thread play_intro_VO(); (commented out for Corky)

}
else
{
intro = false;
}

round = undefined;
if( intro )

still does not work  :poker: [You are not allowed to view external links. Register or Login to see them]
Last Edit: August 31, 2012, 08:17:56 pm by jzob123
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 5 August 2012
Last active: 1543 days ago
Posts
304
Respect
Forum Rank
Perk Hacker
Primary Group
Member
My Contact & Social Links
More
Personal Quote
im aggressive
×
jzob1234's Groups
jzob1234's Contact & Social Linksjzobjzob123
[You are not allowed to view external links. Register or Login to see them] still nothing
broken avatar :(
×
broken avatar :(
[UGX] Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 8 days ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
[You are not allowed to view external links. Register or Login to see them] still nothing
in your mapname.gsc where it says
 trig = GetEnt("end_game", "targetname");
cut and paste it before the line
user = undefined;
in the function end_game()

 

Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Twitch
Loading ...