1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to add enchants to items?

Discussion in 'Skript' started by JustADev, Aug 1, 2017.

Thread Status:
Not open for further replies.
  1. JustADev

    JustADev Well-Known Member

    Joined:
    Apr 8, 2017
    Messages:
    380
    Likes Received:
    9
    Question: How do you add Enchants to Items?

    CODE:

    Code (Skript):
    1.                 if argument 1 is "Basic":
    2.                     wait 1 tick
    3.                     set {Class.%player%} to "Basic"
    4.                     close player's inventory
    5.                     clear player's inventory
    6.                     set slot 0 of player's inventory to 1 iron sword with no nbt named "&eIron Sword"
    7.                     set slot 1 of player's inventory to 1 fishing rod named "&eFishing Rod"
    8.                     set slot 2 of player's inventory to 1 bow named "&eBow"
    9.                     set slot 3 of player's inventory to 3 golden apples named "&eGolden Apple"
    10.                     set slot 4 of player's inventory to 16 oak planks named "&eOak Plank"
    11.                     set slot 5 of player's inventory to 1 mushroom stew named "&eMushroom Soup" with lore "||&eHeals &c2 ❤"
    12.                     set slot 6 of player's inventory to 1 mushroom stew named "&eMushroom Soup" with lore "||&eHeals &c2 ❤"
    13.                     set slot 7 of player's inventory to 1 mushroom stew named "&eMushroom Soup" with lore "||&eHeals &c2 ❤"
    14.                     set slot 8 of player's inventory to 1 potion:8194 with no nbt named "&eSpeed I &7(3:00)"
    15.                     set slot 9 of player's inventory to 32 arrows
    16.                     equip player with all iron armor
    17.                     play "SUCCESSFUL_HIT" to player at volume 1.2
    18.                     send "&8[&cKit&8] &7You have selected the &cBasic Kit"
    19.                     stop
     
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,010
    Likes Received:
    138
    "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.
     
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,010
    Likes Received:
    138
    Use list variables (variables separated with double colons and not a dot), here is a quote of myself saying why you should use them:
    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 (Skript):
    1. %item type% of %enchantment types%
    Example:
    Code (Skript):
    1. stone sword of sharpness 3 and unbreakable 3
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,010
    Likes Received:
    138
    what about dyed armor?

    CODE:
    Code (Skript):
    1.                     equip player with leather helmet dyed orange of protection 2
    2.                     equip player with leather chestplate dyed orange of protection 2
    3.                     equip player with leather leggings dyed orange of protection 2
    4.                     equip player with leather boots dyed orange of protection 2
     
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,010
    Likes Received:
    138
    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.
     
Thread Status:
Not open for further replies.
Loading...