RPG Maker VX Ace

RPG Maker VX Ace

View Stats:
solidfact42 Sep 24, 2015 @ 9:32pm
Setting Up a Conditional for Multiple Items
I'm attempting to set up a conditional branch which will check to see if several of the same item (5 of them, in fact) are in the inventory. So far, the only conditional branch option regarding items will only check for a singular item. There doesn't seem to be an option for number of items in the Variable section of the conditional branch, either. How would one go about setting up a command which checks to see if there is a sufficient number (or more) of the given item?
< >
Showing 1-10 of 10 comments
Resi ♥ Sep 24, 2015 @ 9:48pm 
If you are supposed to collect these items at specific areas, you can use a variable which adds +1 whenever you get that item and you can use in your conditional branch:
if variable_name == 5, run event.

If this is not the case, I'll let someone else chime in, as I lack information.
solidfact42 Sep 24, 2015 @ 10:11pm 
Unfortunately, this is not the case. I'd wanted the item to be a common one which could be gotten from a variety of enemies, from a merchant, or found in a chest. It's also a consumable item, which means any of the party could have used one or more.
Mystix Sep 24, 2015 @ 10:48pm 
You can also put a conditional under a conditional, multiple times as need be.
solidfact42 Sep 24, 2015 @ 11:08pm 
I could try that. Unfortunately, I don't think this will work with multiples of the same item. It would likely check for said item and come back with a "yes" for each check even if there is only one of them, as opposed to the five one is meant to have.
Resi ♥ Sep 24, 2015 @ 11:19pm 
Alright, I figured it out. Just took a quick look at the scripts.

Under conditional branch, go to the last page and select the script button. Paste code like this:
$game_party.item_number($data_items[ITEM_ID]) == ITEM_AMOUNT

Replace ITEM_ID with the database number for the item and the ITEM_AMOUNT is the amount you want to have.

as well, you can replace == with different operators such as >= (equal to or greater), <= (equal to or less), >, <, != (not equal to).
It should look like this

I'm going to add onto this. If you want the player to have 2 specific items in their inventory, you can do something like this.
$game_party.item_number($data_items[1]) == 5 && $game_party.item_number($data_items[2]) == 1
In this scenario, since I'm using a default project, this is checking if the player has 5 Potions and 1 hi-potion in their inventory. The event page for that looks like this.

To go even further, you can use || to denote OR. Which means, if the player has 5 potions OR 1 Hi-potion in their inventory, the text will be displayed.

|| is OR
&& is AND

I hope this is a suitable answer to your problem.
Last edited by Resi ♥; Sep 24, 2015 @ 11:23pm
Hajami Sep 25, 2015 @ 2:02am 
Helpfull answer for me but :)
You Guys are realy hard to beginners. Why not using the simple inbuild Eventcommand Way.

Control Variable Eventcommand
Set Variable1 = Number of Potions in Inventory (You can choose it in that Command).
Conditional Branch
Variable1 equal or more than 5
If yes....stuff happens
you dont have 5 or more Potions.
Last edited by Hajami; Sep 25, 2015 @ 2:03am
Resi ♥ Sep 25, 2015 @ 10:35am 
Ah yes, it would appear Hajami is also correct. This can be done purely via events with something that looks like this - http://i.imgur.com/YmEHfRL.png
Hajami Sep 25, 2015 @ 11:47am 
That just half right, it has to be equal or more, in your picture its just equal.
If he has more from that Item theConditional Branch would say its false and the player would get frustrated because he got the damn 5 potions, he actually got more, but mr questman
stays cold :).
Last edited by Hajami; Sep 25, 2015 @ 11:48am
solidfact42 Sep 25, 2015 @ 7:20pm 
Thank you so much for all of this. I'll futz around with the game I'm designing and see which option works best for me. You may have also solved the problem I was having attempting to set up a crafting mechanic for another game.
Brigg Jan 17, 2017 @ 10:46pm 
A little late, but you just needed to assign the item in Inventory to a variable. And then do a Conditional check of that variable.

Control Variables: [001] = [Item] in Inventory
Conditional Branch: [001] >= 5
< >
Showing 1-10 of 10 comments
Per page: 15 30 50