Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

animation on mouseclick when object attached?

Abraham Attenborough
Registered User
Join date: 4 Feb 2007
Posts: 96
08-26-2007 14:53
hi all,
i made an animation for swinging a battleaxe. now i want to play the animation on mouseclick when i attach the axe to my avi. all without combat system damage etc. only playing the animation. anyone has an idea how it works?

greetz
Abe
Day Oh
Registered User
Join date: 3 Feb 2007
Posts: 1,257
08-26-2007 15:14
Give this a shot, Abraham! (: Here at the top, change "backflip" to the name of your axe-swinging animation.


string myAnimation = "backflip";

default
{
attach(key id)
{
if(llGetAttached())
{
llRequestPermissions(llGetOwner(), PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION);
}
}

run_time_permissions(integer perm)
{
if(perm & (PERMISSION_TAKE_CONTROLS | PERMISSION_TRIGGER_ANIMATION))
{
llTakeControls(CONTROL_LBUTTON, TRUE, TRUE);
}
}

control(key id, integer held, integer change)
{
if(held & change & CONTROL_LBUTTON)
{
llStartAnimation(myAnimation);
}
}
}
_____________________
Abraham Attenborough
Registered User
Join date: 4 Feb 2007
Posts: 96
08-26-2007 15:26
wow man, thx so much.

its working great^^