Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Looking for a beginners tut for weapon creation.

Macgyver Whitfield
Registered User
Join date: 14 May 2007
Posts: 3
05-15-2007 16:02
I have built myself a solid looking mallet and would eventually like it to create small shock waves upon hitting the ground that knocks opps. down, but for right now I'd like to be able to just swing it :) Does anyone have a tut for starting new melee weapons? I've looked around and can't find any applicable scripts in the library. And here's a few random things I'd need help with too.

- Do I need to create swinging animations in order to use it? If so how.

- How can I assign collision detection and amount of damage?

- I wear the mallet on my hand, and edit it to line it up nicely. Then when I take it off and put it back on, it forgets my settings and I'm holding it strangely again. How can I fix that?

- I'm wearing the mallet on my shoulder right now, is there a script that can force it to equip on my hand and unequip it back to my shoulder?

I'm a huge newb but this prim system is so intuitive and I would really appreciate the help. Thanks!
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
05-15-2007 16:33
Well, there's no tutorial that I know of, but:

1. You'll need some sort of animation. There are stock animations built into the client, which you can find a list of here, but for best results you will want to make your own (using something like Qavimator - I use this for all of my weapons) or by buying one from an existing creator or hiring someone to produce custom animations (expensive!)

2. Standard damage in SL is done by hitting someone with an object in a damage zone. The object has to have had the function llSetDamage() run on it; after that it will disappear. So really, as standard, melee weapons will be launching short-ranged "bullet" projectiles which do this. There are also lots of different scripted RP combat systems, too many to mention, which work in other ways... and weapons can have direct effects on avatars, such as pushing them in a certain direction. It really depends on the exact effect you want.

3. If you attach an object to a position, move and rotate it, then detach it and select "Wear" again it should go back to how you adjusted it the first time. Attached objects remember their position and rotation unless they are then attached to a different point. If it doesn't, there's something wrong, expand on exactly what you're doing in more detail.

4. A script could check where the object it was in was being attached, and, if it wasn't the right spot, could say "hello, you've put me in the wrong place, please try again". It could even send itself back to the owner's inventory if it detected it was in the wrong place. I don't believe it's possible for an object to move itself around different attachment points though.
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!

http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal

http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
05-15-2007 16:35
1--Yes. Poser is a popular (not free) animation program that imports easily to SecondLife. There are free programs out there as well.

2--Depends on the combat system with which you are working. For normal 'built in' damage, see llSetDamage(). Otherwise, visit with combat-system creators. Many of them have DevKits available for a price.

3--I dunno why it's forgetting your settings...mine always remember my settings. You are just reseleting "wear", correct? Not doing an attach to >? And not attaching it somewhere else and then back to your hand?

4--You generally make two copies of an item and turn your 'sheathed' version invisible while the weapon is drawn and the 'drawn' version invisible while the weapon is sheathed. This is easily done via script and llSetAlpha() and llSetLinkAlpha().
_____________________
--AeonVox--

Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms chasing ghosts, eating magic pills, and listening to repetitive, addictive, electronic music.
Macgyver Whitfield
Registered User
Join date: 14 May 2007
Posts: 3
05-15-2007 16:42
These are excellent, thank you both. Especially for the setalpha bit.

As far as all the mele items I have no with no instructions, how do I attack? Or are you saying the weapons themselves are just for show and the attacking part is all dependant on a third party combat hud?

Also is there a site with additional player made animations? Could I use someone else's in some way? Or is that generally frowned upon?
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
05-15-2007 16:57
Generally you enter mouselook and click to attack things. There are some weapons sold which are purely ornamental, though. If you want to script something like that yourself, start with llTakeControls and the control() event - the Linden Popgun in the default section of your inventory is a good starting example.

Kenn Nilsson is quite right that that's the general way of having a drawn/sheathed weapon - I'm sorry, I didn't quite realise that that was what you wanted to do there. I personally have the actual weapon whisper a command on a chat channel which tells attachments when it is being drawn or sheathed, so they can appear or disappear as appropriate. (There's a little more to it than that but that's the basic idea.)

As far as I know there is no public animation bank, but there may be a few free ones knocking about. Qavimator is not that hard to use, believe me.
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!

http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal

http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names
Macgyver Whitfield
Registered User
Join date: 14 May 2007
Posts: 3
05-15-2007 17:04
Wow I didn't know you could use chat channels like that. I'm probably going to have fun with LSL. Thanks.
Ordinal Malaprop
really very ordinary
Join date: 9 Sep 2005
Posts: 4,607
05-15-2007 17:09
The basic way of having objects communicate with each other is through chat on channels which aren't 0. You don't need to do this if you just want scripts to communicate with other in the same object though - llMessageLinked is far better for that.
_____________________
http://ordinalmalaprop.com/forum/ - visit Ordinal's Scripting Colloquium for scripting discussion with actual working BBCode!

http://ordinalmalaprop.com/engine/ - An Engine Fit For My Proceeding, my Aethernet Journal

http://www.flickr.com/groups/slgriefbuild/ - Second Life Griefbuild Digest, pictures of horrible ad griefing and land spam, and the naming of names