Skript NBT tags

  • 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 community!

    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!

slyafe

Member
Jul 26, 2022
11
1
3
Ive been going at this problem for hours now, and I still have yet a clue whats wrong. I am on 1.20.6 with skbee and skellet and this code does not give me any erors at all.

Code:
on load:
    #pickaxes
    
    set {tool::starterPickaxe} to an iron pickaxe with name "&aStarter Pickaxe"
    set line 1 of lore of {tool::starterPickaxe} to "&5It's nat good, but it will get you there"
    set int tag "StarterPickVer" of nbt of {tool::starterPickaxe} to 1
    
    
command /testgive:
    trigger:
        give {clone::tool::starterPickaxe} to player
command /testupd:
    trigger:
        loop all players:
            send "looping you" to loop-player
            loop items in loop-player's inventory:
                send "%loop-item%" to loop-player
                set {_nbt} to nbt of loop-item
                if {_nbt} has tag "StarterPickVer":
                    send "custom pick detected!" to loop-player
What im trying to do is just test an update system where it detects if a player has an item in their inventory that needs an update. Please note that I have to keep the pickaxe as a global variable for references in future skripts. Thank you
 
You should be able to check the NBT data using if %nbt of loop-item% contains "StarterPickVer": however if this is the code you are using, it will automatically not work because you are not using the correct list variable.

You are setting {tool::starterPickaxe} but giving players {clone::tool::starterPickaxe}, which has not been set (at least from what you have shown us here).
 
You should be able to check the NBT data using if %nbt of loop-item% contains "StarterPickVer": however if this is the code you are using, it will automatically not work because you are not using the correct list variable.

You are setting {tool::starterPickaxe} but giving players {clone::tool::starterPickaxe}, which has not been set (at least from what you have shown us here).
so should i just replace {clone::tool::starterPickaxe} with {tool::starterPickaxe}?