Hosting and domain costs until October 2024 have been generously sponsored by dumptruck_ds. Thank you!
ambientsound
From Quake Wiki
void ambientsound(vector pos, string soundPath, float volume, float attenuation)
Usage
Starts playing a sound with no connection to any entity. A sound must be precached during map load in order to be considered valid. Once an ambient sound starts playing it cannot be stopped.
Unlike standard sounds, ambient sounds must loop in order to be considered valid (sound markers need to be present in the file).
Parameters:
- pos
- The origin of the sound.
- soundPath
- The path of the sound file. Supports WAV (.wav) files.
- volume
- Can be a value from 0 to 1.
- attenuation
- Determines the linear falloff of the sound over distance. A value of 0 (
ATTN_NONE
) will have no fall off. The larger the value, the greater the falloff. Default values:ATTN_NONE
ATTN_NORM
ATTN_IDLE
ATTN_STATIC
Example
// This entity plays an ambient sound when it initializes void ambient_ocean() { precache_sound("ambience/ocean.wav"); ambientsound(self.origin, "ambience/ocean.wav", 1, ATTN_STATIC); remove(self); }