local JumpSFX = { -- Jump sound table. sfx_s1a0, -- Sonic 1 sfx_s220, -- Sonic 2 sfx_s3k62, -- Sonic 3 & Knucles sfx_cdfm02, -- Sonic CD sfx_ngjump, -- NiGHTS sfx_mario6, -- Super Mario Bros } local SpinSFX = { -- Spin sound table. sfx_s1be, -- Sonic 1 sfx_s23e, -- Sonic 2 sfx_s3k3c, -- Sonic 3 & Knuckles sfx_cdfm12, -- Sonic CD } local SpindashSFX = { -- Spindash sound table. sfx_s260, -- Sonic 2 sfx_s3kab, // to sfx_s3kabf -- Sonic 3 & Knuckles sfx_cdfm11, -- Sonic CD sfx_kc6c, -- Knuckles' Chaotix } local ZoomSFX = { -- Zoom sound table. sfx_s23c, -- Sonic 2 sfx_s3kb6, -- Sonic 3 & Knuckles sfx_cdfm01, -- Sonic CD sfx_kc3c, -- Knuckles' Chaotix } local SkidSFX = { -- Skidding sound table. sfx_cdfm00, -- Sonic CD } local PutPutSFX = { -- Tails flying sound table. sfx_s3kba, -- Sonic 3 & Knuckles } local PudPudSFX = { -- Tails tired flying sound table. sfx_s3kbb, -- Sonic 3 & Knuckles } local DiedSFX = { -- Dying sound table. sfx_s1a3, -- Sonic 1 sfx_s223, -- Sonic 2 sfx_s3k35, -- Sonic 3 & Knuckles sfx_cdfm03, -- Sonic CD sfx_kc58, -- Knuckles' Chaotix } local SpikeSFX = { -- Spiked sound table. sfx_s1a6, -- Sonic 1 sfx_s226, -- Sonic 2 sfx_s3k37, -- Sonic 3 & Knuckles } local DrownSFX = { -- Drowning sound table. sfx_s1b2, -- Sonic 1 sfx_s232, -- Sonic 2 sfx_s3k3b, -- Sonic 3 & Knuckles sfx_cdfm38, -- Sonic CD } local DrownSound = CV_RegisterVar{ name = "sounds_drown", flags = CV_CALL|CV_NOINIT, PossibleValue = {Default=0, Sonic1=1, Sonic2=2, S3K=3, SonicCD=4}, defaultvalue = "Default", func = function(sound) local sound = sound.value if (sound == 0) then -- Tell the player we've set this back to normal. print("No longer using a personalized drowning sound.") elseif (sound > 0 and sound <= 4) then -- However, if set, tell the player WHAT sound they're using. S_StartSound(nil, DrownSFX[sound], nil) if (sound == 1) then print("Using drowning sound!") elseif (sound == 2) then print("Using drowning sound!") elseif (sound == 3) then print("Using drowning sound!") elseif (sound == 4) then print("Using drowning sound!") end end end, } local SpikeSound = CV_RegisterVar{ name = "sounds_spiked", flags = CV_CALL|CV_NOINIT, PossibleValue = {Default=0, Sonic1=1, Sonic2=2, S3K=3}, defaultvalue = "Default", func = function(sound) local sound = sound.value if (sound == 0) then -- Tell the player we've set this back to normal. print("No longer using a personalized spiked death sound.") elseif (sound > 0 and sound <= 3) then -- However, if set, tell the player WHAT sound they're using. S_StartSound(nil, SpikeSFX[sound], nil) if (sound == 1) then print("Using spiked sound!") elseif (sound == 2) then print("Using spiked sound!") elseif (sound == 3) then print("Using spiked sound!") end end end, } local DiedSound = CV_RegisterVar{ name = "sounds_death", flags = CV_CALL|CV_NOINIT, PossibleValue = {Default=0, Sonic1=1, Sonic2=2, S3K=3, SonicCD=4, Chaotix=5}, defaultvalue = "Default", func = function(sound) local sound = sound.value if (sound == 0) then -- Tell the player we've set this back to normal. print("No longer using a personalized death sound.") elseif (sound > 0 and sound <= 5) then -- However, if set, tell the player WHAT sound they're using. S_StartSound(nil, DiedSFX[sound], nil) if (sound == 1) then print("Using death sound!") elseif (sound == 2) then print("Using death sound!") elseif (sound == 3) then print("Using death sound!") elseif (sound == 4) then print("Using death sound!") elseif (sound == 5) then print("Using death sound!") end end end, } local TailsTiredFlySound = CV_RegisterVar{ name = "sounds_tailstiredfly", flags = CV_CALL|CV_NOINIT, PossibleValue = {Default=0, S3K=1}, defaultvalue = "Default", func = function(sound) local sound = sound.value if (sound == 0) then -- Tell the player we've set this back to normal. print("No longer using a personalized Tails' tired flight sound.") elseif (sound == 1) then S_StartSound(nil, PudPudSFX[sound], nil) print("Using Tails' tired flight sound!") end end, } local TailsFlySound = CV_RegisterVar{ name = "sounds_tailsfly", flags = CV_CALL|CV_NOINIT, PossibleValue = {Default=0, S3K=1}, defaultvalue = "Default", func = function(sound) local sound = sound.value if (sound == 0) then -- Tell the player we've set this back to normal. print("No longer using a personalized Tails' flight sound.") elseif (sound == 1) then S_StartSound(nil, PutPutSFX[sound], nil) print("Using Tails' flight sound!") end end, } local SkidSound = CV_RegisterVar{ name = "sounds_skid", flags = CV_CALL|CV_NOINIT, PossibleValue = {Default=0, SonicCD=1}, defaultvalue = "Default", func = function(sound) local sound = sound.value if (sound == 0) then -- Tell the player we've set this back to normal. print("No longer using a personalized skidding sound.") elseif (sound == 1) then -- However, if set, tell the player WHAT sound they're using. S_StartSound(nil, SkidSFX[sound], nil) print("Using skidding sound!") end end, } local ZoomSound = CV_RegisterVar{ name = "sounds_spindashzoom", flags = CV_CALL|CV_NOINIT, PossibleValue = {Default=0, Sonic2=1, S3K=2, SonicCD=3, Chaotix=4}, defaultvalue = "Default", func = function(sound) local sound = sound.value if (sound == 0) then -- Tell the player we've set this back to normal. print("No longer using a personalized spindash release sound.") elseif (sound > 0 and sound <= 4) then -- However, if set, tell the player WHAT sound they're using. S_StartSound(nil, ZoomSFX[sound], nil) if (sound == 1) then print("Using spindash release sound!") elseif (sound == 2) then print("Using spindash release sound!") elseif (sound == 3) then print("Using spindash release sound!") elseif (sound == 4) then print("Using spindash release sound!") end end end, } local SpindashSound = CV_RegisterVar{ name = "sounds_spindash", flags = CV_CALL|CV_NOINIT, PossibleValue = {Default=0, Sonic2=1, S3K=2, SonicCD=3, Chaotix=4}, defaultvalue = "Default", func = function(sound) local sound = sound.value if (sound == 0) then -- Tell the player we've set this back to normal. print("No longer using a personalized spindash charging sound.") elseif (sound > 0 and sound <= 4) then -- However, if set, tell the player WHAT sound they're using. S_StartSound(nil, SpindashSFX[sound], nil) if (sound == 1) then print("Using spindash charging sound!") elseif (sound == 2) then print("Using spindash charging sound!") elseif (sound == 3) then print("Using spindash charging sound!") elseif (sound == 4) then print("Using spindash charging sound!") end end end, } local SpinSound = CV_RegisterVar{ name = "sounds_spin", flags = CV_CALL|CV_NOINIT, PossibleValue = {Default=0, Sonic1=1, Sonic2=2, S3K=3, SonicCD=4}, defaultvalue = "Default", func = function(sound) local sound = sound.value if (sound == 0) then -- Tell the player we've set this back to normal. print("No longer using a personalized spinning sound.") elseif (sound > 0 and sound <= 4) then -- However, if set, tell the player WHAT sound they're using. S_StartSound(nil, SpinSFX[sound], nil) if (sound == 1) then print("Using spinning sound!") elseif (sound == 2) then print("Using spinning sound!") elseif (sound == 3) then print("Using spinning sound!") elseif (sound == 4) then print("Using spinning sound!") end end end, } local JumpSound = CV_RegisterVar{ name = "sounds_jump", flags = CV_CALL|CV_NOINIT, PossibleValue = {Default=0, Sonic1=1, Sonic2=2, S3K=3, SonicCD=4, NiGHTS=5, Mario=6}, defaultvalue = "Default", func = function(sound) local sound = sound.value if (sound == 0) then -- Tell the player we've set this back to normal. print("No longer using a personalized jump sound.") elseif (sound > 0 and sound <= 6) then -- However, if set, tell the player WHAT sound they're using. S_StartSound(nil, JumpSFX[sound], nil) if (sound == 1) then print("Using jump sound!") elseif (sound == 2) then print("Using jump sound!") elseif (sound == 3) then print("Using jump sound!") elseif (sound == 4) then print("Using jump sound!") elseif (sound == 5) then print("Using ".."\'".."Hoop!".."\'".." jump sound!") elseif (sound == 6) then print("Using jump sound!") end end end, } local function PersonalizedPlayerSounds(player) -- Depending on console variables, intercept sounds being played by the player, to then play another sound instead. if not (player and player.valid) then return end -- Player must exist. Like, come on! if not (player == consoleplayer) then return end -- We only worry about ourselves! if not (player.realmo and player.realmo.valid) then return end -- Their object ALSO must exist. Where do we play sounds from then?! local JumpCV = JumpSound.value local SpinCV = SpinSound.value local DashCV = SpindashSound.value local ZoomCV = ZoomSound.value local SkidCV = SkidSound.value local DiedCV = DiedSound.value local SpikedCV = SpikeSound.value local DrownCV = DrownSound.value local FlyCV = TailsFlySound.value local FlyTiredCV = TailsTiredFlySound.value if (JumpCV) and S_SoundPlaying(player.realmo, sfx_jump) then -- Play player's choosen jump sound. S_StopSoundByID(player.realmo, sfx_jump) S_StartSound(player.realmo, JumpSFX[JumpCV]) end if (SpinCV) and S_SoundPlaying(player.realmo, sfx_spin) then -- As above, spinning sound though. S_StopSoundByID(player.realmo, sfx_spin) S_StartSound(player.realmo, SpinSFX[SpinCV]) end if (DashCV) and S_SoundPlaying(player.realmo, sfx_spndsh) then -- Whilst charging up the spindash. S_StopSoundByID(player.realmo, sfx_spndsh) S_StartSound(player.realmo, SpindashSFX[DashCV]) end if (ZoomCV) and S_SoundPlaying(player.realmo, sfx_zoom) then -- After releasing the spindash. S_StopSoundByID(player.realmo, sfx_zoom) S_StartSound(player.realmo, ZoomSFX[ZoomCV]) end if (SkidCV) and S_SoundPlaying(player.realmo, sfx_skid) then -- Skiddin' till a dead stop right 'ere. S_StopSoundByID(player.realmo, sfx_skid) S_StartSound(player.realmo, SkidSFX[SkidCV]) end if (FlyCV) and S_SoundPlaying(player.realmo, sfx_putput) then -- Tails' with his flight. S_StopSoundByID(player.realmo, sfx_putput) S_StartSound(player.realmo, PutPutSFX[FlyCV]) end if (FlyTiredCV) and S_SoundPlaying(player.realmo, sfx_pudpud) then -- Tails' but tired after enough flight. S_StopSoundByID(player.realmo, sfx_pudpud) S_StartSound(player.realmo, PudPudSFX[FlyTiredCV]) end if (DiedCV) -- Well alrighty then... guess we're dead, huh. (Death by... a variety of reasons.) and (S_SoundPlaying(player.realmo, sfx_altdi1) -- or S_SoundPlaying(player.realmo, sfx_altdi2) -- This is some variation or S_SoundPlaying(player.realmo, sfx_altdi3) -- if I ever seen it. or S_SoundPlaying(player.realmo, sfx_altdi4)) -- then S_StopSoundByID(player.realmo, sfx_altdi1) S_StopSoundByID(player.realmo, sfx_altdi2) S_StopSoundByID(player.realmo, sfx_altdi3) S_StopSoundByID(player.realmo, sfx_altdi4) S_StartSound(player.realmo, DiedSFX[DiedCV]) end if (DrownCV) and S_SoundPlaying(player.realmo, sfx_drown) then -- No, nonono. NO! NOOOO-- *gluglug glug lugluglug* (Death by drowning.) S_StopSoundByID(player.realmo, sfx_drown) S_StartSound(player.realmo, DrownSFX[DrownCV]) end if (SpikedCV) and S_SoundPlaying(player.realmo, sfx_spkdth) then -- Ow. And I thought wasps were worse... (Death by spikes.) S_StopSoundByID(player.realmo, sfx_spkdth) S_StartSound(player.realmo, SpikeSFX[SpikedCV]) end end addHook("PlayerThink", PersonalizedPlayerSounds) -- Let's-a-do-them! Hook it up, and let it do it's magic.