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 out 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.

Enchant diamond sword with list of variables

Discussion in 'Skript' started by Expel_, May 16, 2022.

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

    Expel_ New Member

    Joined:
    Aug 23, 2020
    Messages:
    8
    Likes Received:
    0
    I am trying to make a custom enchant skript. I am currently making a list of enchantments which i intend to then apply to a diamond sword. However it gives an error.

    Code:
    Code (Text):
    1. function enchantedItem(i: item) :: item:
    2.     if {_i} is diamond sword:
    3.         chance of 50%:
    4.             add sharpness 10 to {_enchantments::*}
    5.         chance of 50%:
    6.             add flame 10 to {_enchantments::*}
    7.         chance of 50%:
    8.             add protection 10 to {_enchantments::*}
    9.        
    10.         set {_item} to {_item} of {_enchantments::*}
    11.     return {_item}
    12.  
    13. set slot 25 of player's current inventory to enchantedItem(diamond sword)
    Error:
    https://gyazo.com/1a2833ec419a2d0b475c0a34cbabbd3b

    Thanks. Expel.
     
  2. Practice

    Practice Member

    Joined:
    Apr 23, 2022
    Messages:
    37
    Likes Received:
    1
    First, set {_item} to the item input
    Code (Text):
    1. set {_item} to {_i}
    Then, enchant {_item}
    Code (Text):
    1. enchant {_item} with {_enchantments::*}
     
Thread Status:
Not open for further replies.

Share This Page

Loading...