1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Adding custom NBT to entities

Discussion in 'Skript' started by NightyNight, Oct 19, 2017.

Thread Status:
Not open for further replies.
  1. NightyNight

    NightyNight Member

    Joined:
    Feb 21, 2017
    Messages:
    20
    Likes Received:
    0
    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 (Skript):
    1. command /dangle:
    2.     trigger:
    3.         spawn an armor stand 3 meters in front of player
    4.         add "{CustomNameVisible:1,NoGravity:1b,Small:1,Invisible:1,Invulnerable:1,NoBasePlate:1}" to nbt of last spawned armor stand
    5.         add "{Dangle:1}" to nbt of last spawned armor stand
    6.         if name of player's tool is set:
    7.             set name of last spawned armor stand to "%name of player's tool%"
    8.         else:
    9.             set name of last spawned armor stand to "%player's tool%"
    10.         spawn an armor stand 0.1 meters under last spawned armor stand
    11.         add "{CustomNameVisible:1,NoGravity:1b,Small:1,Invisible:1,Invulnerable:1,NoBasePlate:1}" to nbt of last spawned armor stand
    12.         set name of last spawned armor stand to "&c&lDangle"
    13.         add "{Dangle:1}" to nbt of last spawned armor stand
    14.         wait 3 seconds
    15.         loop entities within radius 3.5 of player:
    16.             loop-entity is armor stand
    17.             if "%nbt of loop-entity%" contains "{Dangle:1}":
    18.                 kill loop-entity
    Can anyone help me with this?
     
  2. Pikachu

    Moderator Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    139
    Medals:
    Entities can't have custom nbt, only items can
     
  3. NightyNight

    NightyNight Member

    Joined:
    Feb 21, 2017
    Messages:
    20
    Likes Received:
    0
    great thanks
     
  4. Pikachu

    Moderator Supporter Addon Developer

    Joined:
    Jan 25, 2017
    Messages:
    871
    Likes Received:
    139
    Medals:
    You might find metadata to fit your needs, but that doesnt persist restarts. You can kinda make it persist though
     
  5. HackerOTVW

    HackerOTVW Active Member

    Joined:
    Sep 10, 2017
    Messages:
    91
    Likes Received:
    2
    I found it, I do not understand :|

    Capture.PNG
     
  6. NightyNight

    NightyNight Member

    Joined:
    Feb 21, 2017
    Messages:
    20
    Likes Received:
    0
    NBT works well for blocks and items, but I suggest using metadata from Skellett (thanks @Pikachu) for temporary tags on entities.
     
  7. White

    White Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    445
    Likes Received:
    25
    Why metadata though? They don't add modifiers to entities like NBT does.
     
  8. NightyNight

    NightyNight Member

    Joined:
    Feb 21, 2017
    Messages:
    20
    Likes Received:
    0
    Because metadata stores small amounts of data in entities very easily, whereas NBT doesn't support custom tags with entities.
     
  9. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    44
    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 (Skript):
    1. 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 (Skript):
    1. 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 Like x 1
Thread Status:
Not open for further replies.

Share This Page

Loading...