Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

lock script help.

Aniam Ingmann
llOwnage(float pwnage);
Join date: 22 Oct 2005
Posts: 206
10-20-2007 17:56
Okay so I wrote this script to lock myself, but it seems to not quite work great against orbiters. I've used tools that seem to define a vector point (my pos at the time) and continually uses that point and loops to go to it. Mine, on the other hand, doesn't do that; it just locks to the position that i'm at, and if there's a quick jump in my position, it locks to that position.
What would I do to make it loop and define my position as a hard, non-changing vector?
From: someone

CODE

vector target;

moveto(vector targ)
{
llMoveToTarget(llGetPos(), 0.1);
}


default
{
on_rez(integer start_param)
{
llResetScript();
llStopMoveToTarget();
}
attach(key id)
{
llResetScript();
}
state_entry()
{
llListen(2, "", llGetOwner(), "");
}

listen(integer c, string name, key id, string msg)
{
if (msg == "reset")
{
llResetScript();
}
if (llToLower(msg) == "lock")
{
llOwnerSay("Locking...");
llSleep(0.5);
llOwnerSay("Locked to:"+(string)llGetPos()+".");
state lock;
}
if (llToLower(msg) == "unlock")
{
llOwnerSay("Unlocking...");
llSleep(.5);
llOwnerSay("Unlocked");
llStopMoveToTarget();
llResetScript();
}
}
}

state lock
{
state_entry()
{
llMinEventDelay(0.1);
target = llGetPos();
llTarget(target, 0.1);
moveto(target);
}

not_at_target()
{

moveto(target);
}

at_target(integer tnum, vector tpos, vector opos)
{
llMoveToTarget(llGetPos(), 0.1);
state default;
}

}

_____________________
From: someone

Don't worry, Aniam is here!
- Noob
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
10-20-2007 21:28
llMoveToTarget doesn't have enough strength to prevent you from being orbited, no matter how you're using it. All you can really do is sit down, unfortunately.
_____________________
Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
10-20-2007 21:41
Just out of curiosity Aniam. Is this for use in combat areas? And has anyone tried the NPV + phase(script library) in a combat zone yet?

I was playing with it last night and it makes it so that your location according to sensor is 110 meters from your real location and you can drop down into the ground to -83 meters.
"You" are basically just a shell that is phantom.

Haven't ever been to a combat zone and not really interested but that was the 1st thing that went through my mind when I tried it last night :)
_____________________
I (who is a she not a he) reserve the right to exercise selective comprehension of the OP's question at anytime.
From: someone
I am still around, just no longer here. See you across the aisle. Hope LL burns in hell for archiving this forum
Day Oh
Registered User
Join date: 3 Feb 2007
Posts: 1,257
10-20-2007 21:45
Your problem is that llMoveToTarget holds your avatar in place, but when you get knocked you're stopping llMoveToTarget and starting a new one at the new position...
_____________________
Aniam Ingmann
llOwnage(float pwnage);
Join date: 22 Oct 2005
Posts: 206
10-20-2007 22:43
Yeah but how do I make the script define the vector right when I say "/2 lock" and never change; just constantly have a loop running of me moving to that saved vector?
_____________________
From: someone

Don't worry, Aniam is here!
- Noob
Tyken Hightower
Automagical
Join date: 15 Feb 2006
Posts: 472
10-21-2007 00:54
From: Aniam Ingmann
Yeah but how do I make the script define the vector right when I say "/2 lock" and never change; just constantly have a loop running of me moving to that saved vector?

That's not going to help you. The reason llMoveToTarget doesn't work against being orbited is due to its distance limitation of 64.0 meters. Most of the time when you're pushed or orbited, it's far more than 64.0 meters in a single hit, and the physics glitches can instantly nail you to the wall, the maximum distance up or down on the z-axis.

But anyway, you're better off just setting it once and not looping it. It's the same thing, really.
_____________________