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.

I want to enchant slot item

Discussion in 'Skript' started by rook1e, Apr 9, 2020.

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

    rook1e New Member

    Joined:
    Apr 9, 2020
    Messages:
    6
    Likes Received:
    0
    I coded enchant GUI with enchanted stone item(enchant to stone).
    Others' run in my intend.
    But, enchantment doesn't work.
    Enchant other parts' item work well.

    How can I enchant inventory's slot item?

    Code (Text):
    1. on inventory click:
    2.   if inventory name of player's current inventory contains "&r&b%player%&r's upgrade table'":
    3.     if clicked slot's type is nether star:
    4.       cancel event
    5.       set {_target} to slot 10 of player's current inventory
    6.       set {_stonez} to slot 13 of player's current inventory
    7.       set {_paperz} to slot 16 of player's current inventory
    8.  
    9.       if type of {_target} is not pickaxe or fishing rod or axe or sword or cap or boots or pants or chestpiece or bow or elytra or shield or shovel:
    10.         message "{@s} Not enchantable item." to player
    11.         close player's inventory
    12.         exit
    13.  
    14.       if display name of {_stonez} is not "&r&a&lupgradestone":
    15.         message "{@s} unvalid stone"
    16.         close player's inventory
    17.         exit
    18.  
    19.       if {_paperz} is not air:
    20.         message "{@s} unvalid paper"
    21.         close player's inventory
    22.         exit
    23.  
    24.       set {_split::*} to uncoloured line 1 of {_stonez}'s lore split at " "
    25.       set {_et} to {_split::1}
    26.  
    27.  
    28.       set {_chkenc} to {enchant_type::%{_et}%} parsed as enchantment
    29.       send {_chkenc}
    30.       set {_level} to enchant level of {_chkenc} of {_target}
    31. #     message "lv : %{_level}%" to player
    32.       if {_level} is less than {_split::2} parsed as integer:
    33.         set {_enchant_line} to "%{enchant_type::%{_et}%}% %{_split::2}%" parsed as enchantment type
    34.         enchant {_target} with {_enchant_line}
    35.         send player title "&aSuccess!" for 2 seconds
    36.         set slot 13 of player's current inventory to air
    37.       else if {_level} is not set:
    38.         set {_enchant_line} to "%{enchant_type::%{_et}%}% %{_split::2}%" parsed as enchantment type
    39.         enchant {_target} with {_enchant_line}
    40.         send player title "&aSuccess!" for 2 seconds
    41.         set slot 13 of player's current inventory to air
    42.       else:
    43.         message "{@s} &c higher level item." to player
    44.         close player's inventory
    45.         exit
    46.  
     
  2. Scholler

    Scholler Active Member

    Joined:
    Aug 6, 2018
    Messages:
    130
    Likes Received:
    9
    Error(s)?
     
  3. dxcf

    dxcf Member

    Joined:
    Apr 8, 2020
    Messages:
    26
    Likes Received:
    0
    Are you using MH version of skript?
     
  4. rook1e

    rook1e New Member

    Joined:
    Apr 9, 2020
    Messages:
    6
    Likes Received:
    0
    No error in compile

    But,
    line35 didn't work
    --- Double Post Merged, Apr 9, 2020, Original Post Date: Apr 9, 2020 ---
    What is the MH?
    I'm beginner for skript...

    Skript version is 2.4-beta9
     
  5. Scholler

    Scholler Active Member

    Joined:
    Aug 6, 2018
    Messages:
    130
    Likes Received:
    9
Thread Status:
Not open for further replies.

Share This Page

Loading...