• How do I add a custom sound to an addon?
    4 replies, posted
I'm trying to use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/sound/Add]sound.Add[/url] to add a custom sound for a SWEP to use. The problem I'm running into is that I don't know what directory I should start from when telling Garry's Mod where the custom sound is. I did Google it but it kept giving me results for Windows. Example: [code] sound.Add( { name = "Sound name", channel = CHAN_STATIC, volume = 1.0, level = 80, sound = "DIR" < - I don't know where to define this from. } ) [/code] I have a sound/ directory in my addon. I tried using something like sound/sound.wav to register it but it doesn't seem to work that way. Also, where would I use this - client or server side? The client is giving me an error "Failed to load sound "sound\[name of sound file]", file probably missing from disk/repository", so I guess it's not loading it from the server but I wouldn't know how to force the client to download the sound file without uploading it to the Workshop. Thanks for any help.
lets say your sound is addons/cooladdon/sound/meme/coolsound.mp3 you would use this [code]sound.Add({ name = "cool name", channel = CHAN_STATIC, volume = 1, level = 80, sound = "meme/coolsound.mp3" })[/code]
[QUOTE=kaliii;51545709]lets say your sound is addons/cooladdon/sound/meme/coolsound.mp3 you would use this [code]sound.Add({ name = "cool name", channel = CHAN_STATIC, volume = 1, level = 80, sound = "meme/coolsound.mp3" })[/code][/QUOTE] Ah, okay. I'll try that. Do I have to have sub-directories for sounds? Not that it's an issue, just so I know to do it in the future.
Added example file paths to the wiki page [url]http://wiki.garrysmod.com/page/sound/Add[/url]
[QUOTE=Robotboy655;51545736]Added example file paths to the wiki page [url]http://wiki.garrysmod.com/page/sound/Add[/url][/QUOTE] Oh wow, that actually helps a shit ton. Thanks Robot.
Sorry, you need to Log In to post a reply to this thread.