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 custom enchantments {lore}

Discussion in 'Requests' started by Selvati, Jun 26, 2017.

  1. Selvati

    Selvati Active Member

    Joined:
    Jun 26, 2017
    Messages:
    190
    Likes Received:
    10
    Okay so I have been making custom lore enchantments, the last piece of this puzzle is to make a skript that allows the player to 'drag and drop' the custom enchantment book over certain items, and it should add a custom lore to the clicked item and remove 1 of the enchantment books from the player's inventory.

    I use the latest version of Spigot 1.12
    I use TuSke, Skript, skRayfall 1.9.7, Skellet, SharpSK, skQueryLime 1.11, SkStuff,Umbaska 3.3, and skUtilities 0.9.0

    So I have made this code which outputs no errors at all but it doesn't seem to be working!

    Code (Skript):
    1. on inventory click:
    2.     cursor slot of player is enchanted book named "&fSmelt I":
    3.         event-slot is a wooden_pickaxe:
    4.             cancel the event
    5.             set cursor slot of player to air
    6.             set lore of event-item to "%lore of event-slot%||&fSmelt I"
    7.             send "&aSuccess!" to the player
    I posted this on the help forums a while ago but now I want to make it a request because I've lost hope in it...
    Any help is a step towards completion, thanks in advance! <3

     
  2. Best Answer:
    Post #3 by ShaneBee, Jun 29, 2017
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Here's a snippet of my old code, be warned.. it's a bit glitchy, but hopefully you can fix it.

    Code (Skript):
    1. on inventory click:
    2.     set {_item} to cursor item of player
    3.     if "%clicked item%" is "empty_map":
    4.         if "%name of clicked item%" is "&eSCROLL: &cMana Drain":
    5.             if "%lore of clicked item%" is "||&aTo apply to a &c&nSWORD/AXE&a drag & drop it on an item in your inventory!":
    6.                 if "%clicked action%" is "swap with cursor":
    7.                     if {_item} is a sword or axe:
    8.                         if lore of {_item} does not contain "&cMana Drain I":            
    9.                             remove 1 empty map named "&eSCROLL: &cMana Drain" with lore "||&aTo apply to a &c&nSWORD/AXE&a drag & drop it on an item in your inventory!" from player
    10.                             set lore of cursor item of player to "%lore of {_item}%||&cMana Drain I"
    11.                             loop players in radius 10 around player:
    12.                                 show 50 "lava" particles at event-location for loop-player
    13.                                 play sound "ENTITY_BLAZE_HURT" to loop-player with volume 1 and pitch 2
    14.                         else:
    15.                             send "&cYour weapon already has that enchantment!"
    16.                     else:
    17.                         send "&cThat's not a right weapon to apply the enchantment to! Use &a&nSWORD/AXE"
    or use this, found this in the help section.

    Code (Skript):
    1. on inventory click:
    2.     if cursor slot of player is enchanted book:
    3.         if name of cursor slot of player is "&fSmelt I":
    4.             if event-item is any pickaxe:
    5.                 if lore of event-item doesn't contain "Smelt I":
    6.                     cancel the event
    7.                     set lore of event-item to "%lore of event-item%||&fSmelt I"
    8.                     send "&aSuccess!" to the player
    9.                     set cursor slot of player to air
     
    #2 ShaneBee, Jun 29, 2017
    Last edited by a moderator: Jun 29, 2017
    FistoF likes this.
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    That last bit you posted was my coded solution lol xD
    --- Double Post Merged, Jun 29, 2017, Original Post Date: Jun 29, 2017 ---
    For everyone asking here is my code for dragging and dropping custom enchantments, along with a premade enchantment for you, the possibilities are endless.
    Code (Skript):
    1. # Smelt Enchantment
    2. on mine:
    3.     lore of player's held item contains "Smelt I":
    4.         if event-block is stone:
    5.             play mob spawner flames at the targeted block to all players
    6.             cancel the event
    7.             set block to air
    8.             drop 1 stone bricks
    9.         if event-block is cobblestone:
    10.             play mob spawner flames at the targeted block to all players
    11.             cancel the event
    12.             set block to air
    13.             drop 1 stone
    14.         if event-block is sand:
    15.             play mob spawner flames at the targeted block to all players
    16.             cancel the event
    17.             set block to air
    18.             drop 1 plain_glass_block
    19.         if event-block is iron_ore:
    20.             play mob spawner flames at the targeted block to all players
    21.             cancel the event
    22.             set block to air
    23.             drop 1 iron_ingot
    24.         if event-block is gold_ore:
    25.             play mob spawner flames at the targeted block to all players
    26.             cancel the event
    27.             set block to air
    28.             drop 1 golden_ingot
    29.         if event-block is log:
    30.             play mob spawner flames at the targeted block to all players
    31.             cancel the event
    32.             set block to air
    33.             drop 1 charcoal
    34.         if event-block is cactus:
    35.             play mob spawner flames at the targeted block to all players
    36.             cancel the event
    37.             set block to air
    38.             drop 1 cactus green
    39.         if event-block is wet_sponge:
    40.             play mob spawner flames at the targeted block to all players
    41.             cancel the event
    42.             set block to air
    43.             drop 1 sponge
    44.         if event-block is netherrack:
    45.             play mob spawner flames at the targeted block to all players
    46.             cancel the event
    47.             set block to air
    48.             drop 1 nether_brick_item
    Code (Skript):
    1. # Drag & Drop Enchantments
    2. on mor.inventory click:
    3.     event-item is any pickaxe or shovel or axe
    4.     player's cursor slot is enchanted_book:
    5.         name of player's cursor slot is "&fSmelt I":
    6.             cancel the event
    7.             set lore of event-item to "%lore of event-item%||&fSmelt I"
    8.             wait 2 ticks
    9.             set cursor slot of player to air
    For these to work I believe you need Bensku's fork and skMorkaz.
     
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Thank you for posting it. See ya!
     
  6. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
  7. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Bensku fork already has a cursor slot expression built in
     
  8. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Can you Help with the error?
     
  9. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    I'm thinking you either need skquery or skellet for it to work... not sure
     
  10. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    I have both.
     

Share This Page

Loading...