I'm trying to make an event so that the player can exchange 10 of one item to an NPC and he gives you an item back. The problem I'm having is that he will give you the item even if you don't have the 10. I have it set up so variable 001 is set to "Have the item (of 10) in inventory" Variable 002 is set to 10 Is this the way I go about this? I just need some guidance on this.
The... least graceless way I can come up with is simply a chain of ten nested Conditional Branches... The first checks if you have the item in stock, then removes one, the second checks for the item, then removes one, all the way to the tenth item; if at any point the player's inventory DOESN'T have the item in question, it refunds all the items that were subtracted with a message of "Sorry, not enough." If all ten are in place, the exchange is successfully made... Basically, it'd be built something like this (same thing up and down, got the middle because that'd be the most important bit): (Having a bit of trouble with image uploading, so linking to image file...) https://drive.google.com/file/d/0B7syyAkJltVAVnRzVndKMjBFMlU/view?usp=sharing It's not precisely pretty, but it's completely straightforward and self-contained.
You can use a 'Conditional Branch' command and a script call to do this. In your Conditional Branch, go to the 'Script' option located in tab 4, then enter the following: $game_party.item_number($data_items[n]) >= 10 where 'n' is the location of item in your database.
The simplest way is to use a control variable command to read the number of items from the inventory, and then use a conditional branch to check if the variable is higher or equal 10.
I've moved this thread to VX Ace Support - this is not a Tech Support issue. Please be sure to post your threads in the correct forum next time. Thank you. Control Variables to get the number of items Conditional branch to check the value