The three virtues of a programmer: Laziness, Impatience, and Hubris. – Larry Wall
In UT, there are several methods used to have sounds in a map that can be triggered. (Nobody has taken the time to write about it for UT2003 yet!)
For one-shot sounds, the best method is probably the SpecialEvent actor, although it doesn't allow volume control. For looping sounds, things are a little more complicated: the problem is making the sound stop.
The methods are:
DynamicAmbientSound (description needed)
TriggerLight can be set so a sound is heard when activated, but no light is produced. This works fine with looping sounds.
- Lighting -> LightBrightness to a non-zero number. This will set the maximum volume for the sound
- Lighting -> LightType to LT_Steady
- Lighting -> LightRadius to 0 – this is so the light doesn't show
- Object -> InitialState – Choose a triggering type. See the TriggerLight class page for the list & details
- can be set to stop. This means a looping sound can be used.
- the sound can be made to fade up or down gradually in the same way that TriggerLight can make the light fade.
- the maximum volume can be set with LightBrightness
To make a looping sound play for a set time and then stop, set the TriggerLight's Object.Initial state to "TriggerToggles", and trigger a Dispatcher which in turn triggers the TriggerLight twice – see Trigger Systems for a full explanation of this technique.
A SpecialEvent actor can be used to play a sound. Drawbacks to this method:
- only one-shot sounds work with this; looping sounds will play continually until the player moves out of range of the SpecialEvent.
- the volume can't be specified directly; the sound will play at maximum volume unless you set the TransientSoundVolume property of the SpecialEvent to a value between 0.000 and 1.000. See Actor (UT)/Sound for more info.
- If you forget to set the Object -> InitialState property it will take you bloody ages to work out what you've missed.
This is a dirty trick and best seen in DM-Pressure: the hissing sound made by the pressure chamber is make by two simple cube movers that move in solid space nearby. Their mover sounds provide the noises.
- Advantage: you get not just one sound, but with OpeningSound and OpenedSound you can set start and end sounds. See Mover for more on this.
- Drawback: you can't set the volume of these extra sounds; they're played at maximum.
- Drawback: it's messy