by Spike » Wed Aug 22, 2012 6:49 pm
you can use svc_startsound.
the problem there is that you don't know the sound index of the sound you wish to play.
you can use stuffcmds.
the problem there is that the sound is centered on where you were when the sound started playing. strafe to one side and it sounds really stupid. there are some engines that attempt to fix that directly, and some that have a playsound2 console command instead.
you can use csqc.
woo. dp+fte only.
you can use localsound.
buggy pile of poo that only works in single player as its not networked. only works in telejano.
you can use the regular sound builtin.
give it a really high attenuation, and it will be barely audiable for players further away, yet will follow the player upon which it was started.
attenuation is typically limited to a max value of about 4.
you can use ext_dimension_send.
woo. ftesv only, but won't crash other engines.
example follows. note the attenuation value in this example is 4, as a fallback for other servers that don't recognise dimensions.
//set up multicasts to send to only one player
dimension_send = 512;
self.dimension_see = 512;
//call the sound builtin (which multicasts in fte/qw)
sound(self, CHAN_FOO, "foo.wav", 1, 4);
//reset to defaults, so nothing else breaks
dimension_see = 255;
self.dimension_see = 255;
so yeah, sucks.
.