How to Create Crafting Recipes Video
What are Crafting Recipes?
A Recipe defines which items are consumed and which items are produced when crafting. You can optionally specify requirements for learning and/or using the recipe, and set chances for failure (ingredients consumed, no yield) or bonus (extra yield quantity) per recipe.
Create a Recipe
We create our recipes in the DT_Recipes data table found in the Blueprints/Variables/DataTables/ folder. Each recipe consists of the following variables:
Recipe Requirements
Each recipe in our data table has a requirements structure, here is a breakdown of those variables and how to use them.
cooking.grill of at least level 1. Our meat_feast recipe requires a cooking.pot of at least level 3 and a cooking.grill of at least level 1. On our workstation tool items we would define the same dynamic keys, and set our value for the level. In the demo world you can craft the level 3 cooking.pot from the player crafting window, or purchase it from the wandering vendor.It is worth noting that while the text that appears on the crafting recipe information for custom requirements looks similar to the dynamic data definitions used on the Item Tooltips, it does not include the full capabilities of the dynamic data system. It only offers the very basics, meaning the key will be translated and the value will be added through the format strings. Using them in this part of the system does not offer the advanced value variables such as for max value and percentages. It also does not include the custom syntax object method.
These features did not seem necessary for recipes, but if you have a good reason to use them please reach out and let me know and maybe I can work them into a future minor version release (if there is enough interest).
Locked Recipes
This version of the system introduces locked recipes, which are recipes that must first be unlocked before they can be used.
By default all recipes are unlocked. To make a recipe locked, set AutoUnlock? to false under the Requirements section of the recipe (it is true by default). Then when you are ready to unlock the recipe for the specific player, call the unlockRecipe function on that player’s AC_Inventory_Crafting component (attached to the player controller).
When a recipe is unlocked is entirely up to you. I’ve included two examples in the demo world to help get you started. There is a button near the campfire that when pressed will unlock the Meat Feast campfire recipe. There is also a usable item that will unlock the Vial of Fire player crafted recipe.
It is important to note that even if the recipe is part of a workstation, you would still call the unlockRecipe function on the player’s crafting component, and not on the workstation. Calling unlockRecipe on a workstation’s component will not do anything.