Making a weapon that can use multiple types of ammo?

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
Taco Bot
Meat, Cheese, and Silicon
Posts: 484
Joined: Fri Jul 18, 2014 12:15 am
Location: Santa Cruz
Contact:

Making a weapon that can use multiple types of ammo?

Post by Taco Bot »

First of all, hi everyone. Long time no see.

Second, the game I'm currently working on is going to have the ability for a single weapon to use multiple types of ammo. (eg: normal, explosive, armor piercing)

Is there any way to accomplish this? The only option I can find is to make multiple attacks, each one consuming a different type of ammo. Weapons, however, only seem to be able to have one attack.
Sent from my iPhone
User avatar
Foxley
Metal Slime
Posts: 832
Joined: Sat Nov 09, 2013 5:54 pm

Post by Foxley »

I think you can do a tag-based "else" chain in the nightlies, and have tags set by having the ammo item equipped? That might work. I think it would.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Either way you'll need 3 attacks. Foxley mentioned one option, equip the ammo in a special equip slot, and here are two more. Firstly, you could have three separate attack options, "Shoot (explosive)", etc. Secondly you could have a single 'shoot', but give the player some menu options to switch to a different ammo type. Each of those would set/unset the appropriate tags, and the main attack would use 'else' chains to select the right variant, as Foxley said.

In either of my two suggestions you would need multiple options in the battle menu, not something you can do automatically when equiping a weapon. There's a big need for the ability to add tag conditions to battle menu options, so you could wait until James or I add that. Unfortunately there aren't any script commands to manipulate the battle menus yet. The other option is to put the attacks in a submenu (spelllist), since you can manipulate those with the "teach spell" or "write spell" commands.
User avatar
Taco Bot
Meat, Cheese, and Silicon
Posts: 484
Joined: Fri Jul 18, 2014 12:15 am
Location: Santa Cruz
Contact:

Post by Taco Bot »

Thanks to both of you for the ideas. I went with TMC's last suggestion: to put the attacks in a spell menu. That seemed like the simplest and least hacky way to solve it.

Now I've got another question: Is there any (easy) way to duplicate an entire tileset? I made the mistake of using the same tileset for two different zones, and I'm running out of room... :/
Sent from my iPhone
User avatar
Feenicks
Metal Slime
Posts: 697
Joined: Tue Aug 10, 2010 9:23 pm
Location: ON THE AIR IN THE AIR
Contact:

Post by Feenicks »

Export out the tileset, import it back in as a new tileset, and erase the stuff you're not using in each instance.
User avatar
Taco Bot
Meat, Cheese, and Silicon
Posts: 484
Joined: Fri Jul 18, 2014 12:15 am
Location: Santa Cruz
Contact:

Post by Taco Bot »

Pheonix wrote:Export out the tileset, import it back in as a new tileset, and erase the stuff you're not using in each instance.
Thanks! I can't believe I couldn't figure that out on my own...
Sent from my iPhone
User avatar
Mogri
Super Slime
Posts: 4669
Joined: Mon Oct 15, 2007 6:38 pm
Location: Austin, TX
Contact:

Post by Mogri »

There's also a menu option to cut from another tileset, although I get offset errors every time I use that.
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

The tile cutter works by moving the position of the mouse cursor, and there's currently a rounding error in gfx_directx (caused by the graphics scaling) which can place the cursor one pixel off from where's intended. You might have encountered that.

I just made some UI improvements to the cutter that should help you avoid alignment problems. You can use the cutter to copy a whole tileset by starting at the top-left and holding down Enter.
Last edited by TMC on Mon Jun 08, 2015 6:14 pm, edited 2 times in total.
Post Reply