Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Bullets

CoCoNoNo Anubis
Skylark Mechanic
Join date: 28 Jun 2004
Posts: 40
06-29-2004 14:53
I've decided to make my first task as a scripter to create a bullet script.

Unfortunately I can't find any examples (maybe one's in the scripting that I'm slogging through...)

so I'm thinking the general idea would be that it waits until it is in a collision state. Then it does a check to see if it hit an avatar or something else.

now what I'm stuck on is how to determine that it hit an avatar...any suggestions?
_____________________
-CoCoNoNo
Current Major Projects:
CoCoHoBo - Personal conveyance not for the faint of heart.
Dreamer Class Skyships - Personalized skycraft for small parties or gatherings.
Pete Fats
Geek
Join date: 18 Apr 2003
Posts: 648
06-29-2004 15:06
The collision events are triggered when you collide either with an object or an agent.

If you want to find out if what you hit is an object or an agent, you can use llDetectedType()
CoCoNoNo Anubis
Skylark Mechanic
Join date: 28 Jun 2004
Posts: 40
06-29-2004 15:12
awesome. not only did you give a reeally easy answer to work with but also provided me with an great resource. bonus points!!
Rysidian Rubio
Ruby Red Head
Join date: 14 Jan 2004
Posts: 263
06-29-2004 18:27
CoCoNoNo just as a heads up you might want to make sure that your bullets are set to delete themselves after a short period of time to stop them taking up prims on other people's land and/or linden protected land.

You can do this by setting a timer that waits say 30seconds and then deletes the bullet. Or you can set the bullet to TempOnRez so that it automatically deletes after a short period of time (approx 1 minute). Both are good ideas (and the second should work even if the bullet is on land that doesn't allow scripts to run. If you want to know how exactly to do this (look on the LSL wiki site) or send me an IM or reply :)
Goshua Lament
Registered User
Join date: 25 Dec 2003
Posts: 703
06-29-2004 18:29
You can find an example bullet script in the bullet in the contents of the Linden Revolvers, at the welcome area shooting gallery. Rysidian, thank you for remembering to derez the bullets.
_____________________
Flickr Second Life Photo Gallery

I no longer regularly login to SecondLife, but please contact me if an issue arises that needs my attention.
Francis Chung
This sentence no verb.
Join date: 22 Sep 2003
Posts: 918
06-29-2004 18:39
Heya, some thoughts to add:

Temp on rez is not "reliable" either. Sometimes it just doesn't derez, for no good reason. Last time I checked, temp on rez stuff still couldn't derez in scriptable land, but this may have been fixed.

Better to use both an explicit kill timer, as well as setting temp_on_rez. Temp will let you rez bullets, even when you're on a full parcel.

The linden revolvers are a good example of a bullet script. I'm sure that most guns in SL were some kind of derivative of the linden revolvers. (I think they were actually made by Valforeth Grimm, but I'm not sure)

If you set the bullets to do damage, and you're in a damage area, and hit an avatar, you will never get a collision event. The bullet magically derezzes on impact.
_____________________
--
~If you lived here, you would be home by now~
Rysidian Rubio
Ruby Red Head
Join date: 14 Jan 2004
Posts: 263
06-29-2004 20:39
From: someone
Originally posted by Francis Chung
If you set the bullets to do damage, and you're in a damage area, and hit an avatar, you will never get a collision event. The bullet magically derezzes on impact.
OOh good to know, thanks Fran!
Tiger Crossing
The Prim Maker
Join date: 18 Aug 2003
Posts: 1,560
06-30-2004 00:34
Seems like the last of the Temp on Rez bugs were worked out and fixed two version ago. It should probably be safe to trust it alone for bullet disposal.

In fact, it would be a good stress test of that flag if all new guns relied on it. If there ARE any remaining problems, that's a sure way to find them.
_____________________
~ Tiger Crossing
~ (Nonsanity)
Remo Yossarian
Registered User
Join date: 15 Feb 2004
Posts: 121
06-30-2004 06:53
I can't find how to set Temp_To_Rez in the wiki.

Can someone post the syntax for setting a prim this way?
Goshua Lament
Registered User
Join date: 25 Dec 2003
Posts: 703
06-30-2004 07:33
I think that Temp On Rez is a property that you check in the edit window for the bullet prim. Maybe I'm wrong, but I don't think Temp On Rez can be set with a script. Just check the checkbox for in the edit panel for the Bullet prim before you take it into your inventory and it should work.
_____________________
Flickr Second Life Photo Gallery

I no longer regularly login to SecondLife, but please contact me if an issue arises that needs my attention.
CoCoNoNo Anubis
Skylark Mechanic
Join date: 28 Jun 2004
Posts: 40
06-30-2004 10:46
From: someone
Originally posted by Rysidian Rubio
CoCoNoNo just as a heads up you might want to make sure that your bullets are set to delete themselves after a short period of time to stop them taking up prims on other people's land and/or linden protected land.

You can do this by setting a timer that waits say 30seconds and then deletes the bullet. Or you can set the bullet to TempOnRez so that it automatically deletes after a short period of time (approx 1 minute). Both are good ideas (and the second should work even if the bullet is on land that doesn't allow scripts to run. If you want to know how exactly to do this (look on the LSL wiki site) or send me an IM or reply :)


would having them de-rez at the end of the collision event work?
CoCoNoNo Anubis
Skylark Mechanic
Join date: 28 Jun 2004
Posts: 40
06-30-2004 10:49
From: someone
Originally posted by Goshua Lament
You can find an example bullet script in the bullet in the contents of the Linden Revolvers, at the welcome area shooting gallery. Rysidian, thank you for remembering to derez the bullets.


yeah I just figured out how to unpackage the darned things. Makes CoCo's life lots easier.
Francis Chung
This sentence no verb.
Join date: 22 Sep 2003
Posts: 918
06-30-2004 15:55
From: someone
Originally posted by Tiger Crossing
Seems like the last of the Temp on Rez bugs were worked out and fixed two version ago. It should probably be safe to trust it alone for bullet disposal.


I haven't tested in 1.4. In 1.3, I was setting die on edge, and temp on rez, and I still occasionally had things that didn't de-rez. I couldn't find a pattern.

My solution was to set die on edge, temp on rez, as well as having an explicit kill timer. I figured that there's nothing else I can do that can possibly make the system more reliable, and called it a day. So, once in a blue moon, things don't derez, but it's pretty good :)

Of course, to be fair, I was rezzing things at around 1000 prims/minute, but hey....
_____________________
--
~If you lived here, you would be home by now~