Enchant diamond sword with list of variables

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

Expel_

New Member
Aug 23, 2020
8
0
1
18
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:
function enchantedItem(i: item) :: item:
    if {_i} is diamond sword:
        chance of 50%:
            add sharpness 10 to {_enchantments::*}
        chance of 50%:
            add flame 10 to {_enchantments::*}
        chance of 50%:
            add protection 10 to {_enchantments::*}
        
        set {_item} to {_item} of {_enchantments::*}
    return {_item}

set slot 25 of player's current inventory to enchantedItem(diamond sword)

Error:
https://gyazo.com/1a2833ec419a2d0b475c0a34cbabbd3b

Thanks. Expel.
 
First, set {_item} to the item input
Code:
set {_item} to {_i}
Then, enchant {_item}
Code:
enchant {_item} with {_enchantments::*}
 
Status
Not open for further replies.