Music track: Difference between revisions
MyGamepedia (talk | contribs) No edit summary |
MyGamepedia (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
{{This is a|point|name=music_track|game=Black Mesa|sprite=Ambient_generic.png}} This entity allows you to play music and control it dynamically, without the need to create lots of scripts. The best example of using this entity is the beginning of chapter {{code|Surface Tension}}. When player triggering the trigger - the first music track starts, which is looped (it loops itself, without help from other entities), when the soldiers leaves the ambush - the next track starts, which is also looped. When the fight with the helicopter ends, the last, final track starts, which is not looped. Before this system implementation, music was launching via [[ambient_generic]], which just playing the full version of the music from beginning to end, which made certain parts of the music inappropriate for situations, or even ended when the helicopter didn't even arrive. | {{This is a|point|name=music_track|game=Black Mesa|sprite=Ambient_generic.png}} This entity allows you to play music and control it dynamically, without the need to create lots of scripts. The best example of using this entity is the beginning of chapter {{code|Surface Tension}}. When player triggering the trigger - the first music track starts, which is looped (it loops itself, without help from other entities), when the soldiers leaves the ambush - the next track starts, which is also looped. When the fight with the helicopter ends, the last, final track starts, which is not looped. Before this system implementation, music was launching via [[ambient_generic]], which just playing the full version of the music from beginning to end, which made certain parts of the music inappropriate for situations, or even ended when the helicopter didn't even arrive. | ||
All code for original music tracks from {{bms|4}} placed in {{code|game_sounds_music.txt}}, | All code for original music tracks from {{bms|4}} placed in {{code|game_sounds_music.txt}} and {{code|game_sounds_xen_music.txt}}, both placed in {{code|scripts}} folder. | ||
{{todo|Learn how this entity interacts with sound files and their code. Answer the following questions: | {{todo|Learn how this entity interacts with sound files and their code. Answer the following questions: | ||
** What code should be be written to make sound file working with this entity ? | ** What code should be be written to make sound file working with this entity ? |
Revision as of 00:55, 23 March 2024

music_track
is a point available in Black Mesa. This entity allows you to play music and control it dynamically, without the need to create lots of scripts. The best example of using this entity is the beginning of chapter Surface Tension. When player triggering the trigger - the first music track starts, which is looped (it loops itself, without help from other entities), when the soldiers leaves the ambush - the next track starts, which is also looped. When the fight with the helicopter ends, the last, final track starts, which is not looped. Before this system implementation, music was launching via ambient_generic, which just playing the full version of the music from beginning to end, which made certain parts of the music inappropriate for situations, or even ended when the helicopter didn't even arrive.
All code for original music tracks from Black Mesa placed in game_sounds_music.txt and game_sounds_xen_music.txt, both placed in scripts folder.
- What code should be be written to make sound file working with this entity ?
- Why do only some audio tracks loop ?
- Why Next input works only if used combination of certain tracks ?
- Does Stop input works ?
- Why Fade input works only with certain tracks ?
Keyvalues
- Name (targetname) <string>[ Edit ]
- The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g.
parentname
ortarget
).
Also displayed in Hammer's 2D views and Entity Report.See also: Generic Keyvalues, Inputs and Outputs available to all entities
- Sound Name (track_script_sound) <sound>
- Name of the GameSound entry for the music to play.

music\bms - st1-part2.wav
for example), instead, sound name from the code of the file must be used (music.st.1-part2
in case of the example).
- Next Track (next_track_entity) <targetname>
- Name of the next music_track entity to play when Next input is called.
Inputs
- Play <void>
- Starts the music track.

- Stop <void>
- Stops the music track.
- Fade <float >
- Fades the music track out over the given number of seconds
- Next <float >
- Plays the next track when the BPM lines up.