Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

problems with animations in a seat

Robin Peel
Registered User
Join date: 8 Feb 2005
Posts: 163
06-06-2006 16:08
I've been trying to get this script to use a sit animation inside it with no success. I know that its something simple that I'm not seeing.
Its in a little vehicle, I have an animation in the seat, when I sit I'm trying to use that animation. But for some reason its not working. I'm not very good with these large scripts.
Can somebody please help me?

CODE

rotation sit_rot;
key pilot;
integer power;
integer listenindex;
string animation; //part of animation
vector position = <-0.25, 0.25, 0.3>;//part of animation


default
{
state_entry()
{
animation = llGetInventoryName(INVENTORY_ANIMATION, 0);//part of animation

llSetStatus(STATUS_PHYSICS, FALSE);
llListenRemove(listenindex);
llSetTimerEvent(0.0);
llStopSound();
llPreloadSound("UUID");
llPreloadSound("UUID");
llPreloadSound("UUID");
llPreloadSound("UUID");
llPreloadSound("UUID");
llSetSitText("Board");
llSetCameraEyeOffset(<-6, 0.0, 3.0>);
llSetCameraAtOffset(<0.0, 0.0, 1.75>);
pilot = NULL_KEY;
power = FALSE;
sit_rot = llRotBetween(<0.0, 0.0, 1.0>, llVecNorm(<0.0, 0.0, 0.0>));
llSitTarget(position, sit_rot);
llMessageLinked(LINK_SET, 0, "pilot", NULL_KEY);
llMessageLinked(LINK_SET, 0, "display off", NULL_KEY);
}

on_rez(integer sparam)
{
llResetScript();
}

changed(integer change)
{
key sitting = llAvatarOnSitTarget();
if (change == CHANGED_LINK) {
key avatar = llAvatarOnSitTarget();
if (sitting != NULL_KEY) {
llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION); //part of animation

if (sitting != llGetOwner()) {
llMessageLinked(LINK_SET, 0, "eject", sitting);
llWhisper(0, "Unauthorized Access");
} else {
if (pilot == NULL_KEY) {
pilot = sitting;
llWhisper(0, "Pilot " + llKey2Name(sitting));
llTriggerSound("UUID", 1.0);
llMessageLinked(LINK_SET, 0, "display on", NULL_KEY);
llListenRemove(listenindex);
listenindex = llListen(4, "", sitting, "");
}
}
} else if (pilot != NULL_KEY) {
llSetStatus(STATUS_PHYSICS, FALSE);
pilot = NULL_KEY;
llListenRemove(listenindex);
llMessageLinked(LINK_SET, 0, "unsit", NULL_KEY);
llMessageLinked(LINK_SET, 0, "display off", NULL_KEY);
if (power) {
power = FALSE;
llWhisper(0, "Powering Down");
llTriggerSound("UUID", 1.0);
llSetTimerEvent(0.0);
llTriggerSound("UUID", 0.75);
llStopSound();
llMessageLinked(LINK_SET, 0, "pilot", NULL_KEY);
}
}
}
}

listen(integer channel, string name, key id, string message)
{
message = llToLower(message);
if ((message == "start" || message == "power up") && !power) {
power = TRUE;
llTriggerSound("UUID", 1.0);
llSetTimerEvent(4.0);
llMessageLinked(LINK_SET, 0, "pilot", pilot);
} else if ((message == "stop" || message == "power down") && power) {
power = FALSE;
llWhisper(0, "Powering Down");
llStopAnimation(animation);//part of animation
llTriggerSound("UUID", 1.0);
llSetTimerEvent(0.0);
llTriggerSound("UUID", 0.75);
llStopSound();
llMessageLinked(LINK_SET, 0, "pilot", NULL_KEY);
}
}

timer()
{
llLoopSound("UUID", 0.75);
llSetTimerEvent(0.0);
}

link_message(integer sender, integer num, string str, key id)
{
if (str == "cloak") {
llSetTimerEvent(0.0);
llLoopSound("UUID", 0.1);
llAdjustSoundVolume(0.1);
} else if (str == "decloak") {
llAdjustSoundVolume(0.75);
}
}
}

Thraxis Epsilon
Registered User
Join date: 31 Aug 2005
Posts: 211
06-06-2006 16:16
I don't see where you are setting any animations in that script.

But you will need to stop the sit animation before setting your own.
Robin Peel
Registered User
Join date: 8 Feb 2005
Posts: 163
06-06-2006 16:46
From: Thraxis Epsilon
I don't see where you are setting any animations in that script.

But you will need to stop the sit animation before setting your own.


Darn it, your right. I forgot that part. *blushes a bright red
I'm going to try it now. (works perfect. * blushes even brighter than before)
Thank you Thraxis