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

Melee weapons: add proper melee swing sound

This commit is contained in:
Jbleezy
2024-04-14 04:56:53 -07:00
parent 32c4638caa
commit 145ad352cb
13 changed files with 242 additions and 20 deletions

View File

@ -4,6 +4,7 @@
main()
{
replaceFunc(clientscripts\mp\zombies\_zm::init_wallbuy_fx, scripts\zm\replaced\_zm::init_wallbuy_fx);
replaceFunc(clientscripts\mp\zombies\_zm_audio::sndmeleeswipe, scripts\zm\replaced\_zm_audio::sndmeleeswipe);
replaceFunc(clientscripts\mp\zombies\_zm_weapons::init, scripts\zm\replaced\_zm_weapons::init);
powerup_changes();

View File

@ -376,6 +376,7 @@ on_player_connect()
player thread on_player_fake_revive();
player thread grenade_fire_watcher();
player thread sndmeleewpnsound();
}
}
@ -1901,6 +1902,121 @@ temp_disable_offhand_weapons()
}
}
sndmeleewpnsound()
{
self endon("disconnect");
level endon("end_game");
while (1)
{
while (!self ismeleeing())
{
wait 0.05;
}
current_melee_weapon = self get_player_melee_weapon();
current_weapon = self getcurrentweapon();
alias = "zmb_melee_whoosh_npc";
if (is_true(self.is_player_zombie))
{
alias = "zmb_melee_whoosh_zmb_npc";
}
else if (issubstr(current_weapon, "shield_zm"))
{
alias = "fly_riotshield_zm_swing";
}
else if (current_melee_weapon == "bowie_knife_zm")
{
alias = "zmb_bowie_swing";
}
else if (current_melee_weapon == "tazer_knuckles_zm")
{
alias = "wpn_tazer_whoosh_npc";
}
else if (current_melee_weapon == "spoon_zm_alcatraz")
{
alias = "zmb_spoon_swing";
}
else if (current_melee_weapon == "spork_zm_alcatraz")
{
alias = "zmb_spork_swing";
}
else if (current_melee_weapon == "one_inch_punch_zm")
{
alias = "wpn_one_inch_punch_npc";
}
else if (current_melee_weapon == "one_inch_punch_upgraded_zm")
{
alias = "wpn_one_inch_punch_npc";
}
else if (current_melee_weapon == "one_inch_punch_fire_zm")
{
alias = "wpn_one_inch_punch_fire_npc";
}
else if (current_melee_weapon == "one_inch_punch_air_zm")
{
alias = "wpn_one_inch_punch_air_npc";
}
else if (current_melee_weapon == "one_inch_punch_ice_zm")
{
alias = "wpn_one_inch_punch_ice_npc";
}
else if (current_melee_weapon == "one_inch_punch_lightning_zm")
{
alias = "wpn_one_inch_punch_lightning_npc";
}
else if (sndmeleewpn_isstaff(current_melee_weapon))
{
alias = "zmb_melee_staff_upgraded_npc";
}
if (maps\mp\zombies\_zm_audio::sndisnetworksafe())
{
self play_sound_to_nearby_players(alias);
}
while (self ismeleeing())
{
wait 0.05;
}
}
}
play_sound_to_nearby_players(alias, range = 500)
{
players = get_players();
foreach (player in players)
{
if (player != self && distancesquared(player.origin, self.origin) <= range * range)
{
self playsoundtoplayer(alias, player);
}
}
}
sndmeleewpn_isstaff(weapon)
{
switch (weapon)
{
case "staff_melee_zm":
case "staff_air_melee_zm":
case "staff_fire_melee_zm":
case "staff_water_melee_zm":
case "staff_lightning_melee_zm":
isstaff = 1;
break;
default:
isstaff = 0;
}
return isstaff;
}
buildbuildables()
{
wait 1; // need a wait or else some buildables dont build

View File

@ -0,0 +1,112 @@
#include clientscripts\mp\_utility;
#include clientscripts\mp\_ambientpackage;
#include clientscripts\mp\zombies\_zm_utility;
#include clientscripts\mp\_music;
#include clientscripts\mp\_audio;
sndmeleeswipe(localclientnum, notifystring)
{
player = undefined;
while (!isdefined(player))
{
player = getnonpredictedlocalplayer(localclientnum);
wait 0.05;
}
player endon("disconnect");
for (;;)
{
player waittill(notifystring);
currentweapon = getcurrentweapon(localclientnum);
alias = "zmb_melee_whoosh_plr";
if (is_true(player.is_player_zombie))
{
alias = "zmb_melee_whoosh_zmb_plr";
}
else if (issubstr(currentweapon, "shield_zm"))
{
alias = "fly_riotshield_zm_swing";
}
else if (has_weapon_or_held(localclientnum, "bowie_knife_zm"))
{
alias = "zmb_bowie_swing_plr";
}
else if (has_weapon_or_held(localclientnum, "tazer_knuckles_zm"))
{
alias = "wpn_tazer_whoosh_plr";
}
else if (has_weapon_or_held(localclientnum, "spoon_zm_alcatraz"))
{
alias = "zmb_spoon_swing_plr";
}
else if (has_weapon_or_held(localclientnum, "spork_zm_alcatraz"))
{
alias = "zmb_spork_swing_plr";
}
else if (has_weapon_or_held(localclientnum, "one_inch_punch_zm"))
{
alias = "wpn_one_inch_punch_plr";
}
else if (has_weapon_or_held(localclientnum, "one_inch_punch_upgraded_zm"))
{
alias = "wpn_one_inch_punch_plr";
}
else if (has_weapon_or_held(localclientnum, "one_inch_punch_air_zm"))
{
alias = "wpn_one_inch_punch_air_plr";
}
else if (has_weapon_or_held(localclientnum, "one_inch_punch_fire_zm"))
{
alias = "wpn_one_inch_punch_fire_plr";
}
else if (has_weapon_or_held(localclientnum, "one_inch_punch_ice_zm"))
{
alias = "wpn_one_inch_punch_ice_plr";
}
else if (has_weapon_or_held(localclientnum, "one_inch_punch_lightning_zm"))
{
alias = "wpn_one_inch_punch_lightning_plr";
}
else if (has_staff_melee(localclientnum))
{
alias = "zmb_melee_staff_upgraded_plr";
}
playsound(0, alias, player.origin);
}
}
has_weapon_or_held(localclientnum, weapon)
{
return hasweapon(localclientnum, weapon) || hasweapon(localclientnum, "held_" + weapon);
}
has_staff_melee(localclientnum)
{
if (hasweapon(localclientnum, "staff_melee_zm"))
{
return 1;
}
else if (hasweapon(localclientnum, "staff_air_melee_zm"))
{
return 1;
}
else if (hasweapon(localclientnum, "staff_fire_melee_zm"))
{
return 1;
}
else if (hasweapon(localclientnum, "staff_water_melee_zm"))
{
return 1;
}
else if (hasweapon(localclientnum, "staff_lightning_melee_zm"))
{
return 1;
}
return 0;
}

View File

@ -59,25 +59,6 @@
#include maps\mp\zombies\_zm_challenges;
#include maps\mp\zombies\_zm_laststand;
sndmeleewpn_isstaff(weapon)
{
switch (weapon)
{
case "staff_water_melee_zm":
case "staff_melee_zm":
case "staff_lightning_melee_zm":
case "staff_fire_melee_zm":
case "staff_air_melee_zm":
isstaff = 1;
break;
default:
isstaff = 0;
}
return isstaff;
}
tomb_can_track_ammo_custom(weap)
{
if (!isdefined(weap))
@ -128,4 +109,9 @@ tomb_can_track_ammo_custom(weap)
}
return true;
}
sndmeleewpnsound()
{
// removed - added to all maps in _zm_reimagined
}

View File

@ -5,8 +5,8 @@
main()
{
replaceFunc(maps\mp\zm_tomb::sndmeleewpn_isstaff, scripts\zm\replaced\zm_tomb::sndmeleewpn_isstaff);
replaceFunc(maps\mp\zm_tomb::tomb_can_track_ammo_custom, scripts\zm\replaced\zm_tomb::tomb_can_track_ammo_custom);
replaceFunc(maps\mp\zm_tomb::sndmeleewpnsound, scripts\zm\replaced\zm_tomb::sndmeleewpnsound);
replaceFunc(maps\mp\zm_tomb_main_quest::main_quest_init, scripts\zm\replaced\zm_tomb_main_quest::main_quest_init);
replaceFunc(maps\mp\zm_tomb_main_quest::place_staff_in_charger, scripts\zm\replaced\zm_tomb_main_quest::place_staff_in_charger);
replaceFunc(maps\mp\zm_tomb_main_quest::watch_for_player_pickup_staff, scripts\zm\replaced\zm_tomb_main_quest::watch_for_player_pickup_staff);