1
0
mirror of https://github.com/JezuzLizard/BO2-Reimagined.git synced 2025-06-10 15:17:57 -05:00

Ballistic Knife: give max ammo on melee weapon purchase

This commit is contained in:
Jbleezy
2022-01-25 03:55:13 -08:00
parent 486594c6bf
commit e9227323bd
2 changed files with 72 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include scripts/zm/replaced/_zm_equipment;
#include scripts/zm/replaced/_zm_spawner;
#include scripts/zm/replaced/_zm_ai_basic;
#include scripts/zm/replaced/_zm_melee_weapon;
#include scripts/zm/replaced/_zm_weap_ballistic_knife;
#include scripts/zm/replaced/_zm_weap_claymore;
@ -62,6 +63,7 @@ main()
replaceFunc(maps/mp/zombies/_zm_equipment::placed_equipment_think, scripts/zm/replaced/_zm_equipment::placed_equipment_think);
replaceFunc(maps/mp/zombies/_zm_spawner::head_should_gib, scripts/zm/replaced/_zm_spawner::head_should_gib);
replaceFunc(maps/mp/zombies/_zm_ai_basic::inert_wakeup, scripts/zm/replaced/_zm_ai_basic::inert_wakeup);
replaceFunc(maps/mp/zombies/_zm_melee_weapon::change_melee_weapon, scripts/zm/replaced/_zm_melee_weapon::change_melee_weapon);
replaceFunc(maps/mp/zombies/_zm_weap_ballistic_knife::watch_use_trigger, scripts/zm/replaced/_zm_weap_ballistic_knife::watch_use_trigger);
replaceFunc(maps/mp/zombies/_zm_weap_claymore::claymore_detonation, scripts/zm/replaced/_zm_weap_claymore::claymore_detonation);
}

View File

@ -0,0 +1,70 @@
#include maps\mp\_utility;
#include common_scripts\utility;
#include maps\mp\zombies\_zm_utility;
#include maps/mp/zombies/_zm_melee_weapon;
#include maps/mp/zombies/_zm_weapons;
change_melee_weapon( weapon_name, current_weapon )
{
current_melee_weapon = self get_player_melee_weapon();
if ( isDefined( current_melee_weapon ) && current_melee_weapon != weapon_name )
{
self takeweapon( current_melee_weapon );
unacquire_weapon_toggle( current_melee_weapon );
}
self set_player_melee_weapon( weapon_name );
had_ballistic = 0;
had_ballistic_upgraded = 0;
ballistic_was_primary = 0;
old_ballistic = undefined;
ballistic_ammo_clip = 0;
ballistic_ammo_stock = 0;
primaryweapons = self getweaponslistprimaries();
i = 0;
while ( i < primaryweapons.size )
{
primary_weapon = primaryweapons[ i ];
if ( issubstr( primary_weapon, "knife_ballistic_" ) )
{
had_ballistic = 1;
if ( primary_weapon == current_weapon )
{
ballistic_was_primary = 1;
}
old_ballistic = primary_weapon;
ballistic_ammo_clip = self getWeaponAmmoClip( primary_weapon );
ballistic_ammo_stock = self getWeaponAmmoStock( primary_weapon );
self notify( "zmb_lost_knife" );
self takeweapon( primary_weapon );
unacquire_weapon_toggle( primary_weapon );
if ( issubstr( primary_weapon, "upgraded" ) )
{
had_ballistic_upgraded = 1;
}
}
i++;
}
if ( had_ballistic )
{
if ( had_ballistic_upgraded )
{
new_ballistic = level.ballistic_upgraded_weapon_name[ weapon_name ];
if ( ballistic_was_primary )
{
current_weapon = new_ballistic;
}
self giveweapon( new_ballistic, 0, self maps/mp/zombies/_zm_weapons::get_pack_a_punch_weapon_options( new_ballistic ) );
}
else
{
new_ballistic = level.ballistic_weapon_name[ weapon_name ];
if ( ballistic_was_primary )
{
current_weapon = new_ballistic;
}
self giveweapon( new_ballistic, 0 );
}
self giveMaxAmmo( new_ballistic );
}
return current_weapon;
}