PDA

View Full Version : Making a custom weapon



AmazingAmpharos
11-26-2007, 11:34 PM
I'm seeing if I can figure out this scripting thing, and I was seeing if I could make a custom weapon. The idea is that it will spawn a freeform combo and shoot it out kinda like the boomerang goes except after a certain range it will disappear instead of returning and will just damage, not stun. The script should be able to specify how much damage it can do to any given enemies. I have the part where you make the FFC and shoot it off in a desired direction with the desired velocity (I think), but how do you make it disappear at the end of the range? That will not happen the frame the item is used so it would seem to be a problem.

Also, how do I make it damaging to enemies? I can see what function would change the HP of any given enemy, but how do I identify that I'm hitting an enemy and then tell which type of enemy it is (I don't want to do anything rash like kill the old man, and I probably want to be able to make things like Darknuts and Digdoggers immune)?

Thanks for any help ahead of time.

C-Dawg
11-26-2007, 11:42 PM
Gleeok has some scripts for custom weapons out there somewhere. There's also the scripts in Zodiac (over at Quest Announcement) where all of my custom weapons are open for ripping. Go inspect how I'm doing them and you'll get the hang of it.

The easiest way to limit range, to answer your question, is to use a cycling combo. The script only moves the weapon-ffc while it's a certain combo. Once it cycles to another one, it stops.

For enemy damage, you have to simulate damage, flashing, and knockback to make it satisfying. This isn't so bad. But it's a little complicated, as you'll see when you review the scripts, because you want to be able to hit more than one enemy at a time.

Gleeok
11-27-2007, 01:01 AM
Actually I haven't posted any weapon scripts yet as they aren't done yet. The problem with the script i'm using and the Zodiac script is it's so damn complicated for non-scripters to use. However, i've fixed the crash and bool problems with the Global Weapon script i've been working on (for so long :( ), which means i'll switch over to that eventually as it runs faster and doesn't seem to slowdown ZC from enemy->pointers as much. *Sigh* I just can never have time for all these scripts...(I wish we had more scripters)

You should at least check out what is available in the script showcase, and hopefully you'll pick up scripting in no time at all.


To answer more specifically your questions though: Yep, combo cycle the ffc.
And you need to check the coordinates of the ffc with the coordinates of every on screen enemy. If the ffc is over an enemy, you need to store that npc's id in a variable, then assign damage to it with:

npc enemy = Screen->LoadNPC(npc_id);
enemy->HP -= damage_amount;