(TF2) Custom Sounds for Things That Don't Have Sounds

D

Digaag Wa Riz

I have a question.

I'm trying to make custom sounds for things that don't have their own sounds in TF2. All I've ever done with regards to custom sounds are to replace the existing ones. For instance, I have replaced the crit and mini-crit sounds with the hit sounds from The Legend of Zelda: The Wind Waker.

But those mini-crit and crit sounds were already there. What I want to know is how to make sounds for things that do not have a unique sound for them in the game, like if I wanted to play a completely different sound for getting a headshot with the sniper rifle rather than just the crit sound. I'm not sure this is possible without editing some code but I sure hope it's just a matter of editing some of the files in the tf/scripts directory.

TL;DR:

Sniper headshot does not make it's own sound, just the crit sound. How can I make a unique sound for the headshot without changing the regular crit sound.
 

Forty-Two

L1: Registered
Mar 7, 2013
12
2
You'd probably have to mod the client code to play a custom sound instead of the crit sound. I'm not familliar with the source codebase, but I'd start by grepping for the sniper rifle in the client.
 
D

Digaag Wa Riz

You'd probably have to mod the client code to play a custom sound instead of the crit sound. I'm not familliar with the source codebase, but I'd start by grepping for the sniper rifle in the client.

Do I do that in a script? Do I just write whatever the proper way of writing

if(sniper_headshot)
play("headshot_sound.wav");

I know coding isn't that simple...
What files am I supposed to be looking for and editing/creating?
 
D

Digaag Wa Riz

Let me clarify what I think I should do.

The game_sounds_player.txt in the scripts/ directory lists "events" in which certain sounds play. For example:

"Scout.DodgeCanOpen"
{
"channel" "CHAN_WEAPON"
"volume" "1"
"soundlevel" "SNDLVL_84dB"
"pitch" "PITCH_NORM"
"wave" "player/pl_scout_dodge_can_open.wav"
}

"Scout.DodgeCanDrinkFast"
{
"channel" "CHAN_WEAPON"
"volume" ".25"
"soundlevel" "SNDLVL_84dB"
"pitch" "PITCH_NORM"
"wave" "player/pl_scout_dodge_can_drink_fast.wav"
}

"Scout.DodgeCanDrink" //when scout drinks something...
{
"channel" "CHAN_WEAPON"
"volume" "1"
"soundlevel" "SNDLVL_84dB"
"pitch" "PITCH_NORM"
"wave" "player/pl_scout_dodge_can_drink.wav" //...this sound plays
}


I want to know if I could write something like:

"Sniper.Headshot"
{
"channel" "CHAN_WEAPON"
"volume" "1"
"soundlevel" "SNDLVL_84dB"
"pitch" "PITCH_NORM"
"wave" "player/sniper_headshot.wav"
}
 
Last edited by a moderator:
D

Digaag Wa Riz

I know this can be done because I've played on servers that play specific sounds if you get a headshot. Is this something only a server plugin can do?
 
D

Digaag Wa Riz

Yes, this can only be done with a plugin. The script doesn't make new sound events happen, it defines when happens when a given event is called.

One more thing: Does it need to be a server plugin. I mean, in order for it to be heard di I have to be on a server that is running this plugin or can it just be a "client plugin" if there is such a thing?
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
I don't have the knowledge to answer that. I think client plugins can exist, but I'm not sure how or what they can do (since you could easily cheat with such).