• Whats wrong with this?
    3 replies, posted
So recently I've been trying to implement a smoke grenade explosion sound. I added this to weapon_ttt_smokegrenade.lua function explosionsound() local weedsound = Sound("sound/weed/smokeweedeverday.wav") sound.Play(weedsound, self:GetPos() ) end Sorry if I sound stupid. I'm still trying to get used to lua.
What errors are you getting? Also try these things: 1) I don't think self will work unless you have ENT:, or SWEP, infront of the function name. 2) Make sure your calling this function within the explosion function of the grenade 3) try changing [lua] local weedsound = Sound("sound/weed/smokeweedeverday.wav") [/lua] to: [lua] local weedsound = "weed/smokeweedeverday.wav" [/lua] 4) You might want to use lua tags when you post code before someone jumps down your throat about it.
Remove the sound/ part. It's already relative to the sound folder.
[QUOTE=bran92don;48153862]What errors are you getting? Also try these things: 1) I don't think self will work unless you have ENT:, or SWEP, infront of the function name. 2) Make sure your calling this function within the explosion function of the grenade[/QUOTE] Thanks for the fast response. I called the function within the explosion function. Now I'm receiving this error in the console. Failed to load sound "weed\smokeweedeverday.wav", file probably missing from disk/repository I think we're on the right track :) [editline]8th July 2015[/editline] [QUOTE=Chessnut;48153886]Remove the sound/ part. It's already relative to the sound folder.[/QUOTE] I just did that Nvm I fixed it thanks to you guys. Thanks for the help!
Sorry, you need to Log In to post a reply to this thread.