How to add new subtitles for L4D2

From Valve Developer Community
Jump to navigation Jump to search

How to Create Custom Subtitles in Left 4 Dead 2

Hello everyone, this will be a guide divided into sections on how to add new subtitles.


Note.pngNote:It is assumed that you are familiar with using Hammer, and handling files such as .lmp and level_sounds.txt, since this involves modifying maps.

Sections

  • Adding new subtitles to official campaigns
  • Adding new subtitles to custom campaigns
  • Adding subtitles to your own custom campaign

Adding new subtitles to official campaigns

First step

Have the audio file(s) you want to subtitle ready, then create a folder named maps and add 2 files inside:

  • A .lmp file
  • A level_sounds.txt file

Second step

Open the map's level_sounds.txt file.

Note.pngNote:Official maps do not come with this file, so you'll have to create a new one. This is easy: just find the map's name and create the corresponding level_sounds.txt.
  • Example:*

Dark Carnival map 4 = c2m4_barns → The file should be named: c2m4_concert_level_sounds.txt

Note.pngNote:If you don't know the map's base name, open the game console and type map . You'll see the names there.

Third step

Simply define the sound name and edit the values. Example:

"npc.map4_hippie1"
{
    "channel"    "CHAN_VOICE"
    "volume"     "1.0"
    "pitch"      "PITCH_NORM"
    "soundlevel" "SNDLVL_90dB"
    "wave"       "map4/hippy/hippie1.wav"
}

Once done, copy the name above the curly braces { } and use it later in Hammer.

Fourth step

Open the decompiled map in Hammer. Instead of linking directly to the .wav file, insert the sound name (e.g., npc.map4_hippie1). Then compile the map.

Fifth step

Open the .lmp file that you previously extracted from the .bsp (located in left4dead2/maps).

Example:

c2m4_barns_l_0.lmp

Once opened, scroll to the end of the file. Then open the new compiled .bsp and copy the edited lines.

Add the lines you created at the end


Something like this


Once that's done, drag the .lmp file into the lmpfix program so it can fix it.

Sixth step

Create a folder named resource and inside it, a file: closecaption_your_language.txt

Basic content:

// TEMPLATE
"lang"
{
    "Language" "Your language"
    "Tokens"
    {
        "testcommands" "<clr:255,0,0>This is red<I> italics<B> bold <cr><clr:255,255,255>white again."
        "title_name" "<clr:255,255,255>Subtitle line"
    }
}

Example:

// EXAMPLE
"lang"
{
    "Language" "english"
    "Tokens"
    {
        "npc.map4_hippie1" "<clr:255,255,255>hippie: Hello world"
    }
}

Save the file.

Seventh step

Create a gameinfo.txt file in the same folder, like this:

resource > "closecaption_your_language.txt"
gameinfo.txt

Eighth step

Drag the closecaption_your_language.txt file onto captioncompiler.exe (found in the bin folder).

This should generate: closecaption_your_language.dat in the resource folder.

Note.pngNote:If it doesn’t work, open CMD and type:
cd C:\Program Files (x86)\Steam\steamapps\common\Left 4 Dead 2\left4dead2
"../bin/captioncompiler" "../../left4dead2_subtitles_custom/resource/closecaption_your_language.txt"

(Make sure to adjust the path and folder name according to your installation.)

Conclusion

Done! That’s everything you need to do for subtitles to appear in official campaigns, in case you want to add new ones.