SphereCommunity
Is there a way to play sound only to the specified target? - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: General Help (/Forum-General-Help)
+--- Thread: Is there a way to play sound only to the specified target? (/Thread-Is-there-a-way-to-play-sound-only-to-the-specified-target)



Is there a way to play sound only to the specified target? - midikit - 03-21-2019 12:19 AM

Thank you for creating a sphereserver.

If the target playing sound is set to src or another specified target, the sound is played back at a different distance around the specified target.
Is there a way to play sound only on the specified object?
If there is no way to use the current command,
Can I implement something that only plays the sound of the specified object?


RE: Is there a way to play sound only to the specified target? - Coruja - 03-24-2019 04:24 PM

SOUND function always send the sound to all nearby clients by default, so if you want play the sound only on a single client, you must create another function to emulate the sound packet and send it only to this client

Code:
[FUNCTION Sound2]
//ARGN1: sound_id
//ARGN2: object playing the sound
REF1=<ARGN2>
IF !(<REF1>)
  REF1=<SRC>
ENDIF
SENDPACKET 054 B1 W<ARGN1> W0 W<REF1.P.X> W<REF1.P.Y> W<REF1.P.Z>

note that sound volume and position (left/right speaker) is based on X/Y/Z values, so you must set ARGN2 value to use this feature, otherwise the function will play the sound using char X/Y/Z position


RE: Is there a way to play sound only to the specified target? - midikit - 03-24-2019 07:13 PM

Thanks coruja

The SOUND2 function works perfectly Smile
I am using the recorded voice narration in some situations
However, if play the voice narration with the sound command
Clients around the target were inconvenienced by the voice narration being played.

Now the problem is solved with SOUND2 funcion. Big Grin


RE: Is there a way to play sound only to the specified target? - golfin - 03-25-2019 05:50 AM

Interesting, thanks also.

Probably not feasible, but ... Could you use the sound live?