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

Discussion in 'Off Topic' started by Digaag Wa Riz, Aug 9, 2013.

  1. Digaag Wa Riz

    Digaag Wa Riz L3: Member

    Messages:
    121
    Positive Ratings:
    83
    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.
     
  2. Forty-Two

    Forty-Two L1: Registered

    Messages:
    12
    Positive Ratings:
    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.
     
  3. Digaag Wa Riz

    Digaag Wa Riz L3: Member

    Messages:
    121
    Positive Ratings:
    83
    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?
     
  4. Digaag Wa Riz

    Digaag Wa Riz L3: Member

    Messages:
    121
    Positive Ratings:
    83
    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: Aug 11, 2013
  5. Digaag Wa Riz

    Digaag Wa Riz L3: Member

    Messages:
    121
    Positive Ratings:
    83
    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?
     
  6. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,767
    Positive Ratings:
    5,508
    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.
     
  7. Digaag Wa Riz

    Digaag Wa Riz L3: Member

    Messages:
    121
    Positive Ratings:
    83
    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?
     
  8. A Boojum Snark

    aa A Boojum Snark Toraipoddodezain Mazahabado

    Messages:
    4,767
    Positive Ratings:
    5,508
    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).