Help - Search - Members - Calendar
Full Version: Help with ammo variables
RPG RPG Revolution Forums > Game Engines > RPG Maker XP Discussion
Short Circuit Gamer
It's probably a real simple process, But can anyone explain in simple terms for a dipshit like me how to assign ammo variables etc to various weapons and when no ammo is available to the weapon, it can't be used.
Help me plzzzzz
Thanks in advance
SCG huh.gif
kayden997


So basically, it assigns the amount of that item to that variable
Short Circuit Gamer
ok thanks, but how is that certain ammo, attached to a certain weapon?
Resource Dragon
It isn't, at least not very easily. You would have to have it run through a common event or script.

For a common event, you would have it check which weapon is equipped, then have it take away said variable when used.
If no ammo is left, it doesn't shoot.
Decedent
How are the weapons being used? (I imagine it's simply equipping them like a weapon, and not some kind of eventing). If you are using the gun in a battle this is what I would do.

Needed Variables
"Bullets in .09 Clip" (Set to 30 or however many bullets are in a clip)
"Number of .09 Bullets" (how you make the clips in the first place you can figure out, basically once made it should add item ".09 Clip" and remove 30 of the ".09 Bullets").

Needed Items
.09 Clip
.09 Bullets

Needed Common Event "Ammo Check"

Conditional Branch
Is weapon "Semi Auto" equipped
If yes
Conditional Branch is ".09 Clip" in inventory.
if yes
Conditional Branch is Variable "Bullets in .09 Clip" Greater than or equal to 1
if yes
Jump to label 'End'
else
Conditional Branch is Variable "Bullets in .09 Clip" = 0
if yes
is number of ".09 Clip" in inventory greater than or equal to 2
if yes remove 1 ".09 Clip"
set variable "Bullets in .09 Clip" to 30
else
Change Equipment 'Alexis, Weapon = None' (This is the else part for if Variable "Bullets in .09 Clip" = 0)

Label - End
(Create an End label at the very end.)

Now in every Else section of those conditional branches (like if there is no ".09 Clip" in inventory), you should have a command 'Change Equipment' (it's in the 3rd page). Select character and select weapon and change it to none. But if you have enough bullets it will skip to the end and nothing happens.

Now in the troop page, you want to run the "Ammo Check" common event at the start of every turn.

What this will do is at the start of every turn check if you have enough ammo. If you don't, the weapon will unequip. If you have more than one character it will get a little more complicated, but let's see if this makes sense to begin with.

* Completely forgot about the whole using ammo part... Id have the weapon with a status effect (like poison) attached to it called ".09 Flag". Add into the Ammo Check commen event to check if an enemy is inflicted by that state. If so, remove 1 bullet from the clip (control variable "Bullets in .09 Clip" - 1)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.