Sound maker

Sound maker

Classname: sound_maker
Purpose: sounds on demand
H2 Code: sound.hc
fields required: origin, soundtype, targetnane
These are sounds that are triggered. There are very few of them in the game, but it is easy to write code to get more, using new .wav files, or ones in the .pak's (for getting started in HexenC, head over to the Chop Shop). At least some of the sounds that don't work as sound_ambients can be gotten as triggered sounds with custom variants of sound_maker.

Fields

origin As usual
soundtype One of the following numbers:
  • 1 - bell ringing
  • 2 - organ chords
  • 3 - eerie tones
targetname As usual
delay As usual

a custom entity

Here is some code for an entity, custom_sound_maker, which specifies the sound as a filename in the netname field (see below for the format):
void custom_sound_maker (void)
{
	precache_sound (self.netname);
	self.noise1 = (self.netname);
	
	if (self.delay) 
		self.use = sound_maker_wait;
	else 
		self.use = sound_maker_run;
}
If the above code is compiled and included in progs.dat (see the Chop Shop's section on Hexen 2 editing for basic info on how to do this), the following entity will play the lava sound (that doesn't work as a sound_ambient) when the trigger `lava' is targetted:

classnamecustom_sound_maker
targetnamelava
netnameambience/lava.wav

Note that the sound file name needs both the .wav extension and the subdirectory name (within the `sound' subdirectory of the .pak or game directory directory), using the forward slash rather than the backslash.

The Raven coders seem to make a point of not passing long string arguments to entities, so there's probably some reason not to do it too often. Modifying the sound entities code is relatively easy.

Note that if you target a looped sound, it will run forever.


Back to the list.