So, let's say you're midway through making your map and you want your own epic soundtrack to play, or you want music from the original Half-Life.
This tutorial will show you how to make music play during your map.
PREPARING THE MUSIC FOR PLAYBACK
You can skip this step if you're not using your own music.
First, you need to prepare the music. There's nothing much you have to do like adding cue points, etc. because music playback uses the Miles Sound System and not GoldSource's one. You need to have an MP3 with a sample rate of 44100Hz. Next, you need to set its file name. GoldSource only supports certain filenames for your MP3 files. If you set the filename to gamestartup.mp3, the track will play in a loop on the main menu when the game starts. You need to use one of these 27 filenames:
You can apply any metadata, including album artwork and composer info to your MP3s. It won't effect in-game playback.
Once you have prepared your music for playback, we will now make it play in-game.
MAKING THE MUSIC PLAY
In your map, there are two ways to make music play. You can use the brush entity trigger_cdaudio
to make the music play when the player walks through it, or you can use the target_cdaudio
point entity to make the music play when it is triggered. Both entities have the exact same properties. If you're using target_cdaudio,
you will need to add something in the targetname/Name
key. In the Track to play
key, there are tracks 1-30, though you can only really use tracks 2-28.
|Value||Mp3 file to play|
Once you've set up the entity correctly corresponding to your MP3, you can compile your map. If the MP3 files aren't in your mod folder, the game will play the files from the valve