Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: Anti-Grief Shield/deflector

Exile Loudon
Aspiring Scripter
Join date: 10 Dec 2005
Posts: 122
03-12-2006 17:51
This is a very simple script I quickly put together, and what it does is it rezzes a shield around you when a bullet comes close, and deflects the bullet away. This script isn't extrmemly powerful and may not be able to protect all bullets. Don't depend on it too much. Put it into a 80 % dimpled (aroudn there) sphere, around 2m in diameter. This would be the shield plate. IM me in world for a free UPDATED copy.

Anti-Grief Attachment Script:
CODE

//Exile's Simple Anti-Grief Auto shield! Please don't resell or use in any products you plan
//to sell. This is open-sourced, so give full rights to anyone who gets this script.
// Please don't remove this disclaimer, as it isn't nice to take the the gratitude that's
//supposed to be for me. Have fun and keep safe!

default
{
state_entry()
{
llListen(2,"",llGetOwner(),"");
}

listen(integer channel,string name,key id,string message)
{
if(message=="auto shield on")
{
llOwnerSay("Auto Shields Activated.");
llSensorRepeat("","",ACTIVE,5,TWO_PI,0.1);
}

if(message=="auto shield off")
{
llOwnerSay("Auto Shields deactivated.");
llSensorRemove();
}
}



sensor(integer num_detected)
{
if(llVecMag(llDetectedVel(0)) > 7.0)
{
rotation rot = llGetRot();
rotation drot = llDetectedRot(0);
rotation between = llGetRot() * llRotBetween(<0.5,0,0> * llGetRot(), llDetectedPos(0) - llGetPos());
llRezObject("Auto Shield",llGetPos() + <0.5,0,0> * between,ZERO_VECTOR,between,0);

}
}
}


Auto Shield Plate Script (Just for the plate to die after 2 seconds)
CODE
default
{
state_entry()
{
llSleep(2);
llDie();//Let the plate disappear and not spam people's plots.
}
}

To use, say "/2 auto shield on" and to turn of say "/2 auto shield off". (DUH!) Make sure the plate is a dimpled sphere.
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
03-17-2006 11:44
/15/23/93120/1.html
_____________________
i've got nothing. ;)
Exile Loudon
Aspiring Scripter
Join date: 10 Dec 2005
Posts: 122
03-17-2006 15:13
Oh; I fixed a mistake with the sensor. Sorry.
Argent Stonecutter
Emergency Mustelid
Join date: 20 Sep 2005
Posts: 20,263
03-19-2006 12:13
The calculation for TEMP is pretty much redundant.

Just use the maximum floating point number, should be 3.402823466E+38 .