Difference between revisions of "Follower script"
Jump to navigation
Jump to search
Placid Kidd (talk | contribs) (spell out llSensorRepeat parameters and more comments) |
Placid Kidd (talk | contribs) (remove junk about follow distance because it is entirely incorrect) |
||
Line 1: | Line 1: | ||
This script | This script is based on an extract from the Batman Follower v1.2. | ||
<pre> | <pre> | ||
Line 10: | Line 10: | ||
// Little pause to allow server to make potentially large linked object physical. | // Little pause to allow server to make potentially large linked object physical. | ||
llSleep(0.1); | llSleep(0.1); | ||
llMoveToTarget(pos,0. | llMoveToTarget(pos,0.4); | ||
// Look for owner within 20 metres in 360 degree arc every 1 seconds. | // Look for owner within 20 metres in 360 degree arc every 1 seconds. | ||
llSensorRepeat("", llGetOwner(), AGENT, 20.0, PI,1.0); | llSensorRepeat("", llGetOwner(), AGENT, 20.0, PI,1.0); | ||
Line 22: | Line 22: | ||
vector offset =<-1,0,1>; | vector offset =<-1,0,1>; | ||
pos+=offset; | pos+=offset; | ||
llMoveToTarget(pos,0. | llMoveToTarget(pos,0.4); | ||
} | } | ||
} | } |
Revision as of 18:32, 5 July 2007
This script is based on an extract from the Batman Follower v1.2.
default { state_entry() { vector pos = llGetPos(); llSetStatus(STATUS_PHYSICS, TRUE); // Little pause to allow server to make potentially large linked object physical. llSleep(0.1); llMoveToTarget(pos,0.4); // Look for owner within 20 metres in 360 degree arc every 1 seconds. llSensorRepeat("", llGetOwner(), AGENT, 20.0, PI,1.0); } sensor(integer total_number) { // Get position of detected owner vector pos = llDetectedPos(0); // Offset back one metre in X and up one metre in Z based on world coordinates. // Offset relative to owner is possible but beyond the scope of this example. vector offset =<-1,0,1>; pos+=offset; llMoveToTarget(pos,0.4); } }