#NBT

1 messages · Page 1 of 1 (latest)

naive sparrow
#

tag "X" of nbt of item

elder locust
#

when {_nbt} is already a compound you can just use {_nbt}

naive sparrow
#

whenever you broadcast a variable, put it as a string like "%{_type}%" so it'll always display

#

if the variable is unset, it won't send anything

#

if you set it as a string, it'll send <none> [assuming its not set]

elder locust
#
set {_type} to tag "ItemType" of {_nbt}```
tacit karma
#

I have followed both of your solutions, I as the sender get a message, the message being <none>. I am holding the item. Could this possibly be due to the setting of the NBT?

elder locust
#

try just "send nbt compound of player's tool"

#

idk what {item.key} is

#

problem might be with that

tacit karma
#

As I thought, it did not add it.

#

set tag "ItemType" of nbt compound of {item.key} to "Key" is what is adding it, I looked over every forum and document I can to try to figure out the correct structure and thats how far I got

elder locust
#

you want to add a tag right?

tacit karma
#

Yes

elder locust
#

gimme sec

#
set {_tag} to nbt compound from "{ItemType:whatever}"
add {_tag} to {_nbt}```
#

try this

tacit karma
#

I had to modify it due to how the system works;

Basically, I use a command that is only to be used in testing to modify the theororetical item. The item is stored on the server as a variable. I begin with setting the variable to a paper named "Key" and then set item up through that. It then gives the player the created item. There is another command that gets the item type which is supposed to get whatever is on the right side of the ItemType: tag. (whatever being that in your example). There has been no value added and this is what it looks like:

set {_nbt} to nbt compound of {item.key}
set {_tag} to nbt compound from "{ItemType:Key}"
add {_tag} to {_nbt}
elder locust
#
   trigger:
      set {_nbt} to nbt compound of player's tool
      set tag "key" of {_nbt} to 1
      broadcast "%{_nbt}%"```
#

does this work?

tacit karma
#

That goes in the command that outputs the NBT right?

elder locust
#

just try if code i sent works

#

copy paste

#

reload

#

/test

#

see if item you are holding has "key:1"

#

in nbt

tacit karma
#

Before:

#

After:

#

Is that what you were looking for?

elder locust
#

so seems like if you just set tag to value

#

the tag gets created if it doesnt exist already

#

so idk why your thing isnt working

#

maybe because you are doing it through variable

#

{item.key} thing

tacit karma
#

How would I retrieve just the word "Key" from the NBT compound, not Key:1 or whatever you are trying to add?

#

And I cannot set the NBT value in the command that prints the type because that is going to have to print the types for multiple items..

elder locust
#

broadcast "%tag "ItemType" of nbt compound of player's tool%"

#

ItemType is the tag where you want to store stuff if i understand it correctly

tacit karma
#

<none>

elder locust
#

that means you didnt set it before

#

there is something wrong with the part of code where you are adding the tag

tacit karma
#

Command that created the item:

elder locust
#

give paper named "Key" with nbt compound from "{ItemType:Key}" to player done

tacit karma
#

It cannot work like that because the name changes depending on the team of the player.

elder locust
#

just change the name not whole item

tacit karma
#

It is setting the name of the item, nothing else changes with that

#

and it also has to be a variable so it is stored

elder locust
#

if team is blue set {var} to "&bKey"
paper named {var} with nbt...

#

etc

#

ig you get the idea

tacit karma
#

One second

#

This issue has been resolved.

Closing in 5 minutes.