1. Creating new recipes
Recipes in ACF are made throught data asset, to create a new crafting recipe you’d need to create a new data asset of type ACFCraftRecipeDataAsset. To create it you’d just need to right click in your content browser and select Miscellaneus -> Data Asset and select the ACFCraftRecipeDataAsset.
Configure the Data Asset to match the desired recipe, in this case:
In this sample, the structure is configured so that to craft 5 arrows we need 1 unit of metal and 3 unit of woods. Additionally the player will need to spend 3 currency.
2. Craft Items
To enable the crafting system you’d need to to add to your PlayerController an ACFItemsManagerComponent which is responsible of replicating the crafting system and an ACFCurrencyComponent to handle player’s money.
All the Crafting logic is then contained in the ACFCraftingComponent while all the buy/sell logic is inside the ACFVendorComponent. Craft component is built as a child component of the vendor one since it shares a lot of similar logics.
To turn an NPC (or any Actor) in to a Vendor, or Crafter or balcksmith etc., just add him the relative Crafting or Vendor component.
Then you’d need to configured the attached component:
ItemRecipes array needs to be configured with all the Recipes that this entity can craft while
Items array contains all the items that this entity can sell.
if the vendor can use a Currency Component, his capability of purchasing will be limite dby his own money. He’d need to have an ACFCurrencyComponent attached.
Any vendor may have a custom multiplier to be applied when selling or buying items from the base player.
The default price is the one defined inside item blueprint itself, but with this multiplier you may configure how much value an items costs when purchased compared to when sold to the vendor.
Then inside the Vendor and Crafting Components you'll find under the category “ACF” all the required functions to create/upgrade/buy/sells items from the ACFEquipmentComponent of the currently controlled character to perform the related actions together with various helpfulll checks.
Don’t forget to check the provided Crafting widgets to see an example of implementation!