Discord Thread backpacks

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

This thread came from the skUnity Discord. You can't reply to it here but if you join the skUnity Discord, you'll be able to post a reply there. The thread link is part of the thread's message.
Status
Not open for further replies.
lmao i thought u meant actualy physically drop the item on the anvil, but yea this is way cooler, so im guessing u just set the a var to the item right clicked, then u just dropped the item above the anvil, quick question, how does setting the uuid int array tag stop players from pickin it up? is it jus how mc works or do i gotta add some stuff myslef.

Posted by: .avised from the skUnity Discord.
 
i did some tricky stuff, here is what i have
this change prevents the opening of the backpack when clicking an anvil
so just update your code
code_language.skript:
vb
on right click:
    if nbt of player's tool has tag "Backpack":
        cancel event
        if target block is not an anvil:
            open(player)
    else if nbt of player's offhand tool has tag "Backpack":
        cancel event

Posted by: shanebee from the skUnity Discord.
 
this is the anvil clicky part
code_language.skript:
vb
on right click on anvil:
    if nbt of player's tool has tag "Backpack":
        cancel event
        drop 1 of player's tool 0.5 above target block without velocity
        set {_d} to last dropped item
        set gravity of {_d} to false
        set display name of {_d} to "&bReady To Upgrade?"
        set tag "Owner" of nbt of {_d} to uuid int array #no one can pick up
        set tag "Age" of nbt of {_d} to -32768 #wont despawn
        set string tag "custom;item" of nbt of target block to uuid of {_d}
        set player's tool to air
    else if player's tool is air:
        if nbt of target block has tag "custom;item":
            cancel event
            set {_e} to string tag "custom;item" of nbt of target block
            set {_e} to {_e} parsed as entity
            give player 1 of item of {_e}
            kill {_e}
you'd have to factor in your actual upgrade

Posted by: shanebee from the skUnity Discord.
 
You’re welcome
i forgot to add this line in

delete tag "custom;item" of nbt of target block

oh you should probably write something also to prevent breaking the anvil if the tag is set

Posted by: shanebee from the skUnity Discord.
 
if you want to do it yourself for when you upgrade the item that'll be cool
make it go upwards or smth
all you do is add some velocity

Posted by: fusezion from the skUnity Discord.
 
and before you ask how he did the text question

set diaplay name of {_d} to %string%

minecart hopper time

Posted by: fusezion from the skUnity Discord.
 
Status
Not open for further replies.