Jump to content

need help with staff projectile


WHATCHAMAC4LLIT
 Share

You are about to reply to a thread that has been inactive for 2309 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

So i've been working on a fire staff. I have everything figured out. except that i cant get the lldie script to work on the fireballs that shoot out. so they just set on the ground after being shot. i need help, i have absolutely no idea what i am doing. the script i made will work when i set it, but not trigger on rez. this is what i had going from what i could find online.

integer counter;
float     gap = 2.0;
 
default
{
    state_entry()
    {
        llSetTimerEvent(gap);
    }
 
    on_rez(integer total_number)
    {
        llSetTimerEvent(0.0);
        counter = 0;
    }
 
    timer()
    {
        ++counter;
        llDie();
    }
}

Link to comment
Share on other sites

  on_rez(integer total_number)
    {
        llSetTimerEvent(0.0);
        counter = 0;
    }

When the staff rezzes the fireball, this is executed. So, change the 0.0 there to....

llSetTimerEvent(gap);

Also, it's a good idea to make the fireball prim as a temporary on the Edit>Object tab. This will ensure that the SIM also cleans them up if they are on NoScript land.

 

Edit: And just for completeness, the variable counter is meaningless, it's not used in the script as it is. May as well delete those lines.

Edited by Callum Meriman
Link to comment
Share on other sites

Um... You started a timer in the on_rez event and set it to 0.0, so it will never turn on. The fact that you also start the timer in your state_entry event is irrelevant, since the on_rez event will overwrite that when you rez the object.  Delete the llSetTimerEvent statement in state_entry.

Beyond that, you have defined a global integer variable called counter that does not seem to have a purpose. It is incremented in the timer event for some reason but never used for anything.  You can safely remove it from your script.  Try this instead:
 

float gap = 2.0;

default
{
    on_rez(integer startup)
    {
        if (startup)
        {
            llSetTimerEvent(gap);
        }
    }
    timer()
    {
        llDie();
    }
}

When you write the llRezAtRoot statement in the script that rezzes this thing, give the final parameter a non-zero value to pass to this little script. That will activate the timer.  Without that provision in the on_rez event, your object will always die two seconds after you rez it from your own inventory, making it impossible for you to update the script if you want to change it (like changing the value of the gap variable, for example)_.

Link to comment
Share on other sites

7 minutes ago, WHATCHAMAC4LLIT said:

it didnt work, but prolly cause im in a castle. is there any way i can use this in collision with anything? not just land.

 

That's why Innula suggested putting llDie in both the land_collision event and the collision_start event.

And it's still wise to take Callum's advice and make the fireball temp_on_rez so that it's guaranteed to die within a minute even if your script fails completely.

Edited by Rolig Loon
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2309 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...