Adding custom NBT to entities

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

NightyNight

Member
Feb 21, 2017
20
0
0
20
I'm trying to add a custom NBT tag to an armor stand, but it won't add itself when I check with "nbt of the entity." Here's my code:
code_language.skript:
command /dangle:
    trigger:
        spawn an armor stand 3 meters in front of player
        add "{CustomNameVisible:1,NoGravity:1b,Small:1,Invisible:1,Invulnerable:1,NoBasePlate:1}" to nbt of last spawned armor stand
        add "{Dangle:1}" to nbt of last spawned armor stand
        if name of player's tool is set:
            set name of last spawned armor stand to "%name of player's tool%"
        else:
            set name of last spawned armor stand to "%player's tool%"
        spawn an armor stand 0.1 meters under last spawned armor stand
        add "{CustomNameVisible:1,NoGravity:1b,Small:1,Invisible:1,Invulnerable:1,NoBasePlate:1}" to nbt of last spawned armor stand
        set name of last spawned armor stand to "&c&lDangle"
        add "{Dangle:1}" to nbt of last spawned armor stand
        wait 3 seconds
        loop entities within radius 3.5 of player:
            loop-entity is armor stand
            if "%nbt of loop-entity%" contains "{Dangle:1}":
                kill loop-entity
Can anyone help me with this?
 
Entities can't have custom nbt, only items can
I found it, I do not understand :|

Capture.PNG
 
Because metadata stores small amounts of data in entities very easily, whereas NBT doesn't support custom tags with entities.
 
Because metadata stores small amounts of data in entities very easily, whereas NBT doesn't support custom tags with entities.

There still is a workaround. In a entity you have the nbt called TAGS . This just a string you can Enter in To THE entity.
code_language.skript:
Add "{tags:[""data""]}" To nbt of clicked entity

But this way you can only store one thing. But

If you write iT differently like so

code_language.skript:
Add "{tags:[""data1|data2|data3""]}" To nbt of clicked entity

You can then return these values And split them at | And get THE values in a list so {_list::2} would return data2
 
  • Like
Reactions: Govindas
Status
Not open for further replies.