Please note that I made this a long while ago, so I didn't feel like retyping it so I just copied/pasted it here. The edited part I actually added in on a different forum that I copied it from.
Required Knowledge:Basic Eventing, and some Switch usage.
An Eventer's Guide to an Ammo SystemStep 1: Creating the ItemsAlright, to start off, we need to make our weapon that's going to use ammo.
I've gone ahead and made a
Handgun that will require
9mm bullets.
Simple, right? Right.
Next, we have to make an Item. I'll call mine
9mm Round.
Let's go ahead and turn off
Consumable, and set the Occasion to
Never. It'll be going away fast enough.
Step 2: Creating the Common EventNow go to your
Common Event tab, and create a new one. I'll go ahead and call mine
Ammo System. Set it to 'None'. We'll only be calling it when we're in battle.
Step 3: Making the Conditional BranchesRight-o, now that we've got our Common Event made, we can start making it do it's thing.
First off, make a
Conditional Branch. Go to the second tab, and put a dot in the
Actor circle. Then go down and check
Weapon. Select your
Handgun.
Hit
OK.
Next, we need to make a
Conditional Branch within the one we just made. Create a
Conditional Branch, and go to the
4th page. Select
Item. Put your
9mm Round in the box, and hit
OK.
Your
Common Event should now look like this:
Step 4: More Conditional Branches and SwitchesNow, in the second
Conditional Branch you made, put, a
Control Switches command. Have it turn a second switch
ON. I'm going to call my switch
Player attack.
Click
OK.
Now, we need to make it so that if the player DOESN'T have a
9mm Round, we need to do the same thing, but this time put turn
OFF the switch
Player attack, and we need to put this under
Else in the second
Conditional Branch.
Our
Common Event should now look like...
That!
Now, we need to create another
Conditional Branch, completely separate from the two we've just been working with.
Our next new
Conditional Branch needs to be set on the first page of the
CB dialog so that it activates only when the switch
Player attack is
OFF.
Our Common Event should now look like the following.
It's coming along, but it's not really doing anything yet, is it?
Well, that's coming up. Right now.
Step 5: Turning the Player's Attack On and OffNow what we need to do, under this new
Conditional Branch, is put a
Force Action command.
It should have the following settings:
Click
OK. What you could do, is if you wanted all of your actors to use arrows or bullets or whatever, is have the
Force Action duplicated and the first two
conditional branches duplicated for each of your actors who use ammo. But, to keep it simple, we'll stick with just our one actor for now.
Step 6: Putting the Common Event to UseNow, all we have to do, is go through to each of the troops, and put in a
Call Common Event command...
The common event should look like this so far:
I realize I forgot to put in the part such as when using ammo, it actually subtracts from the ammo you have. This is easily fixed by creating a
Control Variable event, under your
Force Action event line... (I'm calling my variable
playerattacks)
Also, you need to create a
LABEL above EVERYTHING. You'll see why.
Now, another
conditional branch (Once again separate from all others...) Use the following settings:
Then, under that, add a
Jump to Label and select the label you created earlier.
Now, we need another
conditional branch.
And under that, we need to put another
Control Variable command, but this time we need to add to a DIFFERENT variable than before. Ok? Ok.
And now for a final
conditional branch.
And now, for the final two commands:
Add a
Subtract Item "9mm Round" Constant: 1 command. Then under that create a
Jump to Label and once again type in the label that you put on top of everything.
And that's it! It officially works now. lol!