// If a skin falls to the ground, does it make a noise? if not CharVoiceLib then rawset(_G, "CharVoiceLib", {}) end local sfxtypetable = { ["attack1"] = sfxinfo[sfx_kattk1], ["attack2"] = sfxinfo[sfx_kattk2], ["boost1"] = sfxinfo[sfx_kbost1], ["boost2"] = sfxinfo[sfx_kbost2], ["hurt1"] = sfxinfo[sfx_khurt1], ["hurt2"] = sfxinfo[sfx_khurt2], ["hititem"] = sfxinfo[sfx_khitem], ["gloat"] = sfxinfo[sfx_kgloat], ["win"] = sfxinfo[sfx_kwin], ["slow"] = sfxinfo[sfx_kslow], ["lose"] = sfxinfo[sfx_klose] } CharVoiceLib.name = "CharVoiceLib" CharVoiceLib.fullname = "Character Voice Library" CharVoiceLib.ver = "RTM/Gold (1.0)" CharVoiceLib.author = "TheOneGoofAli" CharVoiceLib.sfxtypes = sfxtypetable CharVoiceLib.GetSkinSFX = function(skinid, stype) // Get the sound ID of skin sound. if not skinid then error("Invalid skin input.") end if not stype then error("No skin sound type given.") end local ksfx = CharVoiceLib.sfxtypes[stype] if not ksfx then error("No valid skin sound found.") end return skinid.soundsid[ksfx.skinsound] end CharVoiceLib.GetAllSkinSFX = function(skinid) // Get all sound IDs of the skin sounds as table. local skinsfxtable = { ["attack1"] = skinid.soundsid[CharVoiceLib.sfxtypes["attack1"].skinsound], ["attack2"] = skinid.soundsid[CharVoiceLib.sfxtypes["attack2"].skinsound], ["boost1"] = skinid.soundsid[CharVoiceLib.sfxtypes["boost1"].skinsound], ["boost2"] = skinid.soundsid[CharVoiceLib.sfxtypes["boost2"].skinsound], ["hurt1"] = skinid.soundsid[CharVoiceLib.sfxtypes["hurt1"].skinsound], ["hurt2"] = skinid.soundsid[CharVoiceLib.sfxtypes["hurt2"].skinsound], ["hititem"] = skinid.soundsid[CharVoiceLib.sfxtypes["hititem"].skinsound], ["gloat"] = skinid.soundsid[CharVoiceLib.sfxtypes["gloat"].skinsound], ["win"] = skinid.soundsid[CharVoiceLib.sfxtypes["win"].skinsound], ["slow"] = skinid.soundsid[CharVoiceLib.sfxtypes["slow"].skinsound], ["lose"] = skinid.soundsid[CharVoiceLib.sfxtypes["lose"].skinsound] } return skinsfxtable end // K_PlayAttackTaunt... but without restriction to the player's object skin. CharVoiceLib.PlayAttackSound = function(mo, skin) if CV_FindVar("kartvoices").value then S_StartSound(mo, skin.soundsid[((leveltime%2) and sfxinfo[sfx_kattk1] or sfxinfo[sfx_kattk2]).skinsound]) end end // K_PlayBoostTaunt... but without restriction to the player's object skin. CharVoiceLib.PlayBoostSound = function(mo, skin) if CV_FindVar("kartvoices").value then S_StartSound(mo, skin.soundsid[((leveltime%2) and sfxinfo[sfx_kbost1] or sfxinfo[sfx_kbost2]).skinsound]) end end // There's no K_PlayHurtSound... so... CharVoiceLib.PlayHurtSound = function(mo, skin) if CV_FindVar("kartvoices").value then S_StartSound(mo, skin.soundsid[((leveltime%2) and sfxinfo[sfx_khurt1] or sfxinfo[sfx_khurt2]).skinsound]) end end // Or you can just directly play a skin sound on an object... ANY object. // skinid is skins["skinname"] in this instance. CharVoiceLib.PlaySkinSound = function(mo, skinid, stype) if CV_FindVar("kartvoices").value then S_StartSound(mo, CharVoiceLib.GetSkinSFX(skinid, stype)) end end print("\x82"..CharVoiceLib.fullname.." "..CharVoiceLib.ver.."\x80".." by ".."\x87"..CharVoiceLib.author.."\x80")