Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

An Eventers Guide to an Ammo System

Hey guys, Terry16389 here. I've been working on a game for a while now, and the scripted ammo systems don't really seem to cut it. So, I've decided to make an Ammo System that's is Event based, and here's the tutorial of how to do it!

Required Knowledge:
Basic Eventing, and some Switch usage.

An Eventers Guide to an Ammo System

Step 1: Creating the Items

Alright, 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/G ... motut1.jpg[/IMG]

Simple, right? Right.

Next, we have to make an Item. I'll call mine '9mm Round'.

http://i7.photobucket.com/albums/y288/G ... motut2.jpg[/IMG]

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 Event

Now 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/G ... otut13.jpg[/IMG]

Step 3: Making the Conditional Branches

Right-o, now that we've got out 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/G ... motut4.jpg[/IMG]

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/G ... motut5.jpg[/IMG]

Your Common Event should now look like this:

http://i7.photobucket.com/albums/y288/G ... motut6.jpg[/IMG]

Step 4: More Conditional Branches and Switches

Now, 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/G ... motut7.jpg[/IMG]

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/G ... motut8.jpg[/IMG]

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/G ... otut14.jpg[/IMG]

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 Off

Now 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/G ... otut11.jpg[/IMG]

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 Use

Now, 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/G ... otut12.jpg[/IMG]

And voila! You're done!

Now boogie like there's no tomorrow, and enjoy your ammo system!

Also, this is what the final Common Event should look like...

http://i7.photobucket.com/albums/y288/G ... otut15.jpg[/IMG]


Extra Notes:

This can be used with systems such as the DBS, and Caldaron's Realistic ABS. Enjoy.


MAJOR EDIT: 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/G ... otut16.jpg[/IMG]

Now, another conditional branch (Once again separate from all others...) Use the following settings:

http://i7.photobucket.com/albums/y288/G ... otut17.jpg[/IMG]

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/G ... otut20.jpg[/IMG]

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/G ... otut21.jpg[/IMG]

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!
 

allos

Member

Nice tutorial, especially for me since I'm just starting.

But I do have a question, can you make the force action command depending on character? Since in the code, you force character 1 to use defend if no ammo. But I plan on having around 50+ different party members so what if Ryan(assuming it is my chara with ammo) is placed on the 4th slot, the code will still make character 1 defend without ammo. How can I bypass this?
 
You can bypass it by using a variable to, depending on which slot Ryan is in, change the variable from 1 to four, depending on which slot he's in (1 being the first slot, 4 being the last.) and with a conditional branch you can check what the variable is set to, and then from there within the conditional branch you can say

@> Conditional Branch: Varable [0001] == 1
@> Force Action: Actor No. 1, Defend, Random
@>
@> Else
@>
@> Branch End

Just create one of those for every slot for every character (Which may seem crazy, but you're the one who wants 50+ characters.) Each with the variable set to 1, 2, 3, and 4; also make sure that you force Actor 1, 2, 3, and 4, corresponding with what the variable is set to.
 

allos

Member

Thanks I'll try that :D It's not really that much, but I'm trying to make it so that you have a lot of optional characters to get, but the main chairs are only around 10 or so.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top