Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Volume Detect Collision Start Alpha ON/OFF?

Numberofthebeast Angelus
Registered User
Join date: 8 Dec 2004
Posts: 8
01-18-2009 03:12
id like this to work but im a builder not a scripter , basicly i need the texture to be in the alpha on position until someone shoots the prim then the alpha turns off for 60 secs , i belive in the alpha off position the texture (bullet hole) whould be seen

default
{
state_entry()
{
llVolumeDetect(TRUE); // Starts llVolumeDetect
llListen(0, "", "", "";);
}
collision_start(integer total_number)
{
llSay(0, "Detected!";); // Tells you when something penetrates the prim
llSetAlpha(ALL_SIDES,0);
}

listen(integer channel, string name, key id, string message)
{
if( message == "Detected!";)
{
llSetAlpha(ALL_SIDES,1);
llSleep(10);
llResetScript();
}
}
}


im sure i have most of this wrong so any help would great
Beverly Ultsch
Registered User
Join date: 6 Sep 2007
Posts: 229
01-18-2009 04:15
From: Numberofthebeast Angelus
id like this to work but im a builder not a scripter , basicly i need the texture to be in the alpha on position until someone shoots the prim then the alpha turns off for 60 secs , i belive in the alpha off position the texture (bullet hole) whould be seen

default
{
state_entry()
{
llVolumeDetect(TRUE); // Starts llVolumeDetect
llListen(0, "", "", "";);
}
collision_start(integer total_number)
{
llSay(0, "Detected!";); // Tells you when something penetrates the prim
llSetAlpha(ALL_SIDES,0);
}

listen(integer channel, string name, key id, string message)
{
if( message == "Detected!";)
{
llSetAlpha(ALL_SIDES,1);
llSleep(10);
llResetScript();
}
}
}


im sure i have most of this wrong so any help would great


The main problem here is that a prim can't listen to itself.

I.m not inworld to test but try something like

CODE

default
{
state_entry()
{
llVolumeDetect(TRUE); // Starts llVolumeDetect
}
collision_start(integer total_number)
{
llSetAlpha(ALL_SIDES,0);
llSleep(10);
llSetAlpha(ALL_SIDES,1);
}

}


Edit. looking at that you could get problems if its hit more than once, a timer may be better

CODE

integer wasHit = FALSE;

default
{
state_entry()
{
llVolumeDetect(TRUE); // Starts llVolumeDetect
}
collision_start(integer total_number)
{
if(wasHit == FALSE)
{
llSetAlpha(ALL_SIDES,0);
wasHit = TRUE;
llSetTimerEvent(10.0);
}
}
timer()
{
llSetTimerEvent(0.0);
llSetAlpha(ALL_SIDES,1);
wasHit = FALSE;
}

}


This may contain syntax errors.