Upvote Upvoted 6 Downvote Downvoted
Can you customize crit sounds per class/weapon?
posted in Customization
1
#1
0 Frags +

Want to understand scripting a bit more and finding out what and what isn't possible. This seemed like an easy to approach area where I could avoid getting confused and focus on learning what limitations there are (plus there's no way you could exploit this to any advantage due to these specific sound files going all garbly when you edit them).

Just for clarities sake as well, I'm not talking about specific weapon firing sounds which I know are unique. For instance rocket_directhit_shoot_crit.wav

What I mean is the crit_hit.wav (1-5) sounds that play when your crit attack lands.

Knowing that there are 5 crit sounds that play at random when you hit an enemy, it's probably possible to customize each of those so you could get something different than normal playing. Or changing them all to the same sound so you would get no variance. Seems like a simple customization, as the same files play no matter what class or weapons you're using.

What I'm interested about however, is whether it's possible to actually fuck around with that. Force certain classes to load different sound files than the others. As an example have those crit sounds be default for every other class, but when playing Soldier have a crit_hit file of him saying "Blammo!" being loaded instead when landing a delectable kritz rocket on a Heavy's face.

Now from my limited understanding I can't actually see a way how to do this, as this is probably something hard in the game code you can't mess with. I'm not sure there's any way you could actually script on a class change for the file path to change, or even have the game acknowledge and utilise a different naming scheme for the files at all considering that the crit_hit files are shared by all the classes. I believe you can do it with hitsounds, but that's only because they introduced the hitsound sets in the update some years back that you can replace. The crit sounds don't have another set you can mess with.

But some of you guys are ridiculously intuitive at discovering new ways to customize the game so I'll pose this shot in the dark anyway. Either way, would be interesting to confirm whether this is possible or not.

Want to understand scripting a bit more and finding out what and what isn't possible. This seemed like an easy to approach area where I could avoid getting confused and focus on learning what limitations there are (plus there's no way you could exploit this to any advantage due to these specific sound files going all garbly when you edit them).

Just for clarities sake as well, I'm not talking about specific weapon firing sounds which I know are unique. For instance rocket_directhit_shoot_crit.wav

What I mean is the crit_hit.wav (1-5) sounds that play when your crit attack lands.

Knowing that there are 5 crit sounds that play at random when you hit an enemy, it's probably possible to customize each of those so you could get something different than normal playing. Or changing them all to the same sound so you would get no variance. Seems like a simple customization, as the same files play no matter what class or weapons you're using.

What I'm interested about however, is whether it's possible to actually fuck around with that. Force certain classes to load different sound files than the others. As an example have those crit sounds be default for every other class, but when playing Soldier have a crit_hit file of him saying "Blammo!" being loaded instead when landing a delectable kritz rocket on a Heavy's face.

Now from my limited understanding I can't actually see a way how to do this, as this is probably something hard in the game code you can't mess with. I'm not sure there's any way you could actually script on a class change for the file path to change, or even have the game acknowledge and utilise a different naming scheme for the files at all considering that the crit_hit files are shared by all the classes. I believe you [i]can[/i] do it with hitsounds, but that's only because they introduced the hitsound sets in the update some years back that you can replace. The crit sounds don't have another set you can mess with.

But some of you guys are ridiculously intuitive at discovering new ways to customize the game so I'll pose this shot in the dark anyway. Either way, would be interesting to confirm whether this is possible or not.
2
#2
0 Frags +

So the fundamental issue here is that class-specific scrips are part of a .cfg file, which will get executed when you load a map and select a class.

Sounds, including custom .vpks are loaded when you launch hl2 and cannot be handled while the game is open.

I haven't made a custom crit sound in a long time, but from looking at my old ones (and trying to make some new ones recently), you won't hear your custom sound in-game unless you copy the file 5 times and name it crit_hit1 through 5 respectively. You are adding a custom sound to the game so you can hear it, not for the chance to hear it anyway, right?

Hope that helps.

So the fundamental issue here is that class-specific scrips are part of a .cfg file, which will get executed when you load a map and select a class.

Sounds, including custom .vpks are loaded when you launch hl2 and cannot be handled while the game is open.

I haven't made a custom crit sound in a long time, but from looking at my old ones (and trying to make some new ones recently), you won't hear your custom sound in-game unless you copy the file 5 times and name it crit_hit1 through 5 respectively. You are adding a custom sound to the game so you can hear it, not for the chance to hear it anyway, right?

Hope that helps.
3
#3
7 Frags +

It doesn't look like there's any way to change the crit landing sounds on a per-class basis. Those specific .wav files you mentioned are under the "TFPlayer.CritHit" sound definition in scripts/game_sounds_player.txt, which just gets played by the client without any logic regarding what class you're on.

If you're determined to do it anyways, you could probably come up with some clever workaround that essentially has the same effect as being able to change the actual crit hit sound per-class would have. The thing that comes to mind for me would be to mute the actual crit hit sound, and then add a second sound to the crit sound definitions for the weapons of each class in either scripts/tf_weapon_whatever.[ctx|txt] or scripts/game_sounds_weapons.txt. Obviously this wouldn't be a perfect solution since a few of those sounds are shared across classes and some weapons don't have crit sounds, but I don't see any reason it wouldn't work besides that (haven't actually tried it though).

I can't remember what the deal is with sound scripts and sv_pure, but sv_pure is completely broken anyways so it kind of doesn't really matter

It doesn't look like there's any way to change the crit landing sounds on a per-class basis. Those specific .wav files you mentioned are under the "TFPlayer.CritHit" sound definition in scripts/game_sounds_player.txt, which just gets played by the client without any logic regarding what class you're on.

If you're determined to do it anyways, you could probably come up with some clever workaround that essentially has the same effect as being able to change the actual crit hit sound per-class would have. The thing that comes to mind for me would be to mute the actual crit hit sound, and then add a second sound to the crit sound definitions for the weapons of each class in either scripts/tf_weapon_whatever.[ctx|txt] or scripts/game_sounds_weapons.txt. Obviously this wouldn't be a perfect solution since a few of those sounds are shared across classes and some weapons don't have crit sounds, but I don't see any reason it wouldn't work besides that (haven't actually tried it though).

I can't remember what the deal is with sound scripts and sv_pure, but sv_pure is completely broken anyways so it kind of doesn't really matter
4
#4
2 Frags +
turbochad69

Awesome, this sounds like a fun mini project. And yeah, deliberately chose this as my focus as I know sound mods are pretty buggered by sv_pure. Just looking to get more familiar with this kind of scripting. Less chance for anyone to abuse this on the off chance something kooky was discovered.

It seems like you're saying this could be achieved through adding a 2nd sound to the crit definitions of each weapon. The problem is though is that from my understanding a lot of these weapons don't actually have definitions for a weapon-specific crit sound to be played when their crit attack lands.

Take a random crit Wrench hit for instance. I could be wrong, but I'm fairly sure the process of sounds (via definitions) for that would be as follows:
1. Weapon_Wrench.MissCrit
2. Weapon_Wrench.HitFlesh + TFPlayer.CritHit at the same time

For backstabs it would be similar. (This time in .wav files)
1. knife_swing_crit.wav
2. blade_hit1.wav + crit_hit3.wav (for instance) at the same time.

In both these examples it first plays the sound for getting a crit at all with your weapon. Then upon landing it, next plays the default no-crit hit sound for the weapon, followed by the standard crit landed sound. This seems to be the standard procedure for a majority of the weapons in the game. With the exception of one or two weapons which have impact sound definitions for critting like the Eviction Notice (eviction_notice_01_crit.wav) or the Boston Basher (BostonBasher.ImpactCrit), I'm not sure how adding a second sound would be possible for the rest as they would play on both crits and non-crits.

Would you be alright me adding you to ask questions?

[quote=turbochad69] [/quote]
Awesome, this sounds like a fun mini project. And yeah, deliberately chose this as my focus as I know sound mods are pretty buggered by sv_pure. Just looking to get more familiar with this kind of scripting. Less chance for anyone to abuse this on the off chance something kooky was discovered.

It seems like you're saying this could be achieved through adding a 2nd sound to the crit definitions of each weapon. The problem is though is that from my understanding a lot of these weapons don't actually have definitions for a weapon-specific crit sound to be played when their crit attack lands.

Take a random crit Wrench hit for instance. I could be wrong, but I'm fairly sure the process of sounds (via definitions) for that would be as follows:
1. Weapon_Wrench.MissCrit
2. Weapon_Wrench.HitFlesh + TFPlayer.CritHit at the same time

For backstabs it would be similar. (This time in .wav files)
1. knife_swing_crit.wav
2. blade_hit1.wav + crit_hit3.wav (for instance) at the same time.

In both these examples it first plays the sound for getting a crit at all with your weapon. Then upon landing it, next plays the default no-crit hit sound for the weapon, followed by the standard crit landed sound. This seems to be the standard procedure for a majority of the weapons in the game. With the exception of one or two weapons which have impact sound definitions for critting like the Eviction Notice (eviction_notice_01_crit.wav) or the Boston Basher (BostonBasher.ImpactCrit), I'm not sure how adding a second sound would be possible for the rest as they would play on both crits and non-crits.

Would you be alright me adding you to ask questions?
Please sign in through STEAM to post a comment.