This article relates to the game "Left 4 Dead". Click here for more information.
This article's documentation is for anything that uses the Source engine. Click here for more information.

L4D Custom Music Tutorial: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
m (→‎Example Tips: Unicodifying, replaced: [[IMage: → [[File: (3))
 
(15 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{toc-right}}
{{lang|{{PAGENAME}}}}{{L4D topicon}}{{Source topicon}}[[Category:Left 4 Dead]][[Category:Sound System]][[Category:Tutorials]]
This tutorial will go over how to customize the Music Director for your campaign using the<code>mapname_level_sounds.txt</code>file.
If you are planning on creating custom soundscripts as well, you should still follow this tutorial and append those scripts to the <code>level_sounds.txt</code>.


There are 7 steps to adding custom music to your campaign in Left 4 Dead:


# Create a text file called [your_exact_map_name]_level_sounds.txt in your addons maps directory.
There are 9 steps to this method of adding custom music to your campaign:
# Copy ALL the contents from my example soundscript into that file.
# Create a text file called <code>mapname_level_sounds.txt</code> in your add-on's maps directory.
# In the missions file of your addon, find the NAME parameter, and pick a short name that has no spaces.
# Copy ALL the contents from the example soundscript into that file.
# In notepad, press CTRL + H, to find and replace XXXXX with the same name you used in missions.txt NAME field.
# In the missions file of your add-on, find the NAME parameter and pick a short name that has no spaces.
# Begin replacing any wav files you choose in the script to reference your own files. (Do not include sounds/ in the paths, it's assumed)
# In notepad, press {{key|Ctrl|H}} to find and replace XXXXX with the same name you used in <code>missions.txt</code> NAME field.
# [[BSPZIP]] or [[Pakrat]] your custom music into the map .bsp file. (The paths for each wav file within the bsp should be sounds/music/your_custom_folder)
# Begin replacing any WAV files you choose in the script to reference your own files. (Do not include <code>sounds/</code> in the paths, it's assumed.)
# Packadge your campaign into a [[L4D Campaign Add-on Tutorial|VPK]] and test it out ingame, your custom music should work!
# Load up ''Left 4 Dead'' and turn off all add-ons except the one you are working on. (Other campaigns' custom sounds may cause trouble if you don't.)
 
# In the console, enter <code>snd_rebuildaudiocache</code> and wait about 5 mins for it to finish.
{{Note|Your campaign maps should have a valid nav mesh for many soundscript events to work properly.}}
# Copy the _master.cache file from your<code>maps/soundcache</code>, place it in your add-on's <code>maps/soundcache</code> directory.
# Package your campaign into a [[L4D Campaign Add-on Tutorial|VPK]] and test it out in-game. Your custom music should work!
{{Note|You will need to repeat the <code>snd_rebuild</code> steps whenever you add new sound files.}}
{{todo|This method seems to have a 50/50 chance of allowing users to hear your custom sounds without rebuilding their audio cache. It may be more beneficial to PAKRAT/BSPZIP the <code>_master.cache</code> file within the<code>.bsp</code>itself, thereby hiding the file from other people's add-ons, which would avoid sound conflicts and possibly force your custom soundcache to load instead of the default. This is untested, but it's worth a try.}}


== Custom Music Script File ==
== Custom Music Script File ==
This is the example soundscript you need to copy.
This is the example soundscript you need to copy.


It is a stripped version of the game_sounds_music.txt to only include the Events you need to edit for your campaign.
It is a stripped version of the <code>game_sounds_music.txt</code> to only include the Events you need to edit for your campaign.
Using it fixes a bug with soundscripts where zombies would play an alarm sound when killed with fire, amongst other things.
It is highly recommended allowing a greater insight into what each section is for when deciding on what to change.
It is also highly commented allowing a greater insight into what each section is for when deciding on what to change.


You may also opt not to change anything in the file, which will give your campaign the default music cues associated with the Airport campaign.
You may also opt not to change anything in the file, which will give your campaign the default music cues associated with the Airport campaign.


http://www.evolvedant.com/soundscript/example_script.zip
http://www.evolvedant.com/soundscript/example_script.zip
{{Note|There was a slight typo in the previous file.. if intro music wasn't working for you, redownload this file.}}
{{Note|There was a slight typo in the previous file. If intro music wasn't working for you, redownload this file.}}


== Example Tips ==
== Example Tips ==
If your campaign is called "Awesome" and contains maps such as <code>l4d_awesome_forest</code>, <code>l4d_awesome_campsite</code>, etc…


If your campaign is called 'Awesome' and contains maps such as l4d_awesome_forest, l4d_awesome_campsite, etc...
Your add-on's maps directory should contain <code>l4d_awesome_forest_level_sounds.txt</code>:
Your addons maps directory should contain l4d_awesome_forest_level_sounds.txt
[[File:L4dMapDir.jpg‎|center|500px]]
[[IMage:L4dMapDir.jpg‎|center|500px]]
 
The NAME parameter in your missions.txt would be 'awesome' and look like this:
[[Image:L4dmissions2.jpg|center|500px]]
 
A custom intro song that we will call 'thriller.wav' correctly pathed and added into the bsp would look like this:
[[Image:L4dPakrat.jpg|center|500px]]
 
Heres how your sound script would look properly edited to make use of thriller.wav
[[Image:L4dsoundscript.jpg‎|center|500px]]
 
== Major Drawbacks ==


Unfortunately you must include custom music wav files in EVERY bsp that is part of your campaign.
The NAME parameter in your <code>missions.txt</code> would be "awesome" and look like this:
This is due to technical issue with how sounds are handled in L4D that was introduced to the game a few weeks before release.
[[File:L4dmissions2.jpg|center|500px]]
The only way to go around this is to store your sound files in the VPK's sound directory and request that downloaders of your campaign run the console command snd_rebuildaudiocache. This is not optimal, as many players will never run the command, it takes 5 mins to run if they do, and it overwrites sound manifest files on their client.


The L4D SDK team is aware of this issue, there is no ETA on when it will be fixed.
Here's how your sound script would look properly edited to make use of <code>thriller.wav</code>:
 
[[File:L4dsoundscript.jpg‎|center|500px]]
You must ALSO make a copy of the sound script file itself renamed to the same name of each of your bsp's in your campaign. As each map will reference only the script that has the same name as the map.
 
Custom soundscripts seem to only work when packadged completely as a VPK. Simply running off the addon folder isn't sufficient. This makes testing quick changes more cumbersome.


== See also ==
== See also ==
* [[L4D Campaign Add-on Tutorial]]
* [[L4D Campaign Add-on Tutorial]]
[[Category:Left 4 Dead]]

Latest revision as of 00:20, 7 January 2024

English (en)Translate (Translate)

This tutorial will go over how to customize the Music Director for your campaign using themapname_level_sounds.txtfile. If you are planning on creating custom soundscripts as well, you should still follow this tutorial and append those scripts to the level_sounds.txt.


There are 9 steps to this method of adding custom music to your campaign:

  1. Create a text file called mapname_level_sounds.txt in your add-on's maps directory.
  2. Copy ALL the contents from the example soundscript into that file.
  3. In the missions file of your add-on, find the NAME parameter and pick a short name that has no spaces.
  4. In notepad, press Ctrl+H to find and replace XXXXX with the same name you used in missions.txt NAME field.
  5. Begin replacing any WAV files you choose in the script to reference your own files. (Do not include sounds/ in the paths, it's assumed.)
  6. Load up Left 4 Dead and turn off all add-ons except the one you are working on. (Other campaigns' custom sounds may cause trouble if you don't.)
  7. In the console, enter snd_rebuildaudiocache and wait about 5 mins for it to finish.
  8. Copy the _master.cache file from yourmaps/soundcache, place it in your add-on's maps/soundcache directory.
  9. Package your campaign into a VPK and test it out in-game. Your custom music should work!
Note.pngNote:You will need to repeat the snd_rebuild steps whenever you add new sound files.
Todo: This method seems to have a 50/50 chance of allowing users to hear your custom sounds without rebuilding their audio cache. It may be more beneficial to PAKRAT/BSPZIP the _master.cache file within the.bspitself, thereby hiding the file from other people's add-ons, which would avoid sound conflicts and possibly force your custom soundcache to load instead of the default. This is untested, but it's worth a try.

Custom Music Script File

This is the example soundscript you need to copy.

It is a stripped version of the game_sounds_music.txt to only include the Events you need to edit for your campaign. It is highly recommended allowing a greater insight into what each section is for when deciding on what to change.

You may also opt not to change anything in the file, which will give your campaign the default music cues associated with the Airport campaign.

http://www.evolvedant.com/soundscript/example_script.zip

Note.pngNote:There was a slight typo in the previous file. If intro music wasn't working for you, redownload this file.

Example Tips

If your campaign is called "Awesome" and contains maps such as l4d_awesome_forest, l4d_awesome_campsite, etc…

Your add-on's maps directory should contain l4d_awesome_forest_level_sounds.txt:

L4dMapDir.jpg

The NAME parameter in your missions.txt would be "awesome" and look like this:

L4dmissions2.jpg

Here's how your sound script would look properly edited to make use of thriller.wav:

L4dsoundscript.jpg

See also