ThingSound
From ZDoom Wiki
void ThingSound(int tid, str sound, int volume);
Usage
Plays a sound at the thing with a tid specified (by tid). This is a point sound, so anyone far away will not hear it as loudly. Volume is an integer range from 0 to 127 with 127 being full volume and 0 being muted.
Examples
This script shuts down some kind of generator in the level. The sound source is an object close to the generator so when the player hits the switch to turn it off, they hear the powering down sound coming from the generator.
script 1 (void)
{
// Message to the player
Print(s:"Generator shut down. Rear hatch access granted.");
// Turn off the generator lights
Light_ChangeToValue(1, 144);
Light_ChangeToValue(2, 96);
// Play a shutdown sound from the generator
ThingSound(1, "ambient/poweroff", 127);
}

