Undroppable items.

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

Cellox

New Member
May 15, 2022
6
0
1
26
Hello,

i'm searching for a skript that can add something like a lore or tag to a specific item with a command that makes it impossible to drop or put that item into a chest, but once the player dies with that item the lore/tag is removed from the item and people can pick it up and keep it.
 
The skUnity parser returned no errors, so I think it should work. If it doesn't, please let me know.
Code:
on drop:
    set {_lores::*} to lore of event-item
    if {_lores::*} contains "Undroppable":
        cancel event
        send "You can't drop this item"

on inventory click:
    set {_lores::*} to lore of event-item
    if {_lores::*} contains "Undroppable":
        cancel event
        send "You can't move this item"

command /undroplore:
    trigger:
        if player's held item is set:
            set {_tool} to player's held item
            remove player's held item from player
            set {_lores::*} to lore of {_tool}
            set {_size} to size of {_lores::*}
            set {_lores::%{_size}+1%} to "Undroppable"
            set {_item} to {_tool} with lore "%{_lores::*}%"
            give player {_item}
 
The skUnity parser returned no errors, so I think it should work. If it doesn't, please let me know.
Code:
on drop:
    set {_lores::*} to lore of event-item
    if {_lores::*} contains "Undroppable":
        cancel event
        send "You can't drop this item"

on inventory click:
    set {_lores::*} to lore of event-item
    if {_lores::*} contains "Undroppable":
        cancel event
        send "You can't move this item"

command /undroplore:
    trigger:
        if player's held item is set:
            set {_tool} to player's held item
            remove player's held item from player
            set {_lores::*} to lore of {_tool}
            set {_size} to size of {_lores::*}
            set {_lores::%{_size}+1%} to "Undroppable"
            set {_item} to {_tool} with lore "%{_lores::*}%"
            give player {_item}

It's given me this:


[15:42:20 ERROR]: [Skript] 'lore' is not a number (undroppable.sk, line 2: set {_lores::*} to lore of event-item')
[15:42:20 ERROR]: [Skript] can't understand this event: 'on inventory click' (undroppable.sk, line 7: on inventory click:')
[15:42:20 ERROR]: [Skript] 'lore' is not a number (undroppable.sk, line 18: set {_lores::*} to lore of {_tool}')
[15:42:20 ERROR]: [Skript] '{_lores::%{_size}+1%}' is not an entity type (undroppable.sk, line 20: set {_lores::%{_size}+1%} to "Undroppable"')
[15:42:20 ERROR]: [Skript] '{_tool} with lore "%{_lores::*}%"' is not an entity type (undroppable.sk, line 21: set {_item} to {_tool} with lore "%{_lores::*}%"')
 
Using lores will only work on skript versions 2.1 and more recent. My next best bet would be to use NBT tags with SkBee.
 
Oh i see. In that case, unless there is some other plugin that works with 1.7.10 and supports lores or nbts, creating your own plugin for it would be the way to go. Sorry I couldn't help more.
 
Oh i see. In that case, unless there is some other plugin that works with 1.7.10 and supports lores or nbts, creating your own plugin for it would be the way to go. Sorry I couldn't help more.

Oh no worries! You atleast was willing to help which i appreciate a lot! Just sucks that i'm still forced on such a old version of MC, but can't do much about that unfortunately.