Solved Custom enchantment

  • 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!

Status
Not open for further replies.

Mattllama987

Supporter
Aug 5, 2018
225
7
18
Hello, im making a custom enchantment, and seem to be stuck with it. Im not 100% sure what is wrong and why its only adding 1 lvl to the enchantment. I need it to stop and 5 and no more, but when i apply the enchant, it stops at 1. I updated skript from a older version and im not sure if there were big changes or not? But i get no errors with the code. It just wont add 1 lvl after i apply it.

Skript version: 2.4
server version: 1.14.4

CODE:

Code:
options:
    enchantments: Fortune|Efficiency|Explosive|Earthquake|Night Vision|Repair|Mining Crate|fulminis|Rings|Enlighted|Hardened|Poisoned|Frozen|Revulsion|Cursed|Gooey|Deathbringer|Thundering Blow|Vampire|Blind|Jump|Speed

function pickdrill(P: player):
    if lore of {_P}'s held item doesn't contain colored "&bDrill 5":
        if {rings::%{_P}%} is more than or equal to 100:
            remove 100 from {rings::%{_P}%}
            set {_l::*} to lore of {_P}'s tool
            set {_enc} to "&bDrill"
            add 1 to {_enchantments::total}
            set {_total} to 1
            loop {_l::*}:
                delete {_l2::*}
                set {_l2::*} to uncolored loop-value parsed as "%text% %integer%"
                {_l2::*} is set
                add {_l2::2} to {_total}
                if {_l2::1} is uncolored {_enc}:
                    if {_l2::2} >= 5:
                        send "&c(&4!&c) &7Sorry, but you are at the max level." to {_P}
                        stop
                    set {_b} to true
                    add 1 to {_l2::2}
                    set {_l::%loop-index%} to "&e%{_enc}% %{_l2::2}%"
                set {_level::%{_l2::1}%} to {_l2::2}
            send "Total: %{_total}%" to {_P}
            set {_l::*} to lore of {_P}'s tool
            set line 1 of lore of {_P}'s held item to "&a&m===&f %{_total}% &aEnchantments &a&m==="
            if {_b} is not set:
                wait 1 ticks
                set line 2 of lore of {_P}'s held item to "&9&nPickaxe Information"
                wait 1 ticks
                add "&e%{_enc}% 1" to lore of {_P}'s tool
            set {_enc::*} to split "{@enchantments}" at "|"
            loop {_enc::*}:
                set {_lvl2::%loop-index%} to {_level::%loop-value%} ? 0
        else:
            send "&c(&4!&c) &7Sorry, but you don't have rings!" to {_P}
    else:
        send "&c(&4!&c) &7Sorry, but you are at the max level!" to {_P}

Thanks!
~Matt
 
Hello, Matt! First of all, update your Skript again. If you ever run in to problems with Skript, don't go to older versions. The chances of an older version being better than the newer version is very low. I have no current solution to this problem, you will need to provide more information (Errors, any problems previously, ect)
 
Thank you for getting back with me! But i have resolved the issue i was having. I forgot to set this as solved. Have a fantastic day! :emoji_slight_smile:
 
Status
Not open for further replies.