Solved Place block, save name... NBT??

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

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

ShaneBee

Supporter +
Addon Developer
Sep 7, 2017
2,248
241
73
Vancouver, Canada
Hey all

So i have tried this numerous times and I am lost. I want to be able to set a block with a name, and then when I place the block on the ground it saves the name, so when I break it its the same name, vs reverting back to the blocks original name.
I read somewhere you do this with NBT data? But I have no clue how to do that. How would one go about doing this?
Thanks
 
Hey all

So i have tried this numerous times and I am lost. I want to be able to set a block with a name, and then when I place the block on the ground it saves the name, so when I break it its the same name, vs reverting back to the blocks original name.
I read somewhere you do this with NBT data? But I have no clue how to do that. How would one go about doing this?
Thanks
Maybe something like this?
code_language.skript:
on place:
    add "{YourTag:""%name of player's tool%""}" to nbt of event-block

on break:
    if nbt of event-block contains "YourTag":
        set {_YourTag} to tag "YourTag" of nbt of event-block
        clear drops
        drop 1 of event-block named "%{_YourTag}%"
 
Maybe something like this?
code_language.skript:
on place:
    add "{YourTag:""%name of player's tool%""}" to nbt of event-block

on break:
    if nbt of event-block contains "YourTag":
        set {_YourTag} to tag "YourTag" of nbt of event-block
        clear drops
        drop 1 of event-block named "%{_YourTag}%"
Hey
Thanks for that, i threw it in, and this is what I get back from my console
[19:25:28 ERROR]: can't understand this condition: 'nbt of event-block contains "YourTag"' (tool.sk, line 46: if nbt of event-block contains "YourTag":')
 
Hey
Thanks for that, i threw it in, and this is what I get back from my console
[19:25:28 ERROR]: can't understand this condition: 'nbt of event-block contains "YourTag"' (tool.sk, line 46: if nbt of event-block contains "YourTag":')
Ohh ... i think this will work:
code_language.skript:
if "%nbt of event-block%" contains "YourTag":
 
Hey, thanks Hacker, The code works (no errors)
but the action doesn't work.
I did some more reading and apparently standard blocks that don't require anything to happen in them don't actually save NBT on placement.
So sadly, this doesn't work.

But I found another fix around it, so thanks again or your help :emoji_slight_smile:
 
Hey, thanks Hacker, The code works (no errors)
but the action doesn't work.
I did some more reading and apparently standard blocks that don't require anything to happen in them don't actually save NBT on placement.
So sadly, this doesn't work.

But I found another fix around it, so thanks again or your help :emoji_slight_smile:
Hey this intrigues me, would you mind posting the solution for me to examine and for any others wondering as well?
 
Status
Not open for further replies.