Enchant help

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

LeeifMR

Member
Oct 2, 2024
27
1
3
I am making a skript so I can quickly make items, but I am getting an error at the 'enchant player's tool with efficiency {_eAmount}', how come?
Code:
command /createitem [<text>] [<text>] [<number>] [<number>]:
    aliases: /createi, /citem
    permission: op
    trigger:
        if arg-1 is "help":
            send "&eUsage: /createitem <type> <name> <enchant1> <enchant2>"
            send "&7Types: pick, sword, armor"
            send "&7Example: /createitem pick &bEpicPickaxe 5 3"
        else if arg-1 is "pick":
            if player's tool is a pickaxe:
                if arg-2 is set:
                    if arg-3 is set:
                        if arg-4 is set:
                            set {_eAmount} to arg-3
                            set {_foAmount} to arg-4
                            set name of player's tool to colored arg-2
                            wait 3 ticks
                            enchant player's tool with efficiency {_eAmount}
                            enchant player's tool with fortune {_foAmount}
                            wait 3 ticks
                            make player execute command "/ie hide enchants"
                            wait 3 ticks
                            make player execute command "/ie attribute add flying_speed 2"
                            wait 3 ticks
                            make player execute command "/ie hide attributes"
                            wait 3 ticks
                            make player execute command "/ie unbreakable"
                            wait 3 ticks
                            make player execute command "/ie hide unbreakable"
                            wait 3 ticks
                            add "&#007FFF⛏ &f&lEfficiency: &a+%{eAmount}%" to lore of player's tool
                            wait 3 ticks
                            add "&a &f&lFortune: &a+%{foAmount}%" to lore of player's tool
                            wait 3 ticks
                            add "&d &f&lTelekinesis" to lore of player's tool
                            wait 3 ticks
                            add "&c &f&lSmelt" to lore of player's tool
                            send "&eSuccessfully added all enchantments to your pickaxe!"
                else:
                    send "&cIncorrect format, please do /citem help for more information."
 
I am making a skript so I can quickly make items, but I am getting an error at the 'enchant player's tool with efficiency {_eAmount}', how come?
Code:
command /createitem [<text>] [<text>] [<number>] [<number>]:
    aliases: /createi, /citem
    permission: op
    trigger:
        if arg-1 is "help":
            send "&eUsage: /createitem <type> <name> <enchant1> <enchant2>"
            send "&7Types: pick, sword, armor"
            send "&7Example: /createitem pick &bEpicPickaxe 5 3"
        else if arg-1 is "pick":
            if player's tool is a pickaxe:
                if arg-2 is set:
                    if arg-3 is set:
                        if arg-4 is set:
                            set {_eAmount} to arg-3
                            set {_foAmount} to arg-4
                            set name of player's tool to colored arg-2
                            wait 3 ticks
                            enchant player's tool with efficiency {_eAmount}
                            enchant player's tool with fortune {_foAmount}
                            wait 3 ticks
                            make player execute command "/ie hide enchants"
                            wait 3 ticks
                            make player execute command "/ie attribute add flying_speed 2"
                            wait 3 ticks
                            make player execute command "/ie hide attributes"
                            wait 3 ticks
                            make player execute command "/ie unbreakable"
                            wait 3 ticks
                            make player execute command "/ie hide unbreakable"
                            wait 3 ticks
                            add "&#007FFF⛏ &f&lEfficiency: &a+%{eAmount}%" to lore of player's tool
                            wait 3 ticks
                            add "&a &f&lFortune: &a+%{foAmount}%" to lore of player's tool
                            wait 3 ticks
                            add "&d &f&lTelekinesis" to lore of player's tool
                            wait 3 ticks
                            add "&c &f&lSmelt" to lore of player's tool
                            send "&eSuccessfully added all enchantments to your pickaxe!"
                else:
                    send "&cIncorrect format, please do /citem help for more information."
Because you have to parse it as an enchant (The enchanment type + number)
 
Code:
command /enchanttool <text> <number>:
    trigger:
        if player's tool is not air:
            enchant player's tool with "%arg-1% %arg-2%" parsed as enchantment type
            send "&aYou have successfully enchanted your %player's tool% with %arg-1% %arg-2%!"

^ This is only an example
||



Full code:

Code:
command /createitem [<text>] [<text>] [<number>] [<number>]:
    aliases: /createi, /citem
    permission: op
    trigger:
        if arg-1 is "help":
            send "&eUsage: /createitem <type> <name> <enchant1> <enchant2>"
            send "&7Types: pick, sword, armor"
            send "&7Example: /createitem pick &bEpicPickaxe 5 3"
        else if arg-1 is "pick":
            if player's tool is a pickaxe:
                if arg-2 is set:
                    if arg-3 is set:
                        if arg-4 is set:
                            set {_eAmount} to arg-3
                            set {_foAmount} to arg-4
                            set name of player's tool to colored arg-2
                            wait 3 ticks
                            enchant player's tool with "efficiency %{_eAmount}%" parsed as enchantment type
                            enchant player's tool with "fortune %{_eAmount}%" parsed as enchantment type
                            wait 3 ticks
                            make player execute command "/ie hide enchants"
                            wait 3 ticks
                            make player execute command "/ie attribute add flying_speed 2"
                            wait 3 ticks
                            make player execute command "/ie hide attributes"
                            wait 3 ticks
                            make player execute command "/ie unbreakable"
                            wait 3 ticks
                            make player execute command "/ie hide unbreakable"
                            wait 3 ticks
                            add "&#007FFF⛏ &f&lEfficiency: &a+%{eAmount}%" to lore of player's tool
                            wait 3 ticks
                            add "&a &f&lFortune: &a+%{foAmount}%" to lore of player's tool
                            wait 3 ticks
                            add "&d &f&lTelekinesis" to lore of player's tool
                            wait 3 ticks
                            add "&c &f&lSmelt" to lore of player's tool
                            send "&eSuccessfully added all enchantments to your pickaxe!"
                else:
                    send "&cIncorrect format, please do /citem help for more information."