Solved Drag and drop custom enchantments {lore}

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

Selvati

Active Member
Jun 26, 2017
190
10
18
22
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_language.skript:
on inventory click:
    cursor slot of player is enchanted book named "&fSmelt I":
        event-slot is a wooden_pickaxe:
            cancel the event
            set cursor slot of player to air
            set lore of event-item to "%lore of event-slot%||&fSmelt I"
            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
 
Here's a snippet of my old code, be warned.. it's a bit glitchy, but hopefully you can fix it.

code_language.skript:
on inventory click:
    set {_item} to cursor item of player
    if "%clicked item%" is "empty_map":
        if "%name of clicked item%" is "&eSCROLL: &cMana Drain":
            if "%lore of clicked item%" is "||&aTo apply to a &c&nSWORD/AXE&a drag & drop it on an item in your inventory!":
                if "%clicked action%" is "swap with cursor":
                    if {_item} is a sword or axe:
                        if lore of {_item} does not contain "&cMana Drain I":            
                            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
                            set lore of cursor item of player to "%lore of {_item}%||&cMana Drain I"
                            loop players in radius 10 around player:
                                show 50 "lava" particles at event-location for loop-player
                                play sound "ENTITY_BLAZE_HURT" to loop-player with volume 1 and pitch 2
                        else:
                            send "&cYour weapon already has that enchantment!"
                    else:
                        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_language.skript:
on inventory click:
    if cursor slot of player is enchanted book:
        if name of cursor slot of player is "&fSmelt I":
            if event-item is any pickaxe:
                if lore of event-item doesn't contain "Smelt I":
                    cancel the event
                    set lore of event-item to "%lore of event-item%||&fSmelt I"
                    send "&aSuccess!" to the player
                    set cursor slot of player to air
 
Last edited by a moderator:
  • Like
Reactions: FistoF
Here's a snippet of my old code, be warned.. it's a bit glitchy, but hopefully you can fix it.

code_language.skript:
on inventory click:
    set {_item} to cursor item of player
    if "%clicked item%" is "empty_map":
        if "%name of clicked item%" is "&eSCROLL: &cMana Drain":
            if "%lore of clicked item%" is "||&aTo apply to a &c&nSWORD/AXE&a drag & drop it on an item in your inventory!":
                if "%clicked action%" is "swap with cursor":
                    if {_item} is a sword or axe:
                        if lore of {_item} does not contain "&cMana Drain I":           
                            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
                            set lore of cursor item of player to "%lore of {_item}%||&cMana Drain I"
                            loop players in radius 10 around player:
                                show 50 "lava" particles at event-location for loop-player
                                play sound "ENTITY_BLAZE_HURT" to loop-player with volume 1 and pitch 2
                        else:
                            send "&cYour weapon already has that enchantment!"
                    else:
                        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_language.skript:
on inventory click:
    if cursor slot of player is enchanted book:
        if name of cursor slot of player is "&fSmelt I":
            if event-item is any pickaxe:
                if lore of event-item doesn't contain "Smelt I":
                    cancel the event
                    set lore of event-item to "%lore of event-item%||&fSmelt I"
                    send "&aSuccess!" to the player
                    set cursor slot of player to air
That last bit you posted was my coded solution lol xD
[doublepost=1498757005,1498756856][/doublepost]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_language.skript:
# Smelt Enchantment
on mine:
    lore of player's held item contains "Smelt I":
        if event-block is stone:
            play mob spawner flames at the targeted block to all players
            cancel the event
            set block to air
            drop 1 stone bricks
        if event-block is cobblestone:
            play mob spawner flames at the targeted block to all players
            cancel the event
            set block to air
            drop 1 stone
        if event-block is sand:
            play mob spawner flames at the targeted block to all players
            cancel the event
            set block to air
            drop 1 plain_glass_block
        if event-block is iron_ore:
            play mob spawner flames at the targeted block to all players
            cancel the event
            set block to air
            drop 1 iron_ingot
        if event-block is gold_ore:
            play mob spawner flames at the targeted block to all players
            cancel the event
            set block to air
            drop 1 golden_ingot
        if event-block is log:
            play mob spawner flames at the targeted block to all players
            cancel the event
            set block to air
            drop 1 charcoal
        if event-block is cactus:
            play mob spawner flames at the targeted block to all players
            cancel the event
            set block to air
            drop 1 cactus green
        if event-block is wet_sponge:
            play mob spawner flames at the targeted block to all players
            cancel the event
            set block to air
            drop 1 sponge
        if event-block is netherrack:
            play mob spawner flames at the targeted block to all players
            cancel the event
            set block to air
            drop 1 nether_brick_item

code_language.skript:
# Drag & Drop Enchantments
on mor.inventory click:
    event-item is any pickaxe or shovel or axe
    player's cursor slot is enchanted_book:
        name of player's cursor slot is "&fSmelt I":
            cancel the event
            set lore of event-item to "%lore of event-item%||&fSmelt I"
            wait 2 ticks
            set cursor slot of player to air

For these to work I believe you need Bensku's fork and skMorkaz.
 
That last bit you posted was my coded solution lol xD
[doublepost=1498757005,1498756856][/doublepost]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_language.skript:
# Smelt Enchantment
on mine:
    lore of player's held item contains "Smelt I":
        if event-block is stone:
            play mob spawner flames at the targeted block to all players
            cancel the event
            set block to air
            drop 1 stone bricks
        if event-block is cobblestone:
            play mob spawner flames at the targeted block to all players
            cancel the event
            set block to air
            drop 1 stone
        if event-block is sand:
            play mob spawner flames at the targeted block to all players
            cancel the event
            set block to air
            drop 1 plain_glass_block
        if event-block is iron_ore:
            play mob spawner flames at the targeted block to all players
            cancel the event
            set block to air
            drop 1 iron_ingot
        if event-block is gold_ore:
            play mob spawner flames at the targeted block to all players
            cancel the event
            set block to air
            drop 1 golden_ingot
        if event-block is log:
            play mob spawner flames at the targeted block to all players
            cancel the event
            set block to air
            drop 1 charcoal
        if event-block is cactus:
            play mob spawner flames at the targeted block to all players
            cancel the event
            set block to air
            drop 1 cactus green
        if event-block is wet_sponge:
            play mob spawner flames at the targeted block to all players
            cancel the event
            set block to air
            drop 1 sponge
        if event-block is netherrack:
            play mob spawner flames at the targeted block to all players
            cancel the event
            set block to air
            drop 1 nether_brick_item

code_language.skript:
# Drag & Drop Enchantments
on mor.inventory click:
    event-item is any pickaxe or shovel or axe
    player's cursor slot is enchanted_book:
        name of player's cursor slot is "&fSmelt I":
            cancel the event
            set lore of event-item to "%lore of event-item%||&fSmelt I"
            wait 2 ticks
            set cursor slot of player to air

For these to work I believe you need Bensku's fork and skMorkaz.
Bensku fork already has a cursor slot expression built in