How to Check for Multiple of the Same Item

Hi guys!

I was wonder if there was a way I could check for multiple items at the same time in one script call.

Basically I want to make a basic crafting system without a huge fancy script, and I want to be able to check for multiple items with an ID value and make sure the player has enough of the items with said ID value, all in one script call.

Ex:

Player wants to craft item "Fork Lance"

Required Items:

2 Flotsam

3 Wood

2 Shells

Script then checks the player inventory for all 3 item IDs and then checks that there are enough of said item in the inventory.

Thanks for the help!
You could bind items to variables, then have Conditional Branches that check for a total number of that item's variable.

You'd only really need a script to make a crafting menu that shows the items and highlights them, etc; there's custom menu scripts available already; if you wanted the variable checking in the script itself, that's pretty easy to code; it's also easy to do in pure eventing.
In another game I'd been working on I did the crafting by checking for every subsequent item and it was tedious.

I have no idea how to script and I don't actually need a menu. Is there no way to call it in event as a script like;

check item id in player inventory - true/false (once for each id)

x number of item id = y (again once for each id)

if both = true, activate switch ID z

I can get around it with item variable binding, but that can also be tedious and I'm not quite sure how to do it properly.
Script then checks the player inventory for all 3 item IDs and then checks that there are enough of said item in the inventory.
I think you mean event in this part, not script.  In RM scripts and events are 2 very different things, and you need to be clear in your terminology, otherwise a lot of confusion can occur.

If you don't want to use a script, it can be done in a straightforward way in events, but it will be tedious (probably very tedious).  You will have to choose which option you find least bad.
I think you mean event in this part, not script.  In RM scripts and events are 2 very different things, and you need to be clear in your terminology, otherwise a lot of confusion can occur.
No, actually I do mean script. By script, I mean the in event script. As in you use a script call in an event, and I'm referring to the script being called.
If urbusing the script call conditional, you could always do

If a and b and c and so on
What do you mean by that exactly? In my description?
Ibmean you can do

If $game_variables[1] == 2 and $game_variables[2] == 5 and so... on

As a condition so you only use 1 conditional to check for all required itens
Alright, that makes a little more sense
No, actually I do mean script. By script, I mean the in event script. As in you use a script call in an event, and I'm referring to the script being called.
That is not a script in RM  terminology.  It is, as you say, a script call (i.e. a call to a script).  Scripts are what you see in the script editor.  You do not have scripts in events.

You can, of course, use any form of words you like, but the chances are high that you will be misunderstood and potentially waste other peoples' time as they are quite likely to think you mean something else.
That is not a script in RM  terminology.  It is, as you say, a script call (i.e. a call to a script).  Scripts are what you see in the script editor.  You do not have scripts in events.

You can, of course, use any form of words you like, but the chances are high that you will be misunderstood and potentially waste other peoples' time as they are quite likely to think you mean something else.
My appologies, I'm still new to RM technology in the sense
np.

Everything ends up with its own specialist terminology/jargon and I think in some other engines eventing is called scripting, so it can get very confusing.
It can be done by pure eventing, and a lot faster than that:

check item id in player inventory - true/false (once for each id)


x number of item id = y (again once for each id)


if both = true, activate switch ID z
Use the control variable command to get the number:


control variable:game data:item in inventory


then use conditional branch var >= number needed


If the item is not in inventory, the control variable will load zero - no need to check the existance of the item in extra lines.


The script line from Engr. Adiktuzmiko above still needs to fill the variables with the numbers, so it only combines several conditional branches into one line.


I suggest you follow the first link in my signature (starting point) and work through the tutorials linked there, especially the "Variables Guide" as that will help you understand how to use variables more effectively.
Thank you Andar, this really helped. I've got my issue all solved!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-check-for-multiple-of-the-same-item.44500/