Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sit Problems

Hawk Mendicant
www.hawkuk.com
Join date: 6 Jun 2005
Posts: 30
08-01-2005 09:29
I'm having problems with a sit animation i've used on a sofa I created. I've included the animation and the script in the cushions rather than using pose balls.

It all works fine when you sit on the cushion on it's own. However when I link the parts of the sofa together, the animation doesn't stop when i select 'Stand Up'

I'm sure I can't be the only person who's had this problem. Any suggestions for a workaround?

Thanks,
Hawk
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
08-01-2005 10:03
The script is making bad assumptions. If you'll post it I can be more specific, but basically the script is assuming it's going to be the one thing in the furniture dealing with an avatar sitting. Since you have more than one in the object, this assumption proves false.

It's losing the avatar key or getting the wrong one, or not working with permissions correctly.

Again, if you post the script I can be more specific. :)
_____________________
Hawk Mendicant
www.hawkuk.com
Join date: 6 Jun 2005
Posts: 30
08-01-2005 11:15
Thanks for your reply. This is what i'm using at the moment

CODE
default
{
state_entry()
{
llSitTarget(<-0.83, -0.0, -0.45>,llEuler2Rot(<PI_BY_TWO,PI + PI_BY_TWO,0>));;
}

changed(integer change)
{
if ( change & CHANGED_LINK )
{
llSleep(0.5);
if (llAvatarOnSitTarget() != NULL_KEY)
{
llRequestPermissions(llAvatarOnSitTarget(),PERMISSION_TRIGGER_ANIMATION);
integer perm = llGetPermissions();
if ((perm & PERMISSION_TRIGGER_ANIMATION) == PERMISSION_TRIGGER_ANIMATION)
{
llStopAnimation("sit");
llStartAnimation("twiddle");
}
}

}
}


}
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
08-01-2005 11:36
Here's my changes.
CODE
key sittingav = NULL_KEY; // To track if we're working with an av
integer perms = FALSE; // to track if we have permissions

default
{
state_entry()
{
llSitTarget(<-0.83, -0.0, -0.45>,llEuler2Rot(<PI_BY_TWO,PI + PI_BY_TWO,0>));
sittingav = NULL_KEY;
perms = FALSE;
}

changed(integer change)
{
if ( change & CHANGED_LINK )
{
key av = llAvatarOnSitTarget();
if (av != NULL_KEY && sittingav == NULL_KEY) // The link changed, there's av on the sit target, and we're not already working with an av
{
llRequestPermissions(av, PERMISSION_TRIGGER_ANIMATION ); // Make sure we're allowed to change the anim
sittingav = av; // store the av key, we're now working with an av.
}
else if ( av == NULL_KEY && sittingav != NULL_KEY ) // had an av, now it's gone.
{
if (perms) llStopAnimation("twiddle"); // If we have perms, we changed the anim and now we let go.
llResetScript(); // fresh start!
}
}
}

run_time_permissions(integer perm)
{
if ( perm & PERMISSION_TRIGGER_ANIMATION )
{
llStopAnimation("sit");
llStartAnimation("twiddle");
perms = TRUE; // tracking easily if we have perms.
}
}
}
_____________________
Hawk Mendicant
www.hawkuk.com
Join date: 6 Jun 2005
Posts: 30
08-01-2005 12:27
Jillian you're wonderful. That works a treat! Thanks.