How do I do a specific amount of items to use on crafting?

Not favoritedFavorited Favorited 0 favourites
  • 7 posts
From the Asset Store
Template for maintaining an inventory with crafting possibilities. Completely documented in text and video.
  • Hi, I was doing my crafting system and wanted to, for example, make a craftable wooden shield that cost 2 wood items to craft. How do I do this?

    Here is the cp3 file: dropbox.com/t/oXYL4mnXJG67vgeY

    NOTE: I'm using an array that registers the crafts, the crafting mechanic is at HUD>Inventory>Crafting System, and you can test it at the test layout.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I don't have a sub right now and I'd need one to assist again on this but basically what you are looking at is the 'canCraft' section which for the moment only checks if the item is in the array. You'll need to add a quantity column to your recipe on column 2 where 0 is the item and 1 is the first ingredient add the quantity required on your sheet. Then on 'for each craftingicon' you'll need to check as well as item1 appearing in the inventory that you also have enough quantity in your inventory required for the recipe. You'll need to grab the index of the item in your inventory to check the quantity against the recipe quantity value.

  • It put it like this: (Sorry if it's hard to read)

    The crafting function:

    Checking if the item is craftable:

  • So is it working ? I think the recipe bit should be a bit shorter but I'm just doing it from reading. Like in recipes indexof crafting icon name + column should be enough and the column would be different for item 2. If you have done recipe in the format (name,ingredientA,quantity,ingredientB,quantity) columns would be 2 and 4 for example.

    Also for quantity where you're subtracting it looks ok except don't look for index of the items as they may appear in more than one recipe, always look for the index of the item name you are crafting which is the start of the recipe.

  • I did like:

    Z:0

    0:Name

    1:ItemA

    2:ItemB

    Z:1

    0:(Nothing)

    1:AmountA

    2:AmountB

  • Ah ok using Z, so all good ?

  • No, because now the amount of items used to craft aren't substracted by the amount required by the recipe, but the item to craft is CRAFTED, even, for example, the amount on the inventory is less than required

Jump to:
Active Users
There are 2 visitors browsing this topic (0 users and 2 guests)