jump.tf Forums
Welcome B)

Batch file to remove sounds on jump maps

duppy · 3 · 5994

duppy

  • Newbie
  • *
    • Posts: 18
    • Frags: +0/-0
    • View Profile
I dunno how people will take to using a batch file to disable sounds, but what the hell, I'll post this anyway.  First, a little info though...

The problem I had is that I wanted to disable certain sounds, like the ones for pain and resupply, but ONLY while playing jump maps (locally).  Of course there are mods you can download that replace the sounds with a silent WAV file or whatever, but that disables it globally for any map you play...which I don't want.  So the solution (not completely) to that is sound scripts.  All you have to do is create a text file describing the sounds you want to modify and name it <filename>_level_sounds.txt ...but you have to do that for each and every map you want it to affect, so that's where the batch file comes in:

Code: [Select]
@echo off

:: ouput the embeded text file to a temporary file
for /f "delims=:" %%N in ('findstr /nxl /c:"::BEGIN TEXT" "%~f0"') do (
  more +%%N "%~f0" >default_level_sounds.txt
)

:: loop through jump map files, and copy the embeded text file to <filename>_level_sounds.txt
for /f %%f in ('dir /b .\jump_*.bsp') do (
copy "default_level_sounds.txt" "%%~nf_level_sounds.txt" >nul 2>&1 && echo %%~nf
)

:: silently delete temporary file
del default_level_sounds.txt 2>nul

:: exit batch file
exit /b

::BEGIN TEXT
// Disable resupply sound
"Regenerate.Touch"
{
"channel"     "CHAN_ITEM"
"pitch"       "PITCH_NORM"
"soundlevel"  "SNDLVL_NONE"
"volume"      "VOL_NORM"
"wave"        "vo/null.wav"
}

// Disable bot resupply sound
"BaseCombatCharacter.AmmoPickup"
{
"channel"     "CHAN_ITEM"
"soundlevel"  "SNDLVL_75dB"
"volume"      "VOL_NORM"
"wave"        "vo/null.wav"
}

// Demoman cancel pain severe 01
"Demoman.PainSevere01"
{
"channel"     "CHAN_VOICE"
"pitch"       "PITCH_NORM"
"soundlevel"  "SNDLVL_NONE"
"volume"      "VOL_NORM"
"wave"        "vo/null.wav"
}

// Demoman cancel pain severe 02
"Demoman.PainSevere02"
{
"channel"     "CHAN_VOICE"
"pitch"       "PITCH_NORM"
"soundlevel"  "SNDLVL_NONE"
"volume"      "VOL_NORM"
"wave"        "vo/null.wav"
}

// Demoman cancel pain severe 03
"Demoman.PainSevere03"
{
"channel"     "CHAN_VOICE"
"pitch"       "PITCH_NORM"
"soundlevel"  "SNDLVL_NONE"
"volume"      "VOL_NORM"
"wave"        "vo/null.wav"
}

// Demoman cancel pain severe 04
"Demoman.PainSevere04"
{
"channel"     "CHAN_VOICE"
"pitch"       "PITCH_NORM"
"soundlevel"  "SNDLVL_NONE"
"volume"      "VOL_NORM"
"wave"        "vo/null.wav"
}

// Demoman stickie beep cancel
"Weapon_StickyBombLauncher.ModeSwitch"
{
"channel"       "CHAN_WEAPON"
"soundlevel"    "SNDLVL_NONE"
"volume"        "VOL_NORM"
"wave"          "vo/null.wav"
}

// Soldier cancel pain severe 01
"Soldier.PainSevere01"
{
"channel"     "CHAN_VOICE"
"pitch"       "PITCH_NORM"
"soundlevel"  "SNDLVL_NONE"
"volume"      "VOL_NORM"
"wave"        "vo/null.wav"
}

// Soldier cancel pain severe 02
"Soldier.PainSevere02"
{
"channel"     "CHAN_VOICE"
"pitch"       "PITCH_NORM"
"soundlevel"  "SNDLVL_NONE"
"volume"      "VOL_NORM"
"wave"        "vo/null.wav"
}

// Soldier cancel pain severe 03
"Soldier.PainSevere03"
{
"channel"     "CHAN_VOICE"
"pitch"       "PITCH_NORM"
"soundlevel"  "SNDLVL_NONE"
"volume"      "VOL_NORM"
"wave"        "vo/null.wav"
}

// Soldier cancel pain severe 04
"Soldier.PainSevere04"
{
"channel"     "CHAN_VOICE"
"pitch"       "PITCH_NORM"
"soundlevel"  "SNDLVL_NONE"
"volume"      "VOL_NORM"
"wave"        "vo/null.wav"
}

// Soldier cancel pain severe 05
"Soldier.PainSevere05"
{
"channel"     "CHAN_VOICE"
"pitch"       "PITCH_NORM"
"soundlevel"  "SNDLVL_NONE"
"volume"      "VOL_NORM"
"wave"        "vo/null.wav"
}

// Soldier cancel pain severe 06
"Soldier.PainSevere06"
{
"channel"     "CHAN_VOICE"
"pitch"       "PITCH_NORM"
"soundlevel"  "SNDLVL_NONE"
"volume"      "VOL_NORM"
"wave"        "vo/null.wav"
}

To "install" it, download the file attachment from this post and copy it to the same folder as where you keep all your jump maps.  Most likely they'll be in "tf\download\maps\", but it's possible they could be in "tf\maps" as well.  In either case, the batch file has to be in the same folder as the jump_*.bsp files.  Now, double-click the .bat file and it'll quickly create a bunch of .txt files like "jump_adventure_level_sounds.txt" for example.  After that, when you load up a jump map locally, you shouldn't hear resupply and pain sounds...load up a non-jump maps like ctf_2fort and you'll be able to hear those sounds.

Lastly, I just want to say this is not a perfect solution, because technically, sound script are server-side "mods".  That means you'll mainly only have the sounds disabled while playing locally on your own server (ex. when you type "map jump_whatever" in the dev console)...and of course on any other server you visit that has these sound scripts created.  For me, this is good enough...although I completely disable the regen sound globally, 'cause I never wanna hear that sound ;)  Oh, one more thing...I believe this batch file will only work for Windows 7 and 8...I haven't tested it on anything else. 

Anyway, I hope someone out there finds this useful...probably not  :-[
« Last Edit: September 10, 2016, 10:39:07 PM by John »


RNC1839

  • Proficient
  • ****
    • Posts: 499
    • Frags: +0/-0
    • View Profile
Nice work! This is certainly an interesting solution... I would have just gone with vpk's and wrote a batch script to swap them in and out of a distant folder, but that might run into issues if the game is still running when you run the script.

Anyway, yeah this will only work on windows machines because everything else uses Unix.


TomSpillfat

  • Newbie
  • *
    • Posts: 1
    • Frags: +0/-0
    • View Profile
just found this now, and wanted to thank you for the batch file and the awesome step by step instructions that even a caveman like myself could understand.

brilliant job, and thank you for your contribution! this helped me to finally get rid of the resup sound :)