Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

When attach object activate animation

Galtran Hashimoto
Registered User
Join date: 19 Aug 2006
Posts: 5
03-15-2007 09:28
I want a simple script for Activate an animation when I attach an object, and when I dettach the animation stop.

Anyone can help me?
Dnel DaSilva
Master Xessorizer
Join date: 22 May 2005
Posts: 781
03-15-2007 09:35
Here you go, open source, please leave the props to Catherine in there :)
All you have to change is the amimation variable.

CODE

// Basic Animation / Attachment 1.0
// Catherine Omega Heavy Industries

string gAnimName = "anim"; // what animation to play?

default
{
state_entry()
{
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); // ask the owner for permission to trigger animations
llStartAnimation(gAnimName);

}

on_rez(integer param)
{
llResetScript(); // reset the script as soon as it starts.
}

attach(key id)
{
integer perm = llGetPermissions();

if (id != NULL_KEY) // make sure we're actually attached.
{
if (! (perm & PERMISSION_TRIGGER_ANIMATION)) // remember to use bitwise operators!
{
llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); // request permissions from the owner.
}
}
else
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation(gAnimName); // stop the animation

}
}
}
}
_____________________
Xessories in Urbane, home of high quality jewelry and accessories.

Coming soon to www.xessories.net

Why accessorize when you can Xessorize?