Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Moving av to object

MIT Bourne
Registered User
Join date: 12 Jan 2007
Posts: 20
02-04-2008 00:57
Hi, does anyone know how to make a av move to a scripted object before performing an animation while standing on it?

As it is now, when i click on the scripted object, my av does the animation at its current spot instead of while standing on the object.

I did try combining it with a teleport script. But it requires me to right click->teleport then left click on the object & click again to give permission start the animation.

I'd prefer just a left click to do the teleporting & another to give animating permission.

Thanks aplenty in advance! =)
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
02-04-2008 05:20
Possibly what's wanted here could be helped by the prim feature "When Left-Clicked", currently settable only in the object editor, being "Sit on object" instead of "Touch/grab". Then, I guess the modified teleport script TPs the avatar to right above the object just with that left touch, does llUnSit(), and gets permission for the animation. (Slightly messy to get out of the animation, though, unless it's just a timeout thing. If "click again to stop" is desired, the animated avatar--who may have wandered off by now--would get pulled back, and even if the script were to clear the llSitTarget, it can't change that "When Left-Clicked" setting, so a normal left click won't generate a touch event.)

There's also the possibility of applying physical forces to the avatar to kinda pull him into the target object, but that approach would only work if the path is unobstructed.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
02-04-2008 10:32
Rather than a "click again to stop", you could run a sensor or keep track of collisions (possibly with llVolumeDetect()) to determine when to stop the anmiation. If the resident teleports away before taking the action necessary to stop the animation, well, they asked for it. Or just keep the resident sitting. Maybe even take their controls and allow them to "move around" while dancing using llSetLinkPrimitiveParams().
MIT Bourne
Registered User
Join date: 12 Jan 2007
Posts: 20
02-04-2008 20:42
Thanks Qie, i've changed the left click option to "sit on object" instead of "touch/grab" & also modified the script to un-sit the av. But the problem now is that there isn't a request for animation permission. So my av doesn't animate.

If i change the left click option back to "touch/grab" while using the modified script, the permission & animation comes as expected, but my av doesn't teleport to the object.

No worries about moving off though. The animation makes the av walk only on the spot. If it helps, the script i'm using is below:

default
{


state_entry()
{
llSetText("Teleportation test",<1.0,1.0,1.0>,1.0);
llSetTextureAnim(ANIM_ON | SMOOTH | LOOP , ALL_SIDES, 1, 1, 1, 1, 0.45);
llSay(0, "Hello, Avatar!";);
}

touch_start(integer i)
{
llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION);
llSitTarget(<0.0, 0.0, 1.0>, ZERO_ROTATION);
//llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION);
}

changed(integer change) //event changed
{
if (change & CHANGED_LINK)
{
key user = llAvatarOnSitTarget();
llUnSit(user); //unsit the avatar on the sit target
}
}

run_time_permissions(integer perm)
{
if (perm & PERMISSION_TRIGGER_ANIMATION)
{
llStartAnimation("Walk Slow";);
llOwnerSay("animation will end in 10 seconds";);
llSetTimerEvent(10.0);
}
}

timer()
{
llSetTimerEvent(0.0);
llStopAnimation("Walk Slow";);
}
}