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!

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

Solved Drag and drop

Discussion in 'Requests' started by Hartvig, Dec 12, 2019.

  1. Hartvig

    Hartvig Member

    Joined:
    Apr 18, 2017
    Messages:
    39
    Likes Received:
    1
    Category:
    Custom enchants
    Suggested name:
    Drag and drop enchantments
    Spigot/Skript Version:
    2.4-beta7
    What I want:
    Drop an book from player's inventory on to a tool and add the name of the book to the lore of the tool
     
  2. Zabrid

    Supporter

    Joined:
    Mar 2, 2019
    Messages:
    53
    Likes Received:
    1
    There are many spigot plugins that do exactly this, why not use one of them?
     
  3. Policiu

    Policiu Member

    Joined:
    Jan 28, 2017
    Messages:
    15
    Likes Received:
    0
    Since, it is marked as solved, I stopped working on this. I couldn't figure out how to get at the stored enchantments using Skript without add-ons:

    Code (Text):
    1. on inventory click:
    2.   if event-inventoryaction is swap with cursor:
    3.     set {_enchantBook} to cursor slot of player
    4.     set {_enchantItem} to clicked item
    5.     if {_enchantBook} is an Enchanted book:
    6.       cancel event
    7.       #Stuff
     
  4. Hartvig

    Hartvig Member

    Joined:
    Apr 18, 2017
    Messages:
    39
    Likes Received:
    1
    i forgot to mark it solved sry!! :3

    i figured out something and i don't mind sharing it, though the lore seems to be a bit buggy when adding multiple enchantments

    Code (Text):
    1. on inventory click:
    2.     if cursor slot of player is book named "&a&lSmelt", "&f&lEfficiency" or "&a&lFortune":
    3.         set {_nm} to name of cursor slot of player
    4.         if name of event-item is "&eYour item":
    5.             if event-item's lore doesn't contain "%{_nm}%":
    6.                 set {_a} to event-item
    7.                 cancel event
    8.                 set lore of {_a} to "%lore of {_a}%" and "%{_nm}%"
    9.                 wait 2 ticks
    10.                 set cursor slot of player to air
    11.                 set event-slot to {_a}
    12.             else:
    13.                 cancel event
    14.                 send "&7You already have that enchantment!"
     
    • Like Like x 1

Share This Page

Loading...