Package Name: (Vilva) Potion Crafting
UI based crafting package which allows you to easily add your own item recipes. Includes example herbs for potion crafting.
Showcase link: Crayta
🛠 INSTALLATION INSTRUCTIONS
- Install the package: (Vilva) Potion Crafting
- Set up the Inventory package if not already done
- Add the “PotionCraftingUser” template to your user template
- Add one or more “PotionCraftingTable” templates to your game world
💡 PACKAGE OVERVIEW
Interact with the PotionCraftingTable to start crafting. Take a look at the recipes on the left side. If you have the required items in your inventory you can click on them to add them as ingredients. If you match the recipe, press craft to create the item, which is then added to your inventory. There is a random chance that your item gets upgraded to a better item, or that your craft fails.
You can also use the package for a completely different use case, for example for crafting weapons.
This package consists of three main scripts:
Hover over a property to read the explanation tooltip.
The main script that does most of the work and also handles the UI widgets. The most important config parameters are at the top:
- This specifies how many different ingredient items you can enter into a craft
- A list of all the item templates you can craft. These items need the “CraftingItemScript”. The recipe book is then automatically generated from these templates
This script exists on each crafting table and has a refernce to the crafting trigger entrypoint and the camera for this table.
This script exists on each item that you want to be able to craft.
The “Ingredient” item templates don’t use this script. They use an extended “InventoryItemSpecScript”, where you have to make sure that the property “isCraftingMaterial” is set to true.
Configuration: Adding a new crafting item recipe with new ingredients
Let’s add a weapon that you can craft as an example.
Make a copy of the “IngredientBerry” template by breaking the template link and creating a new template. Call it “IngredientIronOre”.
Change the “MeshAsset” and “IconAsset” properties to “Iron Ore” by dragging the mesh on the properties. Also change the “Friendly Name”. Update your template.
Let’s make a second template “IngredientWoodenPlank” in a similar manner.
After that make a copy of the “PotionSpeed” template by breaking the template link and creating a new template. Call it “CraftingWeaponAxe”.
Change the “MeshAsset”, “IconAsset” and “Friendly Name” properties to match the axe. Also change the “Grip” to “Knife”.
Take a look at the “CraftingItemScript” on the new axe template. Remove the old ingredient entries under “Required Ingredients” and add our new templates: “IngredientIronOre” and “IngredientWoodenPlank”.
Optional: Specify the “RequiredIngredientAmount” for both of them.
Install the “Axe” package. Remove the “PotionSpeedScript” on our “CraftingWeaponAxe” template. Instead add the “meleeScript”. Update our template.
Last step: Open the user template and go to “PotionCraftingUser”. Add our new “CraftingWeaponAxe” template to the “craftingRecipeTemplates” property.
Now you can start the game and you will see the axe as the last recipe in the recipe book.
Let’s go to edit again and assign us enough iron and wooden planks to craft the item.
Now we can craft our Axe and attack with it
ℹ️ Creator Challenges and Activities
- craft-item - Called when you successfully craft a potion
❤️ SPECIAL THANKS
- Vicentek and Ekelrock for the “RPG Starter & Dungeon Master Tools” blueprint. I got the potion usage scripts from there.
- Cereal for the “Throwables” package that is used for the Explosive Flask. Also the UI is based on his “cMenu - Inventory” package.
- Nomaki for the “NUI - XP and Levelling” package. The UI Effects are based on that.
If you have any questions or feedback, reach out to me (Vilva#5980) in the Crayta Discord