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.

Can't change lore and enchant to event-item

Discussion in 'Skript' started by Kesem Hershcovich, Aug 14, 2020.

Thread Status:
Not open for further replies.
  1. Kesem Hershcovich

    Joined:
    Jan 22, 2020
    Messages:
    4
    Likes Received:
    0
    I'm trying to make a Smelting Touch with Skript, associated with TuSKe. I tried to make the pickaxe have a chance to get the Smelting Touch "Enchantment" (A Lore With Unbreaking 1), and when I try to change the item that got enchanted's Lore, the script prints this problem when reloading it:
    Code (Text):
    1. [Server] Server thread/ERROR the lore of event-item stack can't be set to anything (smeltingtouch.sk, line 19: set lore of event-item to "&7Smelting Touch"')
    2. [Server] Server thread/ERROR event-item stack cannot be changed, thus it cannot be (dis)enchanted (smeltingtouch.sk, line 21: enchant event-item with unbreaking 1')
    3. [Server] Server thread/INFO Encountered 2 errors while reloading smeltingtouch.sk!
    The script:

    Code (Text):
    1. on mine of iron ore:
    2.     if player's tool is a pickaxe with lore "&7Smelting Touch":
    3.         clear drops
    4.         set {drop} to location of target block of player
    5.         add 0.5 to y-coordinate of {drop}
    6.         drop 1 iron ingot at {drop}
    7.    
    8. on mine of gold ore:
    9.     if player's tool is a pickaxe with lore "&7Smelting Touch":
    10.         clear drops
    11.         set {drop} to location of target block of player
    12.         add 0.5 to y-coordinate of {drop}
    13.         drop 1 gold ingot at {drop}
    14.  
    15. on enchant:
    16.     if event-item is a pickaxe:
    17.         chance of 10%:
    18.             set lore of event-item to "&7Smelting Touch"
    19.             if event-item is not enchanted with unbreaking:
    20.                 enchant event-item with unbreaking 1
    The skript works if I replace every event-item with tool, but I want it to change the item that was enchanted, not the item the player is holding.
     
    #1 Kesem Hershcovich, Aug 14, 2020
    Last edited: Aug 14, 2020
  2. DagoDuck

    Supporter +

    Joined:
    Jun 29, 2020
    Messages:
    4
    Likes Received:
    0
    I just figured something out.

    You could do something like this:

    Code (Text):
    1.  
    2. on enchant:
    3.    chance of 90%:
    4.       wait 1 tick
    5.       set {_item} to slot 0 of player's current inventory
    6.       add "&cTest" to lore of {_item}
    7.       set slot 0 of player's current inventory to {_item}
    8.  
    And you could add "enchant {_item} with xyz" if you want to
     
    #2 DagoDuck, Aug 26, 2020
    Last edited: Aug 26, 2020
  3. Shadow Klassic

    Joined:
    Sep 19, 2020
    Messages:
    20
    Likes Received:
    0
Thread Status:
Not open for further replies.

Share This Page

Loading...