Gw Temp

Menu

Tutorial - 'Ammunition system for the DBS' by Psi

An item about RPGMaker 2000 posted on

Blurb

Allows you to select ammunition from your item menu and use it, but ONLY if a character is equipped with a gun.

Body

What this system does:

Allows you to select ammunition from your item menu and use it, but ONLY if a character is equipped with a gun.

What you need to know about:

Variables

Common Events

Add/Remove Item command

(Not completely necessary, as I'll try and take you through that, if you're a newbie. I apologise if you can't follow this, but I've tried my best.)

Okay, let's get started!

Firstly I would like to say that this is really simple. I spent the best part of two hours trying to get this working and then kicked myself when I realised it only used about 8 lines of code.

What you need to do first is create a "Pistol Bullet" skill in the Database (Press F8 to get it open)

Configure the damage and stuff as you wish, read on for a bit more info on that...

Next create a weapon, called a Pistol. At this point you've got two options...

Option 1) Give the weapon a boost to your Mind stat, and give it the bare-fisted battle animation of the character who will use it

Option 2) Give the weapon a boost to your Attack power, and give it an animation to represent the character clubbing the enemy over the head with it (believe you me, a gun over the head really hurts!)

Now that you've chosen this, go back and configure the Pistol Bullet skill. If the gun gave a boost to your Mind force, then change the skill so that it uses the "Mind CHance" guage to determine damage, and "Hit chance" guage if it boosted your strength. This is so the weapon is contributing to the skill's power.

Okay, create two more items.

One of them should be called "Fake Pistol Bullet." Make it a "Common Goods" and give it whatever cost and description you like.

The other should be called "Real Pistol Bullet". Give it exactly the same cost and description as "Fake Pistol Bullet" and make it a "Unique". Have it invoke the "Pistol Bullet" skill and make sure the only character capable of using it is the one who carries the gun. (Using the check boxes)

Right, now for the bit I spent two hours of punching the screen over... you can thank me later.

Go to the "Common Events" tab of the database

Name one of your events something like "Handgun"

With the drop down menu, make it a "Parallel Process"

For the sake of being able to recognize the user, I shall call the character Alex. (That's who I used for the original coding test.)

First I'll give a step by step guide to inserting the code, and show the code after so you can compare it to mine.

Select "Fork Conditions"

Check "Hero", select "Alex" and select "Item Handgun is equipped".

Add an ELSE case.

Right underneath the "Alex = Handgun is equipped" tag...

-Select "Change Variable", name a variable "Pistol Bullet" have it set it to "Fake Pistol Bullet" "owned number"

-Now "Add Item", add "Real Pistol Bullet", equivalent to the variable "Pistol Bullet"

-"Change Variable", "Pistol Bullet" variable, "Set" to 0

-"Add Item", set it to Remove 99 "Fake Pistol Bullet"s

Under the ELSE Case tag...

-"Change Variable", "Pistol Bullet" have it set it to "Real Pistol Bullet" "owned number"

-"Add Item", add "Fake Pistol Bullet", equivalent to the variable "Pistol Bullet"

-"Change Variable", "Pistol Bullet" variable, "Set" to 0

"Add Item", have it Remove 99 "Real Pistol Bullet"s

Whew! Your code should look like this... (I have a patch on RM2K so some of the text will be different. Hopefully you'll be able to identify that... otherwise hope like hell it works. Also, the variable number may be different.)

Name: (Doesn't Matter)

Event Start Conditions: Parallel Process

If Alex = Handgun is Equipped

-Change Var:Var[0001:PistolBullet][Set]-Fake Pistol Bullet Hold Amount

-Chng Item Count:[Real Pistol Bullet]V[[0001][Add]

-Change Var:Var[0001:Pistol Bullet][Set]-0

-Chng Item Count:[Fake Pistol Bullet]99[Rem]

-

:ELSE Case

-Change Var:Var[0001:PistolBullet][Set]-Real Pistol Bullet Hold Amount

-Chng Item Count:[Fake Pistol Bullet]V[0001][Add]

-Change Var:Var[0001:Pistol Bullet][Set]-0

-Chng Item Count[Real Pistol Bullet]99[Rem]

-

:End Case

This can be adapted to work with other guns (like ones which take the same ammo), but make sure you make a different event. All you need is a Fork Condition with exactly the same code, only you change the weapon that it searches for.

And of course, for different types of ammo, just use the same code but make new items and a new variable for that ammo type!

Aaand... that's it!

When you're absolutely sure it works, and only when you've finished your game, change the names of both Fake Pistol Bullet, and Real Pistol Bullet, to "Pistol Bullet". Make sure all your shops sell the "Fake Pistol Bullet"; if you are equipped with the gun then they will be exchanged for "real" ones by this Common Event. Also, make sure their costs and descriptions are exactly the same.

There is one drawback to this system: If one person is equipped with the right gun, everyone who is down as being capable of using the item will be able to use it, whether they have the weapon or not. I got round this problem by only having one gunman in my group.

I also recommend looking at the system invented by Stephen Armstrong and Hitch-hiker, found elsewhere in the tutorial section. That one's definitely worth a look.

Happy shooting! (And don't shoot me, I've got a new type of Shield technology on. And if you try then be warned that I am proficient in Level 6 Time Magic, including Meteor. So don't.)

You wanna to contact me, or send suggestions?
simonammundsen@hotmail.com