Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Shell Ejection - Sound problem

Nerolus Mosienko
Registered User
Join date: 3 Aug 2006
Posts: 145
01-25-2009 18:58
Hey all!

I've been hard at work trying to script my very first gun - so far so good. I've had one small problem though:

When the shell is ejected from the gun, the sound will not play! When I drop the shell on the ground and copy it over, it plays just fine. Here is the script inside the shell:

CODE

default
{
state_entry()
{
llTriggerSound("UUID OF MY SOUND GOES HERE",1);
llSleep(10);
llDie();
}
}


I've also tried llPlaySound, with and without llSleep, with and without llDie (using temporary). I've also tried having the shells make the sound when they come into contact with another object. This works fine, but leads to sound spam when the shells hit eachother on the ground (I love this method, it makes the most sense - but the sounds are just too spammy that way).

Any help is greatly appreciated, thanks!
RobbyRacoon Olmstead
Red warrior is hungry!
Join date: 20 Sep 2006
Posts: 1,821
01-25-2009 19:09
The problem is that you are expecting the script to reset when the shell is rezzed, which does not happen. It does happen on a shift-copy, which is why it works then.

If you change the rezzing code to provide a non-zero value as the param value in llRezObject, the following code will work:
CODE

default
{
state_entry()
{
}

on_rez( integer param )
{
if( param )
{
llTriggerSound("UUID OF MY SOUND GOES HERE",1);
llSleep(10);
llDie();
}
}
}


I just provide the parameter so that I can drop stuff on the ground and work on it without it dying in 10 seconds :)

.
_____________________