zombie_movement.lsl
//////////////////////////////////////////////////////////
//   (C) Wizardry and Steamworks 2011, license: GPLv3   //
// Please see: http://www.gnu.org/licenses/gpl.html     //
// for legal details, rights of fair usage and          //
// the disclaimer and warranty conditions.              //
//////////////////////////////////////////////////////////
 
// Orientates the primitive's positive z axis 
// towards a position and moves the primitive
// towards that position.
//
// IN: vector representing a position in region
// coordinates.
// OUT: nothing.
moveTo(vector position) {
    llTargetRemove(targetID);
    targetID = llTarget(position, 0.8);
    llLookAt(position, 0.6, 0.6);
    llMoveToTarget(position, 3.0);    
}
 
// Vector that will be filled by the script with
// the initial starting position in region coordinates.
vector iPos;
// Integer that the script will use to detect
// the next target position it will reach.
integer targetID;
 
// Begin script.
default 
{
    state_entry() {
        iPos = llGetPos();
        llSetStatus(STATUS_PHYSICS, FALSE);
        llSetRot(llEuler2Rot(<180., 65., 180.>*DEG_TO_RAD));
        llSetStatus(STATUS_PHYSICS, TRUE);
        llSetForce(<0,0,9.81> * llGetMass(), 0);
        llVolumeDetect(TRUE);
        llSetStatus(STATUS_BLOCK_GRAB, TRUE);
        llSensorRepeat("", "", AGENT, 64, TWO_PI, 1);
    }
    sensor(integer num) {
        llSetStatus(STATUS_PHYSICS, TRUE);
        llSetForce(<0,0,9.81> * llGetMass(), 0);
        llVolumeDetect(TRUE);
        llSetStatus(STATUS_BLOCK_GRAB, TRUE);
        llSetStatus(STATUS_ROTATE_X|STATUS_ROTATE_Y|STATUS_ROTATE_Z, TRUE);
        integer nagent = (integer)llFrand(--num);
        if(llGetAgentInfo(llDetectedKey(nagent)) & AGENT_FLYING) return;
        vector dPos = llDetectedPos(nagent);
        moveTo(dPos + <0,0,2.8>);
    }
    no_sensor() {
        llSetStatus(STATUS_PHYSICS, FALSE);
        llSetRot(llEuler2Rot(<180., 85., 180.>*DEG_TO_RAD));
 
    }
    on_rez(integer num) {
        llSetStatus(STATUS_PHYSICS, FALSE);
        llSetRot(llEuler2Rot(<180., 65., 180.>*DEG_TO_RAD));
        llResetScript();
    }
}

secondlife/zombies/zombie/movement.txt ยท Last modified: 2022/11/24 07:46 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.