Jump to content

Can sound play only in OWNERS viewer (not everyones)?


You are about to reply to a thread that has been inactive for 1098 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

If it's in a HUD, only the wearer can hear it.

 

EDIT: Another hack / workaround would be to play the sound at a very low volume and position the sounding object as close to the agent's camera as possible, although that requires you know where their camera is, which you'll need permissions for.

Edited by AlduousMcBurlington
Link to post
Share on other sites

Certainly, play it in a HUD.  llPlaySound will only be heard by the person wearing the HUD.  llTriggerSound in a HUD will be heard by everyone.  Your HUD script doesn't need anything more complicated than a listen event that responds to a trigger from whatever is managing your system.  So, you have a script in some object on the ground that says:
 

default

{

    collision_start(integer num)

    {

        llRegionSayTo(llDetectedKey(0),-12345,"DING");

    }

}

And you have a HUD that listens:
 

default

{

    state_entry()

    {

        llListen(-12345,"","","");

    }

    listen (integer channel, string name, key id, string message)

    {

        if (message == "DING")

        {

            llPlaySound("Ding",0.5);  //"Ding" is a sound in the HUD's inventory

        }

    }

}

You bump into the object and you hear the sound.  Anyone not wearing the HUD hears nothing.

   

 

  • Like 1
Link to post
Share on other sites

and as a side note. if you don't want to give the sound to the user. you can use UUIDs. You can hard code them into the hud script, or as in rolig's example, pass the uuid via chat instead of the sound name

(that's assuming you have full perms of the sound. I get annoyed with creators that sell things "full perm" but then actually make them no mod so you can't change the name, like an animation or sound)

Edited by Ruthven Willenov
Link to post
Share on other sites
  • 1 year later...

I tried to do as the example script above for a ranged weapon, so.....the arrow sends the llRegionSayTo to the weapon and then the weapon plays the sound. Problem is....the weapon is not a HUD so the sound goes to everyone not only the OWNER.

My question is if there's another way in order to work without a HUD. I ask because there are weapons that have this feature and also don't have a HUD.

Thank you for your attention....i am anxiously waiting for yout answer......

Link to post
Share on other sites

No, although you can always restrict the range of a sound by setting it to lower volume.  Intensity drops off as the square root of distance, so a soft sound will only be heard if you are very close to the emitter.

Link to post
Share on other sites

i'll check that...i assume you mean using the llPlaySound......and weapon as a HUD but rigged to your hand for example, right?

Respect to llSetSoundRadius there¡s a bug reported many times in SL it doesn't work at all......

 

Edited by Nimus Firehawk
Link to post
Share on other sites
28 minutes ago, Nimus Firehawk said:

i'll check that...i assume you mean using the llPlaySound......and weapon as a HUD but rigged to your hand for example, right?

Respect to llSetSoundRadius there¡s a bug reported many times in SL it doesn't work at all......

 

Sorry, I linked the wrong one.

http://wiki.secondlife.com/wiki/LlTriggerSoundLimited

And yes, sounds played by a HUD attachment via Play/TriggerSound are only heard by the wearer. The fact that some links are rigged to other bones does not change that behavior as far as I know. 

Link to post
Share on other sites

how can I set llTriggerSoundLimited to the owner only? the coordinates i never really understood....could you help me on that? I'm affraid doing a rig for the weapon will not result in the sthetics i look for...the weapon will always be in an unmobile position an woun't accept user adjustmens...and so would behave with different animations (it would result strange positions)....

 

Link to post
Share on other sites
4 hours ago, Nimus Firehawk said:

how can I set llTriggerSoundLimited to the owner only? the coordinates i never really understood....could you help me on that? I'm affraid doing a rig for the weapon will not result in the sthetics i look for...the weapon will always be in an unmobile position an woun't accept user adjustmens...and so would behave with different animations (it would result strange positions)....

The sound created by that function is only heard by avatars that are inside of the box defined by the two positions at the time the sound starts.

If you use "llTriggerSoundLimited(sound, volume, llGetPos(), llGetPos());" only the wearer can possibly be within that area. Anyone else -- even if they're bumping right against the wearer -- can't get close enough to be inside of the same position aside from a few very specific cases (like if both avatars are sitting on objects and are placed in the exact same position that way).

The only downside there is that it's TriggerSound, not PlaySound, so the sound will "fall behind" a moving avatar instead of staying attached to them no matter where they go.

Edited by Wulfie Reanimator
Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 1098 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...