Custom Enchantments

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Le4ft

Member
Jun 26, 2023
20
0
1
Hi,
I just want to ask, if there is some possible way to create custom enchantments with some addon (i tried TuSKe, but its not working on 1.8), I'm trying to find some solution but the only thing I found is to make it through lores. I'm trying to create something like lore builder, where I can add/register lores and then they can be applied to items with Mystic Well (custom enchant)

Does anyone have any idea how can I make this or what would be the best way how to do that?
Thanks for help
 
Whenever I have made custom enchantments, I have never really used addons. I just have an item with a set lore and then to check the lore on an event that is called. Here is a simple example:

Code:
on right click holding iron sword:
    if line 1 of lore of player's tool is "&7Speed I":
        if {del::%player's uuid%} isn't set:
            set {del::%player's uuid%} to 1
            execute console command "effect give %player% speed 20 3 true"
            send "%{Serv}% &bSpeed: &aenabled" to player
            wait 20 seconds
            send "%{Serv}% &bSpeed: &cdisabled" to player
            clear {del::%player's uuid%}
        else:
            send "%{Serv}% &bSpeed is already enabled!" to player

However, if you wish to add multiple levels of a custom enchantment, you would definitely want to use functions to check and do the proper thing accordingly to prevent tons of lines like in the example I provided as otherwise your code will start looking sloppily & pretty long.
 
Whenever I have made custom enchantments, I have never really used addons. I just have an item with a set lore and then to check the lore on an event that is called. Here is a simple example:

Code:
on right click holding iron sword:
    if line 1 of lore of player's tool is "&7Speed I":
        if {del::%player's uuid%} isn't set:
            set {del::%player's uuid%} to 1
            execute console command "effect give %player% speed 20 3 true"
            send "%{Serv}% &bSpeed: &aenabled" to player
            wait 20 seconds
            send "%{Serv}% &bSpeed: &cdisabled" to player
            clear {del::%player's uuid%}
        else:
            send "%{Serv}% &bSpeed is already enabled!" to player

However, if you wish to add multiple levels of a custom enchantment, you would definitely want to use functions to check and do the proper thing accordingly to prevent tons of lines like in the example I provided as otherwise your code will start looking sloppily & pretty long.
Thanks a lot, but do you have some ideas how to make something like custom enchant - I'm calling it Mystic Well, I created custom GUI and when you put the item into the Mystic Well it will add random lore of the custom enchantment to item, but I don't know how to do that (the function that will register all the lores and randomly selects one lore that will apply to the item)
 
To randomize an enchant you should add all possible custom enchants to a list variable.

Ie:
Code:
add “TestEnchant” to {enchants::*}

You can then select a random element from that list to randomize it. To randomize the level you could do something like:

Code:
set {_n} to a random number between 1 and 5
set {_ench} to a random element from {enchants::*}
add “&7%{_ench}% %{_n}%” to line 1 of lore of player’s tool

Keep in mind, you can use an Skript addon to make the enchant numbers convert to Roman Numerals. I hope this helps!
 
To randomize an enchant you should add all possible custom enchants to a list variable.

Ie:
Code:
add “TestEnchant” to {enchants::*}

You can then select a random element from that list to randomize it. To randomize the level you could do something like:

Code:
set {_n} to a random number between 1 and 5
set {_ench} to a random element from {enchants::*}
add “&7%{_ench}% %{_n}%” to line 1 of lore of player’s tool

Keep in mind, you can use an Skript addon to make the enchant numbers convert to Roman Numerals. I hope this helps!
which is that addon?