Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sensors: Follow anyone except Owner

Miles05 Reitveld
Kitsune Mage
Join date: 24 Apr 2005
Posts: 28
11-06-2005 08:07
*waves* Hello! How does one go about having an object follow another avatar with the exception of the owner? This is as close as I could get....

CODE

default
{
state_entry()
{
llSetPos(llGetPos() + <0,0,2>);
vector pos = llGetPos();
llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, FALSE);
llSetStatus(STATUS_PHYSICS, TRUE);
llSleep(0.1);
llMoveToTarget(pos,0.1);
key id = (llGetOwner());
llSensorRepeat("",id,AGENT,90,2*PI,.25)
; }

collision_start(integer art)
{
llPlaySound("balloon",1);
llSleep(2);
llDie();
}

sensor(integer total_number)
{
vector pos = llDetectedPos(0);
vector offset =<0,0,0>;
pos+=offset;
llMoveToTarget(pos,.2);
}
}
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
11-06-2005 09:10
Here you go...should work.

CODE


key detectedkey;
key id;

vector pos;
vector offset;

default
{
state_entry()
{
llSetPos(llGetPos() + <0,0,2>);
pos = llGetPos();
llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, FALSE);
llSetStatus(STATUS_PHYSICS, TRUE);
llSleep(0.1);
llMoveToTarget(pos,0.1);
id = (llGetOwner());
llSensorRepeat("",NULL_KEY,AGENT,90,2*PI,.25)
; }

collision_start(integer art)
{
llPlaySound("balloon",1);
llSleep(2);
llDie();
}

sensor(integer total_number)
{
detectedkey = llDetectedKey(0);
if(detectedkey != id)
{

pos = llDetectedPos(0);
offset =<0,0,0>;
pos+=offset;
llMoveToTarget(pos,.2);

}
}
}

_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Gaz Hornpipe
Registered User
Join date: 29 Sep 2005
Posts: 36
11-06-2005 11:59
Also.. to filter out collisions with the owner use this: llCollisionFilter("", llGetOwner(), FALSE);
Miles05 Reitveld
Kitsune Mage
Join date: 24 Apr 2005
Posts: 28
11-06-2005 15:09
Thank you very much! *smiles foxily*