Custom MDL Weapon Reload Sounds

Got problems with your models? Struggling with textures? Get help with your custom assets.

Custom MDL Weapon Reload Sounds

Postby blackmantis357 on Mon Feb 10, 2014 3:00 pm

Hello to all,

I can't seem to find any mention anywhere of how to set up a weapon with working reload sounds for the Source Engine. Are weapon reload sounds something that is set up in the QC file when compiling (like muzzleflashes etc) or is it hard coded?

Ie I have a pistol I've compiled, I have the sound laid out plain and simply as "pistol_reload.wav", and the weapon_pistol script uses "reload" "Weapon_Pistol.Reload". All other sounds for firing, dry firing, etc work, just not reloading.

Where exactly should I be looking to inject the playing of the reloading sound (or sounds if there is more than one?).
User avatar
blackmantis357
Member
Member
 
Joined: Sat Dec 08, 2012 12:28 pm

Re: Custom MDL Weapon Reload Sounds

Postby ScarT on Mon Feb 10, 2014 11:14 pm

I usually do it in the QC file because it's easy to recompile. Here's how it's done with the v_357.mdl from Half-Life 2.

Code: Select all
$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" }
}


You can find the list of valid animation events, and what they're used for here.
User avatar
ScarT
Senior Member
Senior Member
 
Joined: Sat Apr 02, 2005 7:33 pm
Location: Denmarkian Land

Re: Custom MDL Weapon Reload Sounds

Postby blackmantis357 on Tue Feb 11, 2014 12:59 am

ScarT wrote:I usually do it in the QC file because it's easy to recompile. Here's how it's done with the v_357.mdl from Half-Life 2.

Code: Select all
$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" }
}


You can find the list of valid animation events, and what they're used for here.


Thanks ScarT (Long time no chat by the way!)

So I've read the article, and now have this in my QC file.

Code: Select all
$sequence reload "reload" activity ACT_VM_RELOAD 1 fps 30.00 node 0
{
   { event AE_CL_PLAYSOUND 0 "Weapon_pistol.Reload" }
}


(I've assumed the 0 between PLAYSOUND and "Weapon_pistoletc" is basically a timecode, 0 being plays instantly, and 1 being 1 millisecond or second or something?

But I'm still not getting any reload sound on reloading. I have made anim smd name "Reload", as well as popping a sound in weapons\pistol\pistol_reload.wav to make things simple. I've checked to make sure the sound can be played in the engine (if I rename pistol_reload.wav pistol_fire2.wav, it works fine) What am I doing incorrectly?
User avatar
blackmantis357
Member
Member
 
Joined: Sat Dec 08, 2012 12:28 pm

Re: Custom MDL Weapon Reload Sounds

Postby Dr. Delta on Tue Feb 11, 2014 1:11 am

Don't you need to add those sound files to a sound manifest or something? So WeaponName.Reload refers to a specific audio file? I remember something like this.
User avatar
Dr. Delta
Veteran
Veteran
 
Joined: Thu Dec 27, 2007 1:18 pm
Location: People's Republic of Porygon

Re: Custom MDL Weapon Reload Sounds

Postby blackmantis357 on Tue Feb 11, 2014 1:20 am

Dr. Delta wrote:Don't you need to add those sound files to a sound manifest or something? So WeaponName.Reload refers to a specific audio file? I remember something like this.


Ah of course, game_sounds_weapons.txt! That's helped me out a great deal. I was very curious as to how it knew of which WAV file to play etc.

I've added this:

// weapon_pistol.txt
"Weapon_Pistol.Reload"
{
"channel" "CHAN_ITEM"
"volume" "1.0"
"soundlevel" "SNDLVL_NORM"

"wave" "weapons/pistol/pistol_reload.wav"
}

So far however, still no luck with reloading. All other sounds for the weapon work fine however.
User avatar
blackmantis357
Member
Member
 
Joined: Sat Dec 08, 2012 12:28 pm

Re: Custom MDL Weapon Reload Sounds

Postby ScarT on Tue Feb 11, 2014 1:42 am

blackmantis357 wrote:Thanks ScarT (Long time no chat by the way!)

So I've read the article, and now have this in my QC file.

Code: Select all
$sequence reload "reload" activity ACT_VM_RELOAD 1 fps 30.00 node 0
{
   { event AE_CL_PLAYSOUND 0 "Weapon_pistol.Reload" }
}


(I've assumed the 0 between PLAYSOUND and "Weapon_pistoletc" is basically a timecode, 0 being plays instantly, and 1 being 1 millisecond or second or something?

But I'm still not getting any reload sound on reloading. I have made anim smd name "Reload", as well as popping a sound in weapons\pistol\pistol_reload.wav to make things simple. I've checked to make sure the sound can be played in the engine (if I rename pistol_reload.wav pistol_fire2.wav, it works fine) What am I doing incorrectly?

Yeah, it's been a while since I've heard from you. Didn't you make some nice water effects which you talked to Junk about?

Code: Select all
$sequence reload "reload" activity ACT_VM_RELOAD 1 fps 30.00 node 0
{
   { event AE_CL_PLAYSOUND 0 "Weapon_pistol.Reload" }
}

0 is the frame number (e.g. if your animation is 30 frames long, and you want to play a reload sound at frame 15 you'd put 15 instead of 0. Like this:

Code: Select all
$sequence reload "reload" activity ACT_VM_RELOAD 1 fps 30.00 node 0
{
   { event AE_CL_PLAYSOUND 15 "Weapon_pistol.Reload" }
}
User avatar
ScarT
Senior Member
Senior Member
 
Joined: Sat Apr 02, 2005 7:33 pm
Location: Denmarkian Land

Re: Custom MDL Weapon Reload Sounds

Postby blackmantis357 on Tue Feb 11, 2014 2:34 am

ScarT wrote:
blackmantis357 wrote:Thanks ScarT (Long time no chat by the way!)

So I've read the article, and now have this in my QC file.

Code: Select all
$sequence reload "reload" activity ACT_VM_RELOAD 1 fps 30.00 node 0
{
   { event AE_CL_PLAYSOUND 0 "Weapon_pistol.Reload" }
}


(I've assumed the 0 between PLAYSOUND and "Weapon_pistoletc" is basically a timecode, 0 being plays instantly, and 1 being 1 millisecond or second or something?

But I'm still not getting any reload sound on reloading. I have made anim smd name "Reload", as well as popping a sound in weapons\pistol\pistol_reload.wav to make things simple. I've checked to make sure the sound can be played in the engine (if I rename pistol_reload.wav pistol_fire2.wav, it works fine) What am I doing incorrectly?

Yeah, it's been a while since I've heard from you. Didn't you make some nice water effects which you talked to Junk about?

Code: Select all
$sequence reload "reload" activity ACT_VM_RELOAD 1 fps 30.00 node 0
{
   { event AE_CL_PLAYSOUND 0 "Weapon_pistol.Reload" }
}

0 is the frame number (e.g. if your animation is 30 frames long, and you want to play a reload sound at frame 15 you'd put 15 instead of 0. Like this:

Code: Select all
$sequence reload "reload" activity ACT_VM_RELOAD 1 fps 30.00 node 0
{
   { event AE_CL_PLAYSOUND 15 "Weapon_pistol.Reload" }
}


Yep, that's me. I did tonnes of different water, muzzleflashes, sparks, fire effects. And cheers for the advice, I'll see if this works.
User avatar
blackmantis357
Member
Member
 
Joined: Sat Dec 08, 2012 12:28 pm

Return to Custom Asset Help

Who is online

Users browsing this forum: No registered users