hello everyone,
im writing a script that will rez an object containing a particle script, that basically creates a splatter of blood when the object containing the script collides with an avatar. So far so good, the object rezzes fine when my av collides with it. However the rez script wont let me kill the rezzed object. it just loops it forever. ive included a set timer event and die commands, but it still loops. need some help sorting this bit out please. I want the rez object to die after 0.5 secs and only rez again upon another collision. any help appreciated thnx.
//Meph’s stupid problematic Blood rezzing script
vector velocity;
integer shot = FALSE;
integer fade = FALSE;
float alpha = 1.0;
default
{
state_entry()
{
llSetStatus(STATUS_DIE_AT_EDGE, TRUE);
}
on_rez(integer start_param)
{
llSetStatus(STATUS_DIE_AT_EDGE, TRUE);
llSetBuoyancy(1.0);
llCollisionSound("", 1.0); // Disable collision sounds
velocity = llGetVel();
float vmag;
vmag = llVecMag(velocity);
if (vmag > 0.1) shot = TRUE;
llSetTimerEvent(0.5);
}
collision_start(integer num)
{
if (llDetectedType(0) & AGENT)
{
// llTriggerSound("frozen", 1.0);
llRezObject("Blood splatter", llDetectedPos(0), ZERO_VECTOR, llGetRot(), 0);
{
integer i;
for ( i=0; i<num; i++ ) {
llRezObject( "Blood splatter", llGetPos()+<0,0,1>, <0,0,0>, <0,0,0,1>, i );
integer i;
}}
}
}
timer() // problem begins here i think, doesnt want to die after 0.5 secs no matter how much i yell at it.
{
if (!fade)
{
if (shot)
{
llDie();
}
}
else
{
llSetAlpha(alpha, -1);
alpha = alpha * 0.95;
if (alpha < 0.1)
{
llDie();
}
}
}
}
It would really help me if you could copy and paster your solution in a reply so i can esily slip it into my script. thnx again