Ambient Generics - How They Work

PREREQUISITE INFORMATION

The following information / tutorial assumes you are comfortable working in WorldCraft with entities as well as have a working knowledge of where to place and how to access .wav files from HL entities


AMBIENT GENERICS UNMASKED

Tired of not knowing why or how the ambient_generic entity works in Half-life? Want to know why some times a sound will loop and other times it won't? If you answered "yes" to either of these questions, read on

The FGD that defines the flags for entities in worldcraft has some confusing flags in the ambient_generic entity.

START SILENT Stops wav from playing at begining of level. Equivlent of a light that is off at start of level.
IS NOT LOOPED This flag really doesn't mean this at all! The flag should read "NOT TOGGLED" .

By default (without this checked) the ambient generic will toggle on the first time it is targetted and turn off when targetted again, just like a light entity. When NOT TOGGLED (IS NOT LOOPED) is CHECKED, it just fires, that is plays. You target it, it plays, target again plays again. If you play it a second time before the first instance finishes, it cuts the original off and starts from the begining again. NOT TOGGLED also implies START SILENT.Note: when IS NOT LOOPED checked, the START SILENT is ignored.


SO HOW DO I LOOP?

You use GOLDWAVE (or some other .wav editor) to insert a START CUE/MARKER in the file. Halflife will ALWAYS loop a wav with a cue in it. The game will play the .wav from start to finish, then repeat from the first cue in the file to the end, forever. No switch settings prevent a cued .wav from looping. This means, all cued .wavs always loop!


HOW TO SET UP THE FLAGS (examples)

TYPE FLAGS RESULTS
WAV file without QUEs IS NOT LOOPED CHECKED Wav plays once each time targeted
START SILENT N/A
IS NOT LOOPED UNCHECKED Wav plays once upon first target (ambient on) Nothing happens upon second target (ambient off) ...trigger pattern repeats
START SILENT CHECKED
IS NOT LOOPED UNCHECKED Upon start of map WAV plays (ambient is on) Nothing happens upon first target (ambient off) Wav plays once upon second target (ambient on) ...trigger pattern repeats
START SILENT UNCHECKED
WAV with QUEs

(Regardless of flags all will play through once then loop continuously from cue point to end of wav file. )
IS NOT LOOPED CHECKED Upon target Wav plays continuously. upon each subsequent targetting the play is interrupted and starts from the beginning of the wav file, still looping. Once triggered, cannot be turned off.
START SILENT N/A
IS NOT LOOPED UNCHECKED Wav play continuously upon first target (ambient on) Wav stops playing (ambient off) ...trigger pattern repeats
START SILENT CHECKED
IS NOT LOOPED UNCHECKED Upon start of map WAV plays continuously (ambient is on) Wav stops playing upon first target (ambient off) Wav plays continuously upon second target (ambient on) ...trigger pattern repeats.
START SILENT UNCHECKED

I (Royalef) have tested all of the above and they are 100% accurate.
To whomever modifies the FGDs, it really should be called NOT TOGGLED instead of IS NOT LOOPED.


CREDITS

The above information originated as a post on the DoE Forums and
was gleened from tedious testing in WorldCraft and HL by Royalef, a respected member of the DoE.
Conversion of Royalef's findings to this tutorial by Snowdog


[WTF?]Snowdog
Maintainer, Department of Engineering - Leader, Clan[WTF?]
This tutorial uses Cascading Stylesheets that contain properties that may or may not be be compatible with older browsers. If you are experienceing visual problems while viewing this page we suggest you obtain a newer browser version. These styleshets used work fine with IE 5+ and Netscape 6+ and should work for any other browser that supports the CSS1 standard.