Difference between revisions of "Follower script"

From Second Life Wiki
Jump to navigation Jump to search
m ({{LSLC|Library|Follower}})
m (default following distance set at 0.0)
Line 1: Line 1:
This script was extracted from the Batman Follower v1.2, but the following distance was changed from .3 m to .1 m.
This script was extracted from the Batman Follower v1.2, but the following distance was changed from .3 m to .1 m.


To set the following distance (distance between follower and followee), change the value denoted by # in '''llMoveToTarget(pos,#)'''. This script has it set at .1 m.
To set the following distance (distance between follower and followee), change the value denoted by # in '''llMoveToTarget(pos,#)'''. This script has it set at 0.0 m.


<pre>
<pre>
Line 20: Line 20:
         vector offset =<-1,0,1>;
         vector offset =<-1,0,1>;
         pos+=offset;
         pos+=offset;
         llMoveToTarget(pos,0.1);     
         llMoveToTarget(pos,0.0);     
     }
     }
}
}

Revision as of 12:44, 25 May 2007

This script was extracted from the Batman Follower v1.2, but the following distance was changed from .3 m to .1 m.

To set the following distance (distance between follower and followee), change the value denoted by # in llMoveToTarget(pos,#). This script has it set at 0.0 m.

default
{
    state_entry()
    {
        vector pos = llGetPos();
        llSetStatus(STATUS_PHYSICS, TRUE);
        llSleep(0.1);
        llMoveToTarget(pos,0.1);
        key id = llGetOwner();
        llSensorRepeat("", "", AGENT, 96.0, PI, 0.4);
    }
    sensor(integer total_number)
    {
        vector pos = llDetectedPos(0);
        vector offset =<-1,0,1>;
        pos+=offset;
        llMoveToTarget(pos,0.0);     
    }
}