How can you add a custom announcer to a map?

Dog.vtf

L1: Registered
Sep 2, 2017
49
12
I'm making a Payload map where the payload is not a bomb, And I need to make custom announcer sounds.


But I need to have them just on this map. Any ideas on how to do this?
 
Mar 23, 2013
1,013
347
You replace sound scripts with a MAPNAME_level_sounds.txt which you place in the maps folder. Open tf2_misc_dir.vpk and go to the scripts fodler. There are some text files with all the soundscripts of the game.
All announcer lines should be in game_sounds_vo.txt. There a shit tone of scripts so use the search function to get the right one. Here is an example from game_sounds_vo.txt

Code:
"Announcer.SD_OurTeamHasFlag"
{
    "channel"        "CHAN_VOICE2"
    "volume"        "1"
    "pitch"            "PITCH_NORM"
    "soundlevel"    "SNDLVL_NONE"

    "rndwave"
    {
        "wave"    "vo/announcer_sd_possession01.mp3"
        "wave"    "vo/announcer_sd_possession16.mp3"
        "wave"    "vo/announcer_sd_possession21.mp3"
        "wave"    "vo/announcer_sd_possession24.mp3"
    }
}

Looks like it's the script for the special delivery mode, it randomly plays one out of four voice lines of the announcer when your team gets the flag. If you want to replace that because you are making some custom special delivery mode then you have to copy this script into your own MAPNAME_level_sounds.txt.
the part with "rndwave" is what you are going to edit. Create a custom sound file that is supposed to play instead and name it differently and it instert it in the script.
For example, I now created with a text-to-speach programm a voice saying "our team has the banana basket" or something like that and save the mp3 to tf/sounds/lampenpam/vo_banana_get.mp3 then I'd have to change the script to:

Code:
"Announcer.SD_OurTeamHasFlag"
{
    "channel"        "CHAN_VOICE2"
    "volume"        "1"
    "pitch"            "PITCH_NORM"
    "soundlevel"    "SNDLVL_NONE"

    "wave"         "lampenpam/vo_banana_get.mp3"
}

As you can see I used "wave" instead of "rndwave" because It doesn't need to select a file at random, but of course you can do it similar to the original script if you want to play a random file.

Now while playing the map with the name of your level_sounds.txt file, the voice lines for the team grabing the flag in SD is replaced with my custom file. It's important that you don't change the name of the scripts (in this case the "Announcer.SD_OurTeamHasFlag") so it replaces the right sound.
But you can add custom scripts (with a new custom name) to your level_sounds.txt too. You can play them with an ambient_generic by specifiying the name of the sound script but that's only usefull if you have a script with randomly selected sound files.
 

Dog.vtf

L1: Registered
Sep 2, 2017
49
12
I've extracted game_sounds_vo but I'm having trouble finding the payload sounds, Do you know any text that would be in the payload sound codes?
 
Mar 23, 2013
1,013
347
Search for "cart" not for "payload"

And just fyi, don't store the extracted text file (if you even safe it seperatly in the first place) in the tf/scripts folder because then it would overwrite the offical one which doesn't get updated when new lines are added in an update.
 

Izotope

Sourcerer
aa
May 13, 2013
698
764
Tip: use snd_show 1 in console, it'll display the path and soundname of everything that you can hear.
Then you can look for that exact name in your files and find the soundscript that goes with it.
 

henke37

aa
Sep 23, 2011
2,075
515
But you can add custom scripts (with a new custom name) to your level_sounds.txt too. You can play them with an ambient_generic by specifiying the name of the sound script but that's only usefull if you have a script with randomly selected sound files.
I disagree on this last claim. Being able to set the channel and loudness is important.
 

Evatron

L1: Registered
Oct 23, 2021
42
1
late to bump but is it necessary for it to be an mp3? mine are wav and play elsewhere (ambient_generic) but not overriding the announcer.
 

MOCOLONI

L6: Sharp Member
Dec 16, 2014
373
89
late to bump but is it necessary for it to be an mp3? mine are wav and play elsewhere (ambient_generic) but not overriding the announcer.
If you don't mind a slight loss in sound quality for a faster read of the file and a lighter size, then you should go with MP3 files.