Will play a sound that is inside prim with script when avatar walks onto object.
// Sound must be in the object's inventory or it will not work.
// First sound in inventory will be used if more than 1
integer delay = 5; //how many seconds to wait after playing sound before it can be triggered again
default
{
on_rez( integer sparam )
{
llResetScript();
}
state_entry()
{
llOwnerSay("This object must not be set to phantom or it will not work.");
}
collision_start(integer total_number)
{
llPlaySound(llGetInventoryName(INVENTORY_SOUND,0), 1);
llSleep(delay); //keeps it from playing sound over and over
}
}
|