• Source modelling - Sounds in animations
    2 replies, posted
Hello I just came here for help, it seems nobody else has asked this kind of thing... I'm making an animated model for an npc and to save me having to learn how to add sounds to a custom npc script and to make the model more portable, I would like to know how to make a model play a sound file when it is spawned or when it plays an animation. I know this is possible because valve models do it, am I missing something in the valve development wiki? Could someone please tell me what the .qc string or technique is? Is it an event? Thankyou to anyone who responds...
[code]$sequence reload "Reload" fps 30 activity ACT_VM_RELOAD 1 node Ready { { event AE_CL_PLAYSOUND 28 "Weapon_357.OpenLoader" } { event AE_CL_PLAYSOUND 39 "Weapon_357.RemoveLoader" } { event 3015 55 } { event AE_CL_PLAYSOUND 67 "Weapon_357.ReplaceLoader" } { event AE_CL_PLAYSOUND 92 "Weapon_357.Spin" } } [/code] Just an example taken from the 357 QC. It's just "{ event AE_CL_PLAYSOUND <frame> "Sound_event.generic"}". In order to create your own sound events you'll need to create a .txt file with [code]"Event_name.single" { "channel" "CHAN_VOICE" "volume" "1.0" "CompatibilityAttenuation" "0.64" "pitch" "PITCH_NORM" "wave" "Sound\Path\Sound1.wav" "wave" "Sound\Path\Sound1.wav" "wave" "Sound\Path\Sound1.wav" "wave" "Sound\Path\Sound1.wav" }[/code] I don't understand everything about it but that should cover most of the sounds you'll need. If it's for Gmod and in addon format you'll just need to put that .txt file in with it. If you're making it for a different Source game then you'll need to modify the game_sounds_manifest.txt and add [code] "precache_file" "scripts/folder/npc/whatever.txt"[/code]
Thankyou so much! :D Will this thread help anyone or does the question already exist somewhere on facepunch? [editline]28th April 2011[/editline] Aw I'm having troubles again, I have the sound playing but It's a looping one that I want to play once only when the model is spawned, at the moment it's playing each time the animation begins a loop and it sounds like a storm.
Sorry, you need to Log In to post a reply to this thread.