This Entity is also available as Ambient generic (GoldSource Engine) for the GoldSource Engine.
ambient_generic is a point entity available in all Source games.
It plays a sound, either once or on loop, and either from a location in the world or globally.
- Sound Name(message)
- The soundscript name of, or direct path to, the sound to play. For scripted sentences, type "!" followed by the sentence name. (Example: !COMBINE_THROW_GRENADE4) Note:If you need the sound to be recognized as music so it gets affected by the sound options, precede the path with a "#". (Example: music/song01 becomes #music/song01)
- Max Audible Distance
- Maximum distance in units at which the sound plays for a client. Note:Volume fades to nothing as the player approaches this distance, which can make it seem as if the sound stops playing too early.
- If specified, the sound will play from this entity instead of the ambient_generic. If the target is an NPC capable of lipsynching, and phoneme data is found within the sound, the target will lip-sync to it. Bug: If the ambient_generic is killed, the sound will play at the origin of the map (at 0,0,0).Tip:The ambient_generic can be parented if the "parentname" keyvalue or SetParent input is used, as an alternative.
- How loud to play the sound. 0 is silent and 10 is normal. Default is 10.
- Start Volume
- Fade in time in seconds
- Fade out time in seconds
- How long to spend fading in and out, and what volume to start at. Default is no fading.
- Pitch <int 1-255>
- Pitch, where 1 is low, 100 is normal, and 255 is high.
- Start pitch <int 1-255>
- Spin up time
- Spin down time
- How long to spend spinning pitch up/down at the start/end of playback, and what pitch to start at. Default is no spinning.
- Dynamic Presets
- Various DSP effects that can be applied.
- LFO type
- Type of Low Frequency Oscillation to employ.
- Off (default)
- Square Wave (alternate between low and high)
- Triangle Wave (crossfade between high and low)
- LFO rate
- How frequently the LFO effect repeats itself.
- LFO modulation - pitch
- Affects the sound pitch or vibrato. Higher numbers change the pitch more - warbling singers use little, police sirens use a lot.
- LFO modulation - volume
- Affects the volume of the sound, causing it to "pulse." Similar to tremolo. At a really high rate, this can make the same effect as talking through fan blades.
- Incremental Spinup Count
- Appears to be a intended to increase pitch in time with
ToggleSoundinputs, but:Bug: Non-functional.
- Entity Scripts
<scriptlist>(New with Left 4 Dead 2)
- Space delimited list of VScript files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions.
- Script think function
<string>(New with Left 4 Dead 2)
- Name of a function in this entity's script which will be called automatically every 100 milliseconds (ten times a second) for the duration of the script. It can be used to create timers or to simulate autonomous behavior. The return value (if present) will set the time until the next call. Note:Try to avoid expensive operations in this function, as it may cause performance problems.
- 1: Play everywhere
- 16: Start Silent
- The map will start without this sound playing. Enabled by default. Bug: Looping sounds that do not start silent cannot be controlled!
- 32: Is NOT Looped
- Changes how the
ambient_generichandles stopping and starting playback. It won't stop a sound that loops from looping, but it is still very important to set it to the right value. You might not be able to stop and/or start the sound if it isn't!Bug: Having this option ticked while using a looped sound WILL prevent you from controlling it!
- Sets the sound pitch, expressed as a range from 1 to 255, where 100 is the sound's original pitch. Bug: Pitch will play the sound without informing the rest of the entity. This makes looping sounds unstoppable! It is speculated that the input is supposed to change the pitch at which the ambient_generic plays its sound when prompted by other inputs, not play it by itself.
- Starts the sound.
- Stops a looping sound. Does not stop a non-looping sound: this is intentional, and can be changed with C++. However, a non-looping sound can be stopped by using the Volume input with a value of 0.
- Toggles a looping sound between playing and stopped. Behaves like
PlaySoundif the sound is unlooped.
- Plays the sound at a volume from 0 to 10, where 10 is the loudest. Bug: Volume will play the sound without informing the rest of the entity. This makes looping sounds unstoppable! It is speculated that the input is supposed to change the volume at which the ambient_generic plays its sound when prompted by other inputs, not play it by itself.Bug: Setting the volume to 0 will cause the sound to pause, rather than play silently.
- Fades the sound up to full volume over a specified number of seconds, with a range from 0 to 100 seconds. Bug: Non-functional, except in Portal 2.
- Fades the sound to silence over a specified number of seconds, with a range from 0 to 100 seconds. Bug: Will bring the sound up to full volume (i.e. 10) before beginning to fade it.
- Removes this entity and any entities parented to it from the world.
- Functions the same as
Kill, although entities with a large number of children are killed marginally faster.
- Evaluates a keyvalue/output on this entity. It can be potentially very dangerous, use with care.
<output name> <targetname>:<inputname>:<parameter>:<delay>:<max times to fire, -1 means infinite>
- Fire the
OnUseroutputs; see User Inputs and Outputs.
- Same as a player invoking +use; may not do anything. Can also be invoked by creating an output that does not specify an input.
This input is not included in Valve's FGDs.
<script>(New with Left 4 Dead 2)
- Execute a VScript file from disk, without file extension. The script contents are merged with the script scope of the receiving entity.
<string>(New with Left 4 Dead 2)
- Execute a string of VScript source code in the scope of the entity receiving the input. String quotation may be needed when fired via console. Bug: In , the code is executed in the script scope of the entity that fires the output, not the one receiving the input.Warning: Never try to pass string parameters to a script function with this input. It will corrupt the VMF structure because of the nested quotation marks, which then must be removed manually with a text editor.
<string>(New with Left 4 Dead 2) !FGD
- Execute a VScript function in the scope of the receiving entity. Note:This input is missing from some games FGD files.
<origin>(New with Alien Swarm) !FGD
- Set this entity's origin in the map. Note:This input is missing from some games FGD files.
<angles>(New with Alien Swarm) !FGD
- Set this entity's angles in the map. Note:This input is missing from some games FGD files.
- These Outputs each fire in response to the firing of the like-numbered
FireUser4Input; see User Inputs and Outputs.
OnKilled(New with Left 4 Dead)
- This Output fires when the entity is killed and removed from the game.
- Adjust ambient_generic volume higher than 10 (Advanced Mapping Tutorial)
- env_soundscape - used to play many ambient/background sounds from a single entity via a script
- Looping a Sound - which requires modifying the actual .wav file
- Setting up ambient_generics in Counter-Strike: Source using logic_auto - a substitute for creating a proper env_soundscape.