Check if inventory array contains 2 classes (Or more) with different quantities to create an item.

How can I check if my array contains specific classes with specific quantities within it, coming from another array, which in this case would be recipes.

i’d use gameplay tags instead of classes but works for either,

loop over your inventory, check if the item class/tag is contained in your recipe array, if true, add found item to a new array (for use), remove the item from your recipe array since its matches, check if recipe array is empty, if so break the loop and return successful.

if the inventory loop completes then the recipe failed

1 Like

Hello, thank you very much for your response. I’ve been really busy the last few days and haven’t even looked at the forums, my dog died… :frowning: . And yes, that’s more or less my idea, but in my case, I check with a For each loop with break for my recipe. If a single requirement fails, we stop the loop and declare that that recipe cannot be crafted because the player will no longer have the necessary items. If the loop reaches the end of the AND loop successfully, the recipe is valid to be crafted. And in the end we can check a simple local variable to avoid goind straight to the end requirement. In my case, this was the trick, but I only had it after I studied your suggestion. Thanks again Auran13! :slight_smile: