ambient_music

Modified

12-Jul-2023

Entity that allows to play sounds, designed to play music clips which volume can be adjusted in option menu (with 'Music Volume' slider), separately from normal game audio effects. Audio played with this entity are not affected by it's position.

Keyvalues


OnDestroy Function ondestroyfn : Name of the function to use from already parsed .as script files when entity is destroyed (killed) in any way. If the function belongs to namespace, you must use prefix with the namespace name (e.g. mynamespace::MyFunction) for the keyvalue.

Name targetname : Set name of ambient_music so other entities can trigger it to play music. Depending on trigger use-type: 'Off'- stop the music, 'Toggle'- play/stop music interchangeably, 'On'- start the music. Kill-targeting this entity will stop music from playing.

Sound File message : Name of the sound file to play. Supported formats are: AIFF, ASF, DLS, FLAC, IT, M3U, MID, MOD, MP2, MP3, OGG, S3M, VAG, WAV, WMA, XM. Hammer will only let you select WAV-files, but other formats do work as they are fully supported by the game's sound engine. Type the path in manually in that case. File Path starts in the 'sound'-folder, example: 'mymap/soundfile.ogg'.

Volume (10 = loudest) volume : Set how loud the sound shall be in a range from 0 (not audible) to 10 (normal).

Flags


  • 1 : Start Silent : Entity need to be triggered to start playing music.

  • 2 : Loop : The sound will play looped when triggered.

  • 4 : Activator Only : Music will be heard only by player who is an activator of script (e.g. he pressed a button that triggers this entity).

Music will be playing even for players who just connected to the server, it will start playing on appropriate offset.