Controlling variables by items in inventory

I am trying to make a mission style variable and I can't seem to get the variables right.

I want the character to have to battle a certain type of monster for a specific item drop and then have that trigger the event at 10 of those items.

I have seen you can do that easily with gold for Inn keepers and such.

But how can I get a variable to check if I have 10 or more of one type of item?

I tried editing the battle event for when the enemy is at 0 to control variable to adding 1, plus increasing the item by 1. But it doesn't add the item or increase the variable.

I was just hoping to get some insight here before I write my own script.
Put the Control Variables at the START of the battle rather than at the END. When the enemy reaches 0, it's battle over - no more troop event pages are run.
Put the Control Variables at the START of the battle rather than at the END. When the enemy reaches 0, it's battle over - no more troop event pages are run.
Like this.

Don't mind the graphics it's my play test project, to test all my code quickly.

preview.png
Don't run means Don't run. Therefore the event page will not run.
Don't run means Don't run. Therefore the event page will not run.
Lmao I just figured that out, I thought it ment more like if you choose not to escape. But I switched it to do it on first turn and it's working fine.

But what if the player decides to run from the battle, I don't want the item to still go to him on the first turn if he escape.
Are they evented battles? I usually disable the escape option. But if it's enabled and your battles are evented, just have -1 in the When Escape block.


If they're random battles, you're going to have to go about it in a completely different way. On your event that depends on having 10 of the items in inventory, just do a Control Variables to determine how many you have, followed by a Conditional Branch to act on whether you have enough or not.
Are they evented battles? I usually disable the escape option. But if it's enabled and your battles are evented, just have -1 in the When Escape block.

If they're random battles, you're going to have to go about it in a completely different way. On your event that depends on having 10 of the items in inventory, just do a Control Variables to determine how many you have, followed by a Conditional Branch to act on whether you have enough or not.
Yeah I think I got it handled, I am making a specific Monster to drop these items. so it's not going to be too random.

So I believe this will work out the way I want. gotta put it in the game test. and do a full test with the new beasty.

But thanks for the quick response, This helped a bunch.
I would go a different route - because if I read correctly, you don't need to know when an item was gained, you only want to know when the player has ten of them.


Control Variables : Game data : Item in inventory will load the current number of how many of that item the player has into inventory.


And then you can check that number by a conditional branch.


The only question that remains is when you want that check?


You can do that either at the beginning of a map event where you need the items, or you can make it a special common event that runs once after each battle (no matter ir random or evented), or you can place it after evented battles.

Original thread: https://forums.rpgmakerweb.com/threads/controlling-variables-by-items-in-inventory.43093/