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!


    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.

Store NBT without coordinates

Discussion in 'Skript' started by IMO0226, Jul 28, 2019.

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

    IMO0226 Member

    Jul 28, 2019
    Likes Received:
    Skript Version: Skript 2.3.6
    Skellet Version: Skellet 1.9.6b
    Minecraft Version: 1.13.2

    I want to create a system what helps the players move entities with just clicking with an item.
    The system removes the entity, stores the NBT of that entity without any problems, summons the new entity with the correct NBT, but it teleports back to location where is was captured.
    As you can see, I tried to use metadatas and actually teleporting back the entity but non of them worked for me. How can I make the entity stay there where it was summoned?

    Code (Text):
    1. on right click on an entity:
    2.     if player's tool is lead:
    3.         if player's tool's lore is "&9Entitás befogó":
    4.             if clicked entity isn't a player:
    5.                 if {entity.%player%} isn't set:
    6.                     cancel event
    7.                     set {entity.nbt.%player%} to nbt of clicked entity
    8.                     set {entity.%player%} to clicked entity
    9.                     teleport clicked entity to location(0, -300, 0, world of player)
    11. on right click:
    12.     if player's tool is lead:
    13.         if player's tool's lore is "&9Entitás befogó":
    14.             if player is sneaking:
    15.                 if {entity.%player%} is set:
    16.                     set {entity.x} to x location of clicked block
    17.                     set {entity.y} to y location of clicked block
    18.                     set {entity.z} to z location of clicked block
    19.                     add 1 to {entity.y}
    20.                     spawn villager above the clicked block with nbt "%{entity.nbt.%player%}%"
    21.                     wait 1 tick
    22.                     set metadata "Position" of last spawned villager to "[%{entity.x}%d,%{entity.y}%d,%{entity.z}%d]"
    23.                     teleport last spawned villager above clicked block
    24.                     delete {entity.%player%}
    25.                     delete {entity.nbt.%player%}
    There are no errors on reloading neither on using the tool.

    Also is there a way to summon entities directly from variables so I don't have to do else-if sections like below?
    Code (Text):
    1. ...
    2. if {entity.%player%} is villager:
    3.     summon villager above the clicked block with nbt "%{entity.nbt.%player%}%"
    4. else if {entity.%player%} is wolf:
    5.     summon wolf above the clicked block with nbt "%{entity.nbt.%player%}%"
    6. else if {entity.%player%} is chicken:
    7.     summon chicken above the clicked block with nbt "%{entity.nbt.%player%}%"
    8. ...
    I'm using these addons as well:
    skUtilities 0.9.2, Skungee 1.0.9, SkQuery 4.1.1, skript-mirror 0.19.1, SK_NBeeT 2.4.2, Vixio 2.0.1
Thread Status:
Not open for further replies.

Share This Page