Crafting Chance

Niroan

Member
I would like to create a % chance for the item to be crafted, and the user gets a pop up when clicking craft.
Then it will show the chance to success crafting, if it fails the materials are lost.
If it success then materials are taking form the player.
 
For that you'll need three things, a custom CraftingProcessor, CraftingOutput and CraftingMenu.

In your custom CraftingProcessor you will override the "CreateCraftingOutput" function and you will create a instance of your custom CraftingOuput class and return it with all the information of whether the crafting succeeded, what was the resulting item, etc...

Then in your custom crafting Menu you can override the "OnCraftComplete" to know the CraftingOutput and you can display your popup there to let the player know whether it was a success to not.

For computing the %chance of success you could define it on the Recipe itself or on the Item you are trying to craft as an Item Attribute. If you choose to set it on the Recipe you'll also need to make a custom Recipe type, so setting that value of the item as an ItemDefinition attribute might be easier.
 
Top