Gw Temp

Menu

Tutorial - 'Simple DBS ammunition system' by Guest

An item about RPGMaker 2000 posted on

Blurb

A simpler, more efficent ammo system than the ones you've seen, apparently.

Body

I've read many of the ammo system tutorials for the DBS on this site and I have to say that they are either not explained very well or are way too complicated. With a lot of help from Carius, I have found a simple way to track ammo use in the DBS.

You only need the most basic knowledges of variables and switches. Note that this method doesn't take reloading into account, instead treating your ammunition as individual rounds instead of clips.

First thing you need to do is create your weapon. It is a standard weapon, you don't have to do anything special to it, just name it, set its power and attack animation, and so on. Then create the individual round for that weapon, and set it as a common item. For this example we'll use a Colt 1911, we'll call it Colt 1911, for the weapon and have it fire a .45 ACP round, we'll call it .45 ACP.

Weapon Name: Colt 1911
Common Item name: .45 ACP

We'll need a variable that stores the amount of that particular round of ammo. Let's call it 45ACP. We'll also need a switch to see if your character has that particular weapon equipped. For our example, we'll call it heroEquipped1911. You'll need a different switch for each hero and ammo based weapon that hero can use.

Ammunition Variable Name: 45ACP
Weapon Check Switch Name: heroEquipped1911

We are going to create a common event with the call trigger that checks to see if your character has a certain weapon equipped. We'll call it heroCurrentWeapon. This event will have conditional statements in it, one for each of the ammo based weapons that the character can use. The conditional will check to see which weapon the character has equipped and turn the appropriate switch on or off.

Name: heroCurrentWeapon Trigger: Call
------------
<>Branch if Hero Colt 1911 Equipped
<><>Switch Operation: [xxxx:heroEquipped1911] ON
<><>
:Else Handler
<><>Switch Operation: [xxxx:heroEquipped1911] OFF
<><>
:END
<>
------------

You'll need one of these branches for each ammo based weapon they can use. All of these branches go under the same common event, the one that checks the equipped weapon for that particular character. If you have more characters you can also throw their branches into this same event, but giving them their own common event just like the above will make these common events much clearer to read.

In the battle events in the monster groups tab, we'll be making at least two pages of events, more if you have more gun-toting characters. One of the tabs, preferably the first, will call the weapon checking common events. Use the turns elapsed trigger and set it to 0 so that it executes at the beginning of the battle. At this point we will also set our ammo variables equal to the amount of ammunition we have. In this case our ammo variable 45ACP will be set equal to the amount of .45 ACP rounds currently in inventory.

Trigger: Turns Elapsed [0]
---------------
<>Call Common Event:heroCurrentWeapon
<>Variable Oper:[xxxx: 45ACP]Set, .45 ACP Possessed
---------------

If your other gun characters have their own weapon checking common events, call them here, too. Also, set the variable here for every type of ammunition you have.

Now for the meat of the code. Create a second battle event page. This page will be triggered by a specific hero using the fight command. This page will check to see which weapon checking switches are on and execute the appropriate branch of code. You will need one of these pages for each character that can use ammo based weaponry.

Trigger: [Hero] uses the [Fight] command
---------------------
<>Branch if Switch [xxxx:heroEquipped1911] is ON
<><>Branch if Var [xxxx:45ACP] is 1 or more
<><><>Change Items: .45 ACP 1 Remove
<><><>Variable Oper:[xxxx: 45ACP]Set, .45 ACP Possessed
<>
<><>:Else Handler
<><><>Change Equipment:Hero Weapon Unequip
<><><>
<><>:END
<>
:END
--------------------

What this is doing is checking to see if a character is using the fight command. Then it checks to see if the weapon check switch is on, which is determined by the current weapon. If it's on, then it will go into another branch that checks the ammo variable we set in the first battle event page. If it's at least 1, then it will remove 1 round of ammunition from your inventory. It will then reset the variable to the new amount.

If you don't have enough ammo, meaning you have none, then the character will unequip their weapon and attack unarmed instead. The reason you unequip the weapon is because if you don't, the character will still use the gun despite not having any ammo for it.

All the weapons this character can use will go in this page. Other characters will have their own pages similar to this one, and you will have these same battle events for each monster group in your game.

And there it is. No fake ammo, no new skills to memorize and forget, no new battle animations, so on and so forth. Just a weapon, its ammo, a common event, a switch, a variable, and some battle event pages. Just do the same thing for each weapon you have.

Also, to help in coding, where ever I use the word hero in this tutorial, I suggest you use the name of the character it will pertain to. It will make life easier. Trust me.

Special thanks to Carius for helping me out with this in the forums.