#include maps\mp\_utility; #include common_scripts\utility; #include maps\mp\zombies\_zm_utility; #include maps\mp\zombies\_zm_weapons; weapon_give( weapon, is_upgrade, magic_box, nosound ) { primaryweapons = self getweaponslistprimaries(); current_weapon = self getcurrentweapon(); current_weapon = self maps\mp\zombies\_zm_weapons::switch_from_alt_weapon( current_weapon ); if ( !isDefined( is_upgrade ) ) { is_upgrade = 0; } weapon_limit = get_player_weapon_limit( self ); if ( is_equipment( weapon ) ) { self maps\mp\zombies\_zm_equipment::equipment_give( weapon ); } if ( weapon == "riotshield_zm" ) { if ( isDefined( self.player_shield_reset_health ) ) { self [[ self.player_shield_reset_health ]](); } } if ( self hasweapon( weapon ) ) { if ( issubstr( weapon, "knife_ballistic_" ) ) { self notify( "zmb_lost_knife" ); } self givestartammo( weapon ); if ( !is_offhand_weapon( weapon ) ) { self switchtoweapon( weapon ); } return; } if ( is_melee_weapon( weapon ) ) { current_weapon = maps\mp\zombies\_zm_melee_weapon::change_melee_weapon( weapon, current_weapon ); } else if ( is_lethal_grenade( weapon ) ) { old_lethal = self get_player_lethal_grenade(); if ( isDefined( old_lethal ) && old_lethal != "" ) { self takeweapon( old_lethal ); unacquire_weapon_toggle( old_lethal ); } self set_player_lethal_grenade( weapon ); } else if ( is_tactical_grenade( weapon ) ) { old_tactical = self get_player_tactical_grenade(); if ( isDefined( old_tactical ) && old_tactical != "" ) { self takeweapon( old_tactical ); unacquire_weapon_toggle( old_tactical ); } self set_player_tactical_grenade( weapon ); } else if ( is_placeable_mine( weapon ) ) { old_mine = self get_player_placeable_mine(); if ( isDefined( old_mine ) ) { self takeweapon( old_mine ); unacquire_weapon_toggle( old_mine ); } self set_player_placeable_mine( weapon ); } if ( !is_offhand_weapon( weapon ) ) { self maps\mp\zombies\_zm_weapons::take_fallback_weapon(); } if ( primaryweapons.size >= weapon_limit ) { if ( is_placeable_mine( current_weapon ) || is_equipment( current_weapon ) ) { current_weapon = undefined; } if ( isDefined( current_weapon ) ) { if ( !is_offhand_weapon( weapon ) ) { if ( current_weapon == "tesla_gun_zm" ) { level.player_drops_tesla_gun = 1; } if ( issubstr( current_weapon, "knife_ballistic_" ) ) { self notify( "zmb_lost_knife" ); } self takeweapon( current_weapon ); unacquire_weapon_toggle( current_weapon ); } } } if ( isDefined( level.zombiemode_offhand_weapon_give_override ) ) { if ( self [[ level.zombiemode_offhand_weapon_give_override ]]( weapon ) ) { return; } } if ( weapon == "cymbal_monkey_zm" ) { self maps\mp\zombies\_zm_weap_cymbal_monkey::player_give_cymbal_monkey(); self play_weapon_vo( weapon, magic_box ); return; } else if ( issubstr( weapon, "knife_ballistic_" ) ) { weapon = self maps\mp\zombies\_zm_melee_weapon::give_ballistic_knife( weapon, issubstr( weapon, "upgraded" ) ); } else if ( weapon == "claymore_zm" ) { self thread maps\mp\zombies\_zm_weap_claymore::claymore_setup(); self play_weapon_vo( weapon, magic_box ); return; } if ( isDefined( level.zombie_weapons_callbacks ) && isDefined( level.zombie_weapons_callbacks[ weapon ] ) ) { self thread [[ level.zombie_weapons_callbacks[ weapon ] ]](); play_weapon_vo( weapon, magic_box ); return; } if ( !is_true( nosound ) ) { self play_sound_on_ent( "purchase" ); } if ( is_true( magic_box ) && is_limited_weapon( weapon ) ) { playsoundatposition( "mus_raygun_stinger", ( 0, 0, 0 ) ); } if ( !is_weapon_upgraded( weapon ) ) { self giveweapon( weapon ); } else { self giveweapon( weapon, 0, self get_pack_a_punch_weapon_options( weapon ) ); } acquire_weapon_toggle( weapon, self ); self givestartammo( weapon ); if ( !is_offhand_weapon( weapon ) ) { if ( !is_melee_weapon( weapon ) ) { self switchtoweapon( weapon ); } else { self switchtoweapon( current_weapon ); } } self play_weapon_vo( weapon, magic_box ); self scripts\zm\_zm_reimagined::change_weapon_ammo(weapon); } ammo_give( weapon ) { give_ammo = 0; if ( !is_offhand_weapon( weapon ) ) { weapon = get_weapon_with_attachments( weapon ); if ( isdefined( weapon ) ) { stockmax = 0; stockmax = weaponstartammo( weapon ); clipcount = self getweaponammoclip( weapon ); currstock = self getammocount( weapon ); if ( currstock - clipcount >= stockmax ) give_ammo = 0; else give_ammo = 1; } } else if ( self has_weapon_or_upgrade( weapon ) ) { if ( self getammocount( weapon ) < weaponmaxammo( weapon ) ) give_ammo = 1; } if ( give_ammo ) { self play_sound_on_ent( "purchase" ); self givemaxammo( weapon ); alt_weap = weaponaltweaponname( weapon ); if ( "none" != alt_weap ) self givemaxammo( alt_weap ); self scripts\zm\_zm_reimagined::change_weapon_ammo(weapon); return true; } if ( !give_ammo ) return false; } lethal_grenade_update_prompt( player ) { weapon = self.stub.zombie_weapon_upgrade; hint = level.zombie_weapons[weapon].hint; cost = level.zombie_weapons[weapon].cost; self.stub.hint_string = hint; self sethintstring( self.stub.hint_string, cost ); self.stub.cursor_hint = "HINT_WEAPON"; self.stub.cursor_hint_weapon = weapon; self setcursorhint( self.stub.cursor_hint, self.stub.cursor_hint_weapon ); return 1; } get_upgraded_ammo_cost( weapon_name ) { if ( isDefined( level.zombie_weapons[ weapon_name ].upgraded_ammo_cost ) ) { return level.zombie_weapons[ weapon_name ].upgraded_ammo_cost; } return 2500; } makegrenadedudanddestroy() { self endon( "death" ); self notify( "grenade_dud" ); self makegrenadedud(); if ( isDefined( self ) ) { self delete(); } } createballisticknifewatcher_zm( name, weapon ) { watcher = self maps\mp\gametypes_zm\_weaponobjects::createuseweaponobjectwatcher( name, weapon, self.team ); watcher.onspawn = scripts\zm\replaced\_zm_weap_ballistic_knife::on_spawn; watcher.onspawnretrievetriggers = maps\mp\zombies\_zm_weap_ballistic_knife::on_spawn_retrieve_trigger; watcher.storedifferentobject = 1; watcher.headicon = 0; }