The included crafting system is a simple example of how to use the item system to produce new items using current items. You can use the included system to create multiple crafting stations all with different crafting recipes.
By default the crafting system is not enabled. To enable it you need to manually add the AC_Crafting component to your player controller, just like you did when you added the AC_InventoryItemSystem. After that the crafting station will show the available recipes. I will change the way this is enabled and disabled to match the other systems in a future version of this asset.
Crafting only occurs while you are the crafting station with the window open. To make this functionality persists with the window closed, or to add crafting to the player will require you to make modifications to this system.
Creating recipes is handled in the DT_Recipes data table. Each recipe offers the following fields:
RecipeTable This is the identifier for the crafting station that the recipe can be produced at. See the next part instructions on setting up a new crafting station.
RecipeName This is the name of the recipe as you would like for it to appear inside the crafting UI. It does not need to match the name of the item being produced by the recipe.
RecipeDescription Just like the recipe name, but if you want to add a unique description to the recipe this is how you would do it. The description is only visible when the recipe is selected.
RecipeFlavorText Same as the description however text is highlighted in gold. Only visible on the recipe information window when the recipe is selected.
RecipeIcon You can use the same icon you use for the item if you wish, or you can use a completely different one, choice is yours, this is where you set it.
RecipeSecondsToMake This is how long, in seconds, it will take to attempt crafting this recipe once.
RecipeSuccessChance This is the success chance of actually producing the item from this recipe. If it is less then one there is a chance the player will fail the craft and lose their materials.
RecipeBonusChance In moments of great success comes the opportunity for bonus production. An additional dice roll is done during the crafting process to see if a bonus in yield of items should be awarded to the player. You should only really use this with things like consumables as the bonus will produce additional quantities, which may not make much sense for something like a weapon.
RecipeBonusMultiplierMin When a bonus roll hits the money, another roll will be made between the value of this variable and the value of RecipeBonusMultiplierMax. The value that this roll produces will determine the quantity multiplier used when awarding the bonus. This multiplier is applied to the yielded amount. So if your recipe produces 4 of one item, and the bonus roll triggers and says the bonus multiplier is 5x your recipe will produce 20 of the item.
RecipeBonusMultiplierMax This works with the RecipeBonusMultplierMin, but this value is the higher end of the scale.
RecipeIngredients All of these items and the quantity of each is required in the player’s inventory to produce the items in the RecipeYield.
RecipeYield These are the items that are produced after consuming the RecipeIngredients, and if the success roll is completed. Each RecipeYield expects an ItemRowName (the item being produced), a min and max quantity (a dice will be rolled to determine how many they player gets) and any override item data you may want to apply to the crafted version. You can produce multiple items with your yield, just add additional items to the array in the data table.
After recreating your recipe you should be able to see it in the crafting station you selected for the RecipeType. If it is a new recipe type not associated with a crafting station follow the instructions in the next part to set that up.
First edit the E_RecipeTables enum in the Blueprints/Variables/Enums folder and add a new item to identify your recipe table.
Next you just need to add a copy of the BP_Interactable_RecipeTable in the Blueprints/Interactables/RecipeTables folder into your world and set the RecipeTableType value to your new enum.
You should make a child blueprint of this BP_Interactable_RecipeTable for each of your crafting stations to customize the look and easily reproduce them throughout your game, drop the child in your world instead of the BP_Interactable_RecipeTable base.
To change the UI that appears when a recipe station is loaded will require you to modify the TryShowRecipeTable function inside the UI_ItemSystem. Near the start of the function is a select node which lets you specify the UI. The default view (UI_RecipeTable_Craft in the UIs/RecipeTables/Craft folder) is set to all current types and will be used if you do not provide a type.