Ice Bullet

The script should be placed in a small, transparent-textured sphere and named *.

icebullets.lsl
///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2011 - License: GNU GPLv3      //
//  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  //
//  rights of fair usage, the disclaimer and warranty conditions.        //
///////////////////////////////////////////////////////////////////////////
//Gremlin: Ice Bullet, see Ice Bullet Peashooter
////
integer Key2Number(key objKey) {
  return ((integer)("0x"+llGetSubString((string)objKey,-8,-1)) & 0x3FFFFFFF) ^ 0xBFFFFFFF;
}
 
integer tgtID = 0;
key tgtKey = NULL_KEY;
integer nTgT = 0;
 
init() {
    llSetStatus(STATUS_DIE_AT_EDGE | STATUS_PHYSICS, TRUE);
    llSetDamage(100.0);
}
 
integer flag = 0;
 
default
{
    at_target(integer tnum, vector targetpos, vector ourpos) {
        if(tgtKey == NULL_KEY) return;
        llSetTimerEvent(0);
        llDie();
    }
    collision_start(integer num_detected) {
        llDie();
    }
    timer() {
        llSetTimerEvent(0);
        llTargetRemove(nTgT);
        vector pos = llList2Vector(llGetObjectDetails(tgtKey, [OBJECT_POS]), 0);
        nTgT = llTarget(pos, 1);
        llMoveToTarget(pos, .5);
        llSetTimerEvent(1);
    }
    on_rez(integer param) {
        tgtID = param;
        llSensorRepeat("", "", AGENT_BY_LEGACY_NAME, 96, TWO_PI, 1.01-llGetRegionTimeDilation()); 
    }
    sensor(integer num) {
        --num;
        do {
            tgtKey = llDetectedKey(num);
            if(Key2Number(tgtKey) != tgtID) jump continue;
            llSensorRemove();
            vector pos = llList2Vector(llGetObjectDetails(tgtKey, [OBJECT_POS]), 0);
            nTgT = llTarget(pos, .01);
            init();
            llSensorRepeat("", NULL_KEY, flag=1, .1, .1, 30);
            llMoveToTarget(pos, .045);
            llSetTimerEvent(1);
            return;            
@continue;
        } while(--num>-1);
    }
    no_sensor() {
        if(flag--) {
            return;
        }
        llDie();
    }
}

secondlife/ice_bullets/ice_bullet.txt · Last modified: 2017/02/22 18:30 (external edit)

Access website using Tor


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