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.
(http://i7.photobucket.com/albums/y288/Golden_Pheonix_/ammotut1.jpg)
Simple, right? Right.
Next, we have to make an Item. I'll call mine 9mm Round.
(http://i7.photobucket.com/albums/y288/Golden_Pheonix_/ammotut2.jpg)
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.
(http://i7.photobucket.com/albums/y288/Golden_Pheonix_/ammotut13.jpg)
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.
(http://i7.photobucket.com/albums/y288/Golden_Pheonix_/ammotut4.jpg)
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.
(http://i7.photobucket.com/albums/y288/Golden_Pheonix_/ammotut5.jpg)
Your Common Event should now look like this:
(http://i7.photobucket.com/albums/y288/Golden_Pheonix_/ammotut6.jpg)
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.
(http://i7.photobucket.com/albums/y288/Golden_Pheonix_/ammotut7.jpg)
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...
(http://i7.photobucket.com/albums/y288/Golden_Pheonix_/ammotut8.jpg)
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.
(http://i7.photobucket.com/albums/y288/Golden_Pheonix_/ammotut14.jpg)
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:
(http://i7.photobucket.com/albums/y288/Golden_Pheonix_/ammotut11.jpg)
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...
(http://i7.photobucket.com/albums/y288/Golden_Pheonix_/ammotut12.jpg)
The common event should look like this so far:
(http://i7.photobucket.com/albums/y288/Golden_Pheonix_/ammotut15.jpg)
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.
(http://i7.photobucket.com/albums/y288/Golden_Pheonix_/ammotut16.jpg)
Now, another conditional branch (Once again separate from all others...) Use the following settings:
(http://i7.photobucket.com/albums/y288/Golden_Pheonix_/ammotut17.jpg)
Then, under that, add a Jump to Label and select the label you created earlier.
Now, we need another conditional branch.
(http://i7.photobucket.com/albums/y288/Golden_Pheonix_/ammotut20.jpg)
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.
(http://i7.photobucket.com/albums/y288/Golden_Pheonix_/ammotut21.jpg)
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!
nice, 7/10, i suggest to make it better, to have better bullets to do more damage, and maby a status effect.
Well, assuming you're going to have more than one weapon that uses ammo, the better weapon would do higher damage. And of course it would be easy to have certain weapons (for example, a tranquilizer gun) activate certain statuses on enemies. All you'd have to do is change the properties of the weapon. :)
As being an eventer (Not focused totally on it), I usually do systems like these myself. But possibly I would be interested in using this instead. I will surely add this to the database...Under the following conditons.
- Add spoilers to hide the images.
- Make it a little more visually appealing. Not saying it's horrendous now...but still. (Add bold, size up, etc.)
Finishing these minor things will have this added onto the Tutorial Database. :D
-----
Thank you very much Terry, you have been added. Many cheers! :gunz:
How does this all work with the weapon?I tried it and my ammo dont go away. :O.o:Also the weapon cant have a common event.