L4D Soundscripts
Introduction
Left 4 Dead soundscripts are located within the path /left4dead/scripts
. They are plain text files (.txt
extension) used to invoke in-game sounds such as weapons, soundscapes, and music during events output by the sound emitter. The scriptgame_sounds_manifest.txt
will preload or precache the soundscripts when Left 4 Dead is loaded. The base path for all sound files is /rootDir/sounds/
. This means that all of the soundscripts will look in /rootDir/sounds/soundscript entry
for sound assets, where rootDir
is pointed to a VPK addon or /left4dead/
.
Most soundscript files for L4D are named with the starting label game_sounds_*
.
How to Use One of Valve's Soundscript Files (Music) in Your Custom Campaign
Please see here: L4D Custom Music Tutorial
Custom L4D Soundscripts
.vpk
will completely replace the original one with the same name.Many L4D soundscripts are linked with the AI Director and therefore is a little bit more complicated than other Source engine-based games. Some L4D soundscripts, especially the entries for music, depend on the content of three things: the mission text file, the actual soundscript, and the navigation mesh.
- The missions/<mission name>.txt file registers a unique name, an entry called "NAME", that are important for L4D soundscripts such as the music soundscript. The mission file also lists all of the actual map files that are part of the mission. Many entries in the music soundscript depends on the "NAME" entry found in the mission file, where "NAME" is used by the Sound Emitter with the maps registered under it.
- As with any source game, a soundscript found as maps/<mapname>_level_sounds.txt can override official soundscript entries without affecting other campaigns. Official Valve campaigns may use sound_games_music.txt for music soundscript entries.
- The nav mesh must be properly marked with attributes to invoke certain events
No Mercy Campaign (Example)
The following details will use a music soundscript entry in No Mercy (an official Valve campaign) as an example.
- Mission File
- The No Mercy mission text file is found as
missions/hospital.txt
. - "NAME" entry is uniquely labeled as "Hospital."
hospital.txt
contains a list of the exact names of the maps:l4d_hospital01_apartment
…l4d_hospital05_rooftop
.
- The No Mercy mission text file is found as
- Sound Script and Nav Mesh
Event.MissionStart_Hospital
is an entry in the soundscriptsound_games_music.txt
- In the initial spawning point of the No Mercy campaign, the Sound Emitter invokes an event called
Event.MissionStart_Hospital
- The event is only invoked in the map files listed in the mission file if the navigation mesh is labeled with the attribute CHECKPOINT and the mission has just started.
When Entries Occur
Some occurrences of entries found in soundscripts are easier to predict than others. For example, Player.PickupWeapon
occurs during moments when the map initially loads and when a player picks an item or a weapon. Other entries are for NPCs, and therefore takes the current situation and map into consideration. Some entries occur in L4D only when the nav mesh is properly labeled at a specific part of the map. Some entries even depend on the atmosphere (such as a room fully clear of common infected), textures, entities, etc.
There are ways to see how some certain entries occur. One way is to look at comments found in the soundscripts provided by Valve or just the name of the entry itself.
Another way is to see what entries are being invoked in-game. This can be done by temporarily copying the soundscripts to another directory, deleting the entries in all the soundscripts temporarily, and running the game in developer mode in order to see when the Sound Emitter invokes a sound to play but cannot find a sound entry in the soundscripts loaded. An example would be Sound Emitter warning about the missing sound file for Event.MissionStart_NAME
if an entry has not been created yet. One may have to investigate the navigation mesh, consider the situation and documentation, the change in visibility of the map, etc.
The rest of this article documents what is already known and what is not known for all soundscript entries in L4D.
Soundscripts Manifest
The L4D soundscripts manifest, game_sounds_manifest.txt
, is a list of soundscripts that are either preloaded or precached when the game is loaded. The following is the actual manifest for L4D. The soundscripts are separated in this manner mostly for the sake of organization. All of the scripts, in this case, could have been combined into two soundscript files for either precaching or preloading:
game_sounds_manifest { "precache_file" "scripts/game_sounds_bots.txt" "precache_file" "scripts/game_sounds_terror.txt" "precache_file" "scripts/game_sounds_infected_common.txt" "precache_file" "scripts/game_sounds_infected_special.txt" "precache_file" "scripts/game_sounds_player.txt" "precache_file" "scripts/game_sounds_biker.txt" "precache_file" "scripts/game_sounds_manager.txt" "precache_file" "scripts/game_sounds_namvet.txt" "precache_file" "scripts/game_sounds_teengirl.txt" "precache_file" "scripts/game_sounds_npcs.txt" "precache_file" "scripts/game_sounds_npc2.txt" "precache_file" "scripts/game_sounds_music.txt" "precache_file" "scripts/game_sounds_doors.txt" "preload_file" "scripts/game_sounds.txt" "preload_file" "scripts/game_sounds_physics.txt" "preload_file" "scripts/game_sounds_weapons.txt" "preload_file" "scripts/game_sounds_ambient_generic.txt" "preload_file" "scripts/game_sounds_world.txt" // Level sounds "preload_file" "scripts/level_sounds_general.txt" }
List of L4D Soundscripts
game_sounds_bots.txt
game_sounds_terror.txt
NPCs and Player
game_sounds_infected_common.txt
game_sounds_infected_special.txt
game_sounds_player.txt
game_sounds_biker.txt
game_sounds_manager.txt
game_sounds_namvet.txt
game_sounds_teengirl.txt
game_sounds_npcs.txt
game_sounds_npc2.txt
Music and Environmental
game_sounds_music.txt
Music is generated based upon varying mixes of criteria.
- Gamemode (Campaign, Scavenge, Survival)
- Campaign (No Mercy, Dead Center…)
- Checkpoint type:
- The very first one waiting for a campaign to start
- Saferoom exits waiting for a round to start.
- Game events (player death, mob spawns…)
Here is an example of some of the entries involved with round starts…
Entry | Occurence/Trigger/Description |
---|---|
Event.MissionStart_<mission "NAME"> | Music played during the opening sequence of a campaign and within the safe area. |
Event.MissionStart_BaseLoop_<mission "NAME"> | Intro music will transition into this if the survivors don't leave the safe area. |
Event.MissionStart_Holdout | This applies to all maps that are in survival mode in the beginning of player spawn. |
Event.CheckPointIntro_<mission "NAME"> | Saferoom music that is played at every round start after the first map. |
Event.CheckPointBaseLoop_<mission "NAME"> | CheckPointIntro transitions into this if the survivors don't leave the safe room. |
Event.LeavingSafety_<mission "NAME"> | Sounds played when the player leaves the starting checkpoints. |
Event.StartAtmosphere_<mission "NAME"> | Played when the player leaves the starting checkpoint and the LeavingSafety sound has/is played. |