Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Timed Sitting, auto stand up.

InuYasha Meiji
Half Demon
Join date: 14 Mar 2005
Posts: 127
01-29-2006 10:53
I was hoping someone could really help me in this. I just recently learned to make animations. I need help with a script that will let me choose to sit, animate my AV, and when the animation is over, get back up on its own, and if they wish choose to sit again.

As it is now, once you have sat, and the animation is over, you have to right click and stand, before you can repeat your animation. I would just like to click sit again. Is there a way to make a timer sit?? Like sit for 6 seconds then get up on it's own?

That's would be great. Thanks if you can help.

-InuYasha Meiji (this one will reply to me and not my wife.)
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
01-29-2006 11:10
Sure. Let me whip one up :)


CODE
string theAnim = "sit_ground"; // This is the name of the animation you want.
float time_to_stand = 3.0; //How long to let them sit.
string sitText = "Meditate"; // When someone wants to sit here, this replaces that "Sit" text in the pie menu
vector sittingPosition = <-0.1,0,0.7>; //This is the position. X, Y, Z This is what you need to mess with to get the right spot.

//Some globad variables
key agentKey = NULL_KEY;
integer permissionResult = FALSE;

// Initialize
init()
{
llSetTimerEvent(0.0);
llSetSitText(sitText);
llSitTarget(sittingPosition,<0,0,0,1>);
}

default
{
state_entry()
{
init();
}

on_rez(integer times)
{
init();
}

changed(integer change)
{

if (change & CHANGED_LINK)
{
key agent = llAvatarOnSitTarget();
if ( agentKey == NULL_KEY && agent != NULL_KEY ) // if there's someone on the sit target, and we don't already have a sitter, it's a new sit.
{
agentKey = agent;
llRequestPermissions(agentKey,PERMISSION_TRIGGER_ANIMATION);
}
else if ( agentKey != NULL_KEY && agent == NULL_KEY) // if we don't have someone on the sit target, but DO have a "sitter", they stood.
{
if (permissionResult)
{
llStopAnimation(theAnim);
}
llResetScript();
}
}
}

run_time_permissions(integer value)
{
if (value == PERMISSION_TRIGGER_ANIMATION)
{
permissionResult = TRUE;
llStopAnimation("sit");
llStartAnimation(theAnim);
llSetTimerEvent(time_to_stand); // start the countdown to standing up
}
}

timer()
{
llSetTimerEvent(0.0);
if (permissionResult) llStopAnimation(theAnim);
llUnSit(agentKey);
llResetScript();
}
}
_____________________
InuYasha Meiji
Half Demon
Join date: 14 Mar 2005
Posts: 127
Thanks
01-29-2006 11:24
Thanks so much, this will help me so much. I'll try it out now. I didn't expect to get an answer so soon. I am very happy you took the time.

-InuYasha.