To create a custom enchantment, is very simple and easy to do, let's start with a simple tutorial.
After 1.5.3, you can create custom enchantments using effects in your skript. All you have to do is register a enchantment with a name, this name will be used at your code to enchant items.
on skript load:
register a new custom enchantment with id name "Magic"
The id name is what you use in your code to enchants a item, in this example, we will use
Magic as custom enchantment's name.
This is the basic of creating a custom enchantment, but it's not all. It has somethings that you can hide and the plugin will use a default value and there are values that are optional. The expressions that you don't need to set if you don't want are:
[QUOTE]set max level of Magic to 10[/QUOTE]
The max level that a enchantment can have, it goes from 1 to 10, the default is 3.
[QUOTE]set rarity of Magic to 3[/QUOTE]
The rarity of enchantment, it goes from 1 (rare) to 5 (common), the default is 3.
[QUOTE]set accepted items for Magic to "Swords", "Bow" and "Armor"[/QUOTE]
The types of items that the enchantment accepts. This doesn't accept the ID or name of item, only especific values and they are:
Helmets,
Chestplates,
Leggings,
Boots,
Pickaxes,
Axes,
Shovels,
Bow and
Fishing RodAnd there are values that represents a group of groups above:
Tools:
Pickaxes,
Axes and
ShovelsArmor:
Helmets,
Chestplates,
Leggings and
BootsAll: All groups above
If this option is not set, it will use the default value,
All. You can use more than one value, it's just separate with "," or "and".
[QUOTE]set enabled for Magic to true[/QUOTE]
If true, the enchantment can be gotten on enchantment table, else, only by skript. By default is false.
The optional value doesn't have a default value, so you don't need it if you don't want it.
[QUOTE]set conflicts for Magic to Enchantment and Another_Enchantment[/QUOTE]
It will set a group of enchantments that is incompatible with the enchantment, it means that they won't be together at same item. The value is the ID name of other custom enchantments.
Here is a example of how it's should look like:
on skript load:
register a new custom enchantment with id name "Magic"
set {_enchantment} to "Magic" parsed as custom enchantment
set max level of {_enchantment} to 5
set rarity of {_enchantment} to 1
set accepted items for {_enchantment} to "Swords" and "Bow"
set lore name of {_enchantment} to "Magic Power"
After the configuration, you just have to reload the file: or you restart your server or you execute the skript effect:
[QUOTE]
reload all custom enchantments
[/QUOTE]
If everything is right, you shouldn't see any errors on console. After that, you only have to create your custom effects for the enchantment by yourself. And to do that, you have some expressions to help you.
#You can specify the level or not.
%itemtype% has custom enchantment %custom enchantment%
level of custom enchantment %custom enchantment% of %itemstack%
#You can add or remove enchantments from it.
[all] custom enchantments of %itemstack%
...