Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help With Move To Target Please???

BioMolecular Chemistry
Registered User
Join date: 16 Apr 2008
Posts: 24
01-01-2009 01:18
Hi I've made a gadget that I use to bring my friends to me, however because I'm using move to target, I can't bring any friends that are more than 64m away from me. Someone said that if I normalise the distance or something then it will work for greater distances. This bit is beyond my scope. Does anyone know how to do this please???

Here is my script as it stands:

key aquiredFollowTarget = NULL_KEY;
integer ztarget;

default
{
state_entry()
{
llMessageLinked(LINK_THIS, 0, "MSGStopFollowing", aquiredFollowTarget);
aquiredFollowTarget = NULL_KEY;
llResetOtherScript("Friend Chooser";);
llSetDamage(100);
llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z, FALSE);
llSetStatus(STATUS_PHYSICS, TRUE);
llSetStatus(STATUS_PHANTOM, FALSE);
llSleep(2.0);
llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z, FALSE);
llStopSound();
//llSetTimerEvent(10.0);
llTriggerSound("4894f16d-6a0f-7799-e841-e3c0a179da8e", 1.0);
llSensor("", llGetOwner(), AGENT, 128, TWO_PI);
}

sensor(integer total_number)
{
ztarget = llTarget(llDetectedPos(0), 3.5);
llMoveToTarget(llDetectedPos(0), 1.0);
}

at_target(integer number, vector targetpos, vector ourpos)
{
state stop;
}
}

state stop
{
state_entry()
{
llTargetRemove(ztarget);
llSetStatus(STATUS_PHYSICS, FALSE);
llSetStatus(STATUS_PHANTOM, TRUE);
llMessageLinked(LINK_THIS, 0, "MSGStopFollowing", aquiredFollowTarget);
aquiredFollowTarget = NULL_KEY;
llSetScriptState("Scanner 2222", FALSE);
llSetScriptState("Scanner 1", TRUE);
llMessageLinked(LINK_THIS, 0, "MSGStopFollowing", aquiredFollowTarget);
aquiredFollowTarget = NULL_KEY;
llSay(0,"Hello...";);
llResetOtherScript("Stop";);
}
}
Escort DeFarge
Together
Join date: 18 Nov 2004
Posts: 681
01-01-2009 02:32
If i remember right you have to use llSetTarget and llRemoveTarget *as well* for this to work right...

hth
/esc
_____________________
http://slurl.com/secondlife/Together
Innula Zenovka
Registered User
Join date: 20 Jun 2007
Posts: 1,825
01-01-2009 09:41
If you take a look at http://lslwiki.net/lslwiki/wakka.php?wakka=llMoveToTarget you will find a nifty work-round for the (approx) 60 metre cap on llMoveToTarget.
Faust Vollmar
llSetAgentSanity(FALSE);
Join date: 3 Feb 2007
Posts: 87
01-01-2009 17:23
The looped llPushObject call workaround has not been functioning for me since the 1.24.10.106829 server update.
I don't move at all and my script gets locked in the loop, now.
Faust Vollmar
llSetAgentSanity(FALSE);
Join date: 3 Feb 2007
Posts: 87
01-01-2009 17:42
I feel stupid for that one, was a misplaced semicolon...

The loop still works, though I suggest using apply impulse over push object if you can.

---

Anyway, I've noticed llMoveToTarget has a *very* large amount of trouble attempting to move through objects while traveling on the Z Axis.

Careful of that one - I've been trying to find a repair for the problem to no avail.

EDIT: This is ofcourse a problem only for Avatar Attachments, not objects that can be phantomed.
Soen Eber
Registered User
Join date: 3 Aug 2006
Posts: 428
01-15-2009 20:26
You can combine llMoveToTarget with non-physical movement with a bit of coordination. I havea floater toy I've been developing and if it gets stuck I just trigger a command that runs it through Strife's warp position code.
Faust Vollmar
llSetAgentSanity(FALSE);
Join date: 3 Feb 2007
Posts: 87
01-15-2009 21:22
Yeah, though that doesn't work when using MoveToTarget on an Avatar, would need some complex extra pushes or something.
(Still haven't solved the Z Axis + Object = Stuck issue, heh.)

I'm not sure if Bio is moving the Avatar directly, but it seems to be.