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!

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

Other [NBTSk] How to use NBTSk!

Discussion in 'Tutorials' started by Aidanete, Aug 11, 2018.

  1. Aidanete

    Aidanete Well-Known Member

    Joined:
    Apr 11, 2017
    Messages:
    139
    Likes Received:
    8
    NBTSk for dummies
    As I've recently uploaded NBTSk, I think is a moment to make a tutorial. When I'm writing this, the script is pending approval.

    All you know what NBT Tags are, and we know that skript don't provide enough support for this stuff, so NBTSk works well for your server, because can store items in variables, and then you can call them in your codes.

    For example, a custom head. Simply take it on your hand and put this command /ns save (id). This will save the ID (id) with that item

    To call it, you can use this variable:
    Code (Skript):
    1. {ns::%id%}
    For example
    Code (Skript):
    1. set the player's helmet to {ns::burger}
    This will make the item saved in ID burger to be placed on the player's head.
    If you use TuSKe GUI, you can also use them:
    Code (Skript):
    1. command /ns-example2:
    2.     trigger:
    3.         open virtual chest inventory with size 3 named "Example of NBTs" to the player
    4.         format gui slot 0 of player with {ns::lion} to close
    5.         format gui slot 1 of player with {ns::burger} to close
    This will place the items saved with ids "lion" and "burger"

    To delete an item, just command /ns delete (id)

    You can test as well if the item is saved correctly with /ns give (id)
    If you feel lost with the saved item, to know their ids put /ns list

    Another function is to detect items in the player's inventory, I tested with it but this feature isn't very clean and may have errors, anyway, it is still usable:
    Code (Skript):
    1. on rightclick:
    2.     player is holding {ns::gigajump}:
    3.         cancel event
    4.         push the player upwards with force 4
    5.  
    Note: I used the id "gigajump" for a head with an ! in the center and the name &6&lGiga jump! However, the game, in this case, will detect any head with that name, but probably this can be fixed with other methods or extra detection but is still usable, that the reason why I said this feature can have errors

    As you know, you can't save variables in a script directly, so when you pass the script the saved items will not work, simply use it for personal use, your servers or other's servers that you can control.

    Enjoy NBTSk!
     
    #1 Aidanete, Aug 11, 2018
    Last edited: Aug 11, 2018
  2. jaylawl

    jaylawl Well-Known Member

    Joined:
    Jan 29, 2017
    Messages:
    173
    Likes Received:
    31
    Hey, excited to check out your upcoming resource.
    Just wanted to throw out there that Skript doesn't support NBT because it requires net.minecraft.server reflection (aka NMS), which has a habit of changing with every major minecraft release and on top of it is obfuscated. They're taking a pass on that stuff because it makes mantaining Skript more difficult.

    I know the guy that develops the plugin MythicMobs and he does in fact include NMS stuff in his code for a plethra of MC versions. I've also seen the source code and ... it's not pretty. So i fully empathize with the Skript team on this
     
  3. Aidanete

    Aidanete Well-Known Member

    Joined:
    Apr 11, 2017
    Messages:
    139
    Likes Received:
    8
    Good to know it, hope you enjoy this script, I don't know if someone will need it but at least I were searching for something like this like a month, so I decided to publish it because may be very helpful
     
    • Agree Agree x 1
  4. jaylawl

    jaylawl Well-Known Member

    Joined:
    Jan 29, 2017
    Messages:
    173
    Likes Received:
    31
    I believe publishing is never wrong. There's always somebody who might find it useful
     
    • Agree Agree x 1
  5. Aidanete

    Aidanete Well-Known Member

    Joined:
    Apr 11, 2017
    Messages:
    139
    Likes Received:
    8
    You know if this script can be considered an API or not?
     
  6. jaylawl

    jaylawl Well-Known Member

    Joined:
    Jan 29, 2017
    Messages:
    173
    Likes Received:
    31
    I'm not the best to judge, but i think the resource moderation team would've automatically classified it as API if it were to be
     
Loading...