Enchanter
Scripting with the Enchanter class.
An Enchanter
is a merchant that enchants items.
Fields & Properties
enchantTargets
The types of items this enchanter can enchant.
Enchanter.EnchantTargets
public
supportedItemTypes
A list of item types this enchanter can enchant.
List<ItemType>
public
supportedItems
A list of items that this enchanter can enchant.
List<Item>
public
Enchant Targets
Enchanter.EnchantTargets
is an enum
that helps define the items an enchanter can enchant.
Everything
Can enchant any item.
SpecificItemTypes
Can only enchant items of the item types listed in the supportedItemTypes
field.
SpecificItems
Can only enchant items listed in the supportedItems
field.
Creating Enchanters
It's not recommended to create enchanters at runtime, but it is possible. Enchanter
is a scriptable object which cannot be created as an asset at runtime for later use.
Enchanting
An Enchanter
requires a reference to Enchanter Items and Enchantable Items.
You can check if it's possible to enchant an item with the CanEnchant
method. The first parameter is the enchantable item, the second is the enchanter item, and the third is abool
that determines if the failure reason should be invoked. This method will return true
if the enchanter can enchant the enchantable item. Otherwise, false will be returned.
To officially enchant an item, use the TryEnchant
method. This is similar to the CanEnchant
method, except it will enchant the item if successful.
Last updated