INTRODUCTION
Implementation to your project
1. Add CraftingManager to your PlayerController
2. Implement Interface Get Crafting Manager Interface and pass added CraftingManager into return value of GetCraftingManager function. You can check PlayerController from demo to compare the result.
Interface can be implemented in ClassSettings, scroll all down to Implemented Interfaces and once you click Add find GetCraftingManagerInterface.
Function to pass Crafting Manager can be found in left bottom, In MyBlueprintManel/Intrfaces double click on that function.
IMPLEMENTING INVNETORY
3. Open CraftingManager Actor Component. Under function tab you will find functions to override.Inside of them you will find example of how i implemented them exampled of DemoInventory provided.
DEFINING CRAFTING DEFINITIONS AND ID
4. This Project is non restricted to any type of itemization. Inside you will find two most commonly used types of itemization managment systems. Each item is separated DataAssets or items contained in DataTables as examples.This system is built upon 2 abstraction, CraftDEF and CraftID, i will show you right now how to create them.
For easier presentation lets say we want to allow player to craft Sword that can be built from 10 metal bars and 10 wooden planks, and our item management system is based of DataTable.
4.1 Create Item ID
Create Bluperint Class SIZZ_ItemCraftID. This is our base class.
I named it PDA_DemoCraftID.
Right Click on content browser, select miscellaneous/data assets. From list select our PDA_DemoCraftID as a parent.
Right Click on content browser, select miscellaneous/data assets. From list select our PDA_DemoCraftID as a parent.
Duplicate them 3 times, each for Sword,Wood,Metal
4.2 Create Craft Item DEF
Right Click on content browser, select miscellaneous/data assets. From list select SIZZ_CraftDefinition as a parent.
Here we need only one craft definition for our Sword.
Open DEF_Sword and here we will define, ItemToCraft and Ingredients required for that definition. As this example mentions, we want Sword that is created from 10 Metal and 10 Wood.
4.3 Transfer item data from ID
Back to PDA_DemoCraftID, you can implement interface i prepared BPI_ACS_CraftIDDataStream. It adds GetItemIdentifier and GetAllCraftingIdData functions. Assuming your Data Itemization system is DataTable, you can get GetDataTableRow as variable and set row for each Wood,Sword,Metal. You can create as many function as you want to any data you want to transfer.
Get Item Identifier in this case can be used as identificator to match itemization between other systems, like Inventory. You can check example in GetItemAmountFromInventory at CraftingManager ActorComponent
5. Allow created SwordDEF to craft.
5.1 Create DataTable of type CraftingAccessListInitializer.
5.2 Add created DA_DEF_Sword to a row.
5.3 Select CraftingManager in PlayerController in Details/Config select that DataTable.