ok ive fix the grenade from the suggestion but it one detect the avat between two point
key agent;
key kAv;
vector pos;
vector vPos;
vector vel;
float fDist;
float rng = 0;
float MinDist = 0.00;
float MaxDist = 0.25;
integer bit;
integer i;
integer hits=0;
integer hex;
integer max;
list rc;
list lInRange;
list lAvs;
default
{
state_entry()
{
//llVolumeDetect(TRUE);
}
collision_start(integer n)
{
llSetStatus(STATUS_PHYSICS,0);
for(rng = 0.00; rng <= 10.00; rng += 0.25){ //increases range in for loop
llOwnerSay("loop");
}
llSensor("","",AGENT_BY_LEGACY_NAME,rng,PI);
MinDist + rng;
MaxDist + rng;
}
sensor(integer n)
{
llOwnerSay("sensor firing");
agent=llDetectedKey(i);
pos=llDetectedPos(i);
vel=llDetectedVel(i);
bit=llGetAgentInfo(agent);
kAv = llList2Key(lAvs, max);
vPos = llGetPos();
max = -llGetListLength(lAvs);
lAvs = llGetAgentList(AGENT_LIST_PARCEL, []);
fDist = llVecDist(vPos, llList2Vector(llGetObjectDetails(kAv,[OBJECT_POS]),0));
rc=llCastRay(llGetPos(),pos,[RC_MAX_HITS,1,RC_REJECT_TYPES,RC_REJECT_PHYSICAL]);
if(llList2Key(rc,0)==agent||llList2Integer(rc,-1)<=0)
{
if(bit&0x0020&&hits==0)
{
hex=(integer)("0x" + llGetSubString(llMD5String((string)llDetectedKey(i),0), 0, 3));
// llRezObject("",llGetPos(),ZERO_VECTOR,ZERO_ROTATION,hex);
++hits;
llOwnerSay(""+llKey2Name(agent));
}
else
{
if(fDist > MinDist = 5 && fDist < MaxDist = 5.25){
llRezObject("shrapnel",pos+(vel*.2),ZERO_VECTOR,ZERO_ROTATION,1);
llOwnerSay("5m check");
}
if(fDist > MinDist && fDist< MinDist){
}
llRezObject("shrapnel",pos+(vel*.2),ZERO_VECTOR,ZERO_ROTATION,1);
llOwnerSay("0ver 5m check");
}
}
llDie();
}
no_sensor()
{
llDie();
}
}
the two points are MinDist and MaxDist