User:BUTTONpUSHER Jones/pet protocol/follow
Jump to navigation
Jump to search
// follow script // startup() { llSensorRemove(); llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, TRUE); llSetStatus(STATUS_ROTATE_Z, TRUE); llSetStatus(STATUS_PHANTOM, TRUE); llSensorRepeat( "", llGetOwner(), AGENT, 100, PI, 0.5 ); } default { state_entry() { startup(); } on_rez(integer param) { startup(); } link_message(integer sender_num, integer num, string str, key id) { if (str == "follow") llWhisper(0, "I have been commanded to follow"); llSensorRepeat( "", id, AGENT, 100, PI, 0.5 ); } no_sensor() { llSetTimerEvent(30); // the ride may be lost, die in 30 seconds } timer(){ llWhisper(0, "cannot find target "); //llDie(); } // haven't detected the user for 30 seconds, so delete the ride sensor( integer total_number ) { vector vTarget = llDetectedPos(0); rotation rTarget = llDetectedRot(0); vector vOffset = <-2.0,0,-0.2>; // offset from the agent's center vector vDestination = vTarget + vOffset * rTarget; // llLookAt(vDestination, 2, 0.2); llMoveToTarget(vDestination, .1); llLookAt(vTarget + <0,0,vOffset.z>, 1, 0.1); // llMoveToTarget(vTarget, 0.5); llSetTimerEvent(0.0); // turns off the die timer } touch_start(integer total_number) { llSay(0, "stopit."); } }