Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Newb question-sit activate

Ticket Nowhere
Registered User
Join date: 12 Aug 2006
Posts: 2
08-13-2006 02:57
I want a sound to play when someone sits on an object. I have PlaySound all set to go, and it works when I touch the object. How do I make it happen upon sitting?
nand Nerd
Flexi Fanatic
Join date: 4 Oct 2005
Posts: 427
08-13-2006 05:38
From: http://secondlife.com/badgeo/wakka.php?wakka=llAvatarOnSitTarget
CODE
default {
state_entry() {
llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION); // needed for llAvatarOnSitTarget to work
// Note that if both the vector and the rotation are zero,
// the SitTarget is removed instead of set and the following will not work:
}

changed(integer change) { // something changed
if (change & CHANGED_LINK) { // and it was a link change
llSleep(0.5); // llUnSit works better with this delay
if (llAvatarOnSitTarget() != NULL_KEY) { // somebody is sitting on me
llSay(0, "Get off!");
llUnSit(llAvatarOnSitTarget()); // unsit him
}
}
}
}


and instead of the llUnSit... you replace it with your llPlaySound. Also you can remove the llSleep which isn't needed, nor the llSay (except perhaps for debugging).
_____________________
www.nandnerd.info
http://ordinalmalaprop.com/forum - Ordinal Malaprop's Scripting Forum
Ticket Nowhere
Registered User
Join date: 12 Aug 2006
Posts: 2
08-13-2006 07:43
Thanks a bunch