Jump to content
WHATCHAMAC4LLIT

need help with staff projectile

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();
    }
}

Share this post


Link to post
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

Share this post


Link to post
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)_.

Share this post


Link to post
Share on other sites

ok it still doesnt kill on rez. should i remove the first state_entry? i also copied and pasted the script above, doesnt seem to be working either. or at least instantly it takes about 30 seconds give or take to die

 

Edited by WHATCHAMAC4LLIT

Share this post


Link to post
Share on other sites
1 minute ago, WHATCHAMAC4LLIT said:

ok it still doesnt kill on rez. should i remove the first state_entry?

 

You have no need for state_entry in this script.

  • Like 1

Share this post


Link to post
Share on other sites

The land_collision event fires when the object containing the script collides with the land.  The collision event fires when it collides with anything else.   Always assuming neither object is phantom, that is.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

i got it working. Put both land collision, and normal collision into it like yall said. now it disappears wherever it hits. thank you i was way off, and this simplifies it so much ^_^

 

Edited by WHATCHAMAC4LLIT
  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...