How to add enchants to items?

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

    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.

JustADev

Well-Known Member
Apr 8, 2017
379
9
18
22
Question: How do you add Enchants to Items?

CODE:

code_language.skript:
                if argument 1 is "Basic":
                    wait 1 tick
                    set {Class.%player%} to "Basic"
                    close player's inventory
                    clear player's inventory
                    set slot 0 of player's inventory to 1 iron sword with no nbt named "&eIron Sword"
                    set slot 1 of player's inventory to 1 fishing rod named "&eFishing Rod"
                    set slot 2 of player's inventory to 1 bow named "&eBow"
                    set slot 3 of player's inventory to 3 golden apples named "&eGolden Apple"
                    set slot 4 of player's inventory to 16 oak planks named "&eOak Plank"
                    set slot 5 of player's inventory to 1 mushroom stew named "&eMushroom Soup" with lore "||&eHeals &c2 ❤"
                    set slot 6 of player's inventory to 1 mushroom stew named "&eMushroom Soup" with lore "||&eHeals &c2 ❤"
                    set slot 7 of player's inventory to 1 mushroom stew named "&eMushroom Soup" with lore "||&eHeals &c2 ❤"
                    set slot 8 of player's inventory to 1 potion:8194 with no nbt named "&eSpeed I &7(3:00)"
                    set slot 9 of player's inventory to 32 arrows
                    equip player with all iron armor
                    play "SUCCESSFUL_HIT" to player at volume 1.2
                    send "&8[&cKit&8] &7You have selected the &cBasic Kit"
                    stop
 
"iron sword of sharpness 3" if you mean gui. SkRayFall has a "shiny" expression you can look into if you want it to have the effect without the text.
 
  • Like
Reactions: DavidZar
set {Class.%player%} to "Basic"
Use list variables (variables separated with double colons and not a dot), here is a quote of myself saying why you should use them:
Use list variables.

Why? Because:
  • You can loop them.
  • Delete them easier.
  • It's also easier when you want to make top lists and that stuff.
  • Other reasons I'm lazy to explain.
  • set slot 5 of player's inventory to 1 mushroom stew named "&eMushroom Soup" with lore "||&eHeals &c2 ❤"
  • set slot 6 of player's inventory to 1 mushroom stew named "&eMushroom Soup" with lore "||&eHeals &c2 ❤"
  • set slot 7 of player's inventory to 1 mushroom stew named "&eMushroom Soup" with lore "||&eHeals &c2 ❤"
You could just use a loop here, or yet better, put all those items on a list and set the slot of the looped index parsed as number - 1 to the loopeed value.

this is just useless, remove it as it isn't doing anything, the trigger will stop even without this effect.

Now, regarding your question, you just have to do it like this:
code_language.skript:
%item type% of %enchantment types%
Example:
code_language.skript:
stone sword of sharpness 3 and unbreakable 3
 
  • Like
Reactions: DavidZar
what about dyed armor?

CODE:
code_language.skript:
                    equip player with leather helmet dyed orange of protection 2
                    equip player with leather chestplate dyed orange of protection 2
                    equip player with leather leggings dyed orange of protection 2
                    equip player with leather boots dyed orange of protection 2
 
  • Like
Reactions: DavidZar
what about dyed armor?

CODE:
code_language.skript:
                    equip player with leather helmet dyed orange of protection 2
                    equip player with leather chestplate dyed orange of protection 2
                    equip player with leather leggings dyed orange of protection 2
                    equip player with leather boots dyed orange of protection 2
You can equip multiple stuff, all of that can be in one line if you want; leather armor of protection 2 should work too. Also, TuSKe has an expression to do this, look at the documentation.
 
  • Like
Reactions: DavidZar
Status
Not open for further replies.