nbt of player's tool

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

Itqly_

Member
Sep 20, 2018
29
1
0
30
Hey SkUnity community: i was creating a skript to make Tools unbreakable with a command but I encountered a problem: I don't know how to add nbt tags.

I tried with:
code_language.skript:
add "{Unbeaking:1}" to nbt of player's tool
but it gives me an error.

My current addons are:
SkQuery
SkRayFall
WildSkript

Thanks in advance for your help
 
Ok sorry:

Skript version: 2.2
Skript author: Bensku
Minecraft Version: 1.8 (spigot)

Code:
code_language.skript:
on right click with diamond pickaxe on player:
    if player is holding diamond pickaxe named "&9&lPickaxe" with lore "||&7Right click on a Player||&7to transform this tool||&7into a &9&lSword":
        cancel event
        set {slot.%player%} to selected hotbar slot of player
        set slot {slot.%player%} of player to diamond sword of sharpness 3 and unbreaking 1 named "&9&lSword" with lore "||&7Right click on a Block||&7to transform this tool||&7into a &9&lPickaxe"
        add "{Unbeaking:1}" to nbt of player's tool
on right click with diamond sword:
    if clicked block is set:
        if player is holding diamond sword named "&9&lSword" with lore "||&7Right click on a Block||&7to transform this tool||&7into a &9&lPickaxe":
            cancel event
            set {slot.%player%} to selected hotbar slot of player
            set slot {slot.%player%} of player to diamond pickaxe of efficiency 3 and unbreaking 1 named "&9&lPickaxe" with lore "||&7Right click on a Player||&7to transform this tool||&7into a &9&lSword"
            add "{Unbeaking:1}" to nbt of player's tool
command /Pick [<player>]:
    permission: command.pick
    trigger:
        if arg 1 is not set:
            give player diamond pickaxe of efficiency 3 and unbreaking 1 named "&9&lPickaxe" with lore "||&7Right click on a Player||&7to transform this tool||&7into a &9&lSword"
        else:
            give arg 1 diamond pickaxe of efficiency 3 and unbreaking 1 named "&9&lPickaxe" with lore "||&7Right click on a Player||&7to transform this tool||&7into a &9&lSword"
on first join:
    give player diamond pickaxe of efficiency 3 and unbreaking 1 named "&9&lPickaxe" with lore "||&7Right click on a Player||&7to transform this tool||&7into a &9&lSword"

Error:
code_language.skript:
'player' is not an item stack (Tool.sk, line 6: add "{Unbreaking:1}" to nbt of player's tool')
'player' is not an item stack (Tool.sk, line 13: add "{Unbreaking:1}" to nbt of player's tool')
[doublepost=1544536856,1544536698][/doublepost]I tried removing the 'add "{Unbeaking:1}" to nbt of player's tool' and it workes perfectly ! So i suppose thats the problem
 
Ok sorry:

Skript version: 2.2
Skript author: Bensku
Minecraft Version: 1.8 (spigot)

Code:
code_language.skript:
on right click with diamond pickaxe on player:
    if player is holding diamond pickaxe named "&9&lPickaxe" with lore "||&7Right click on a Player||&7to transform this tool||&7into a &9&lSword":
        cancel event
        set {slot.%player%} to selected hotbar slot of player
        set slot {slot.%player%} of player to diamond sword of sharpness 3 and unbreaking 1 named "&9&lSword" with lore "||&7Right click on a Block||&7to transform this tool||&7into a &9&lPickaxe"
        add "{Unbeaking:1}" to nbt of player's tool
on right click with diamond sword:
    if clicked block is set:
        if player is holding diamond sword named "&9&lSword" with lore "||&7Right click on a Block||&7to transform this tool||&7into a &9&lPickaxe":
            cancel event
            set {slot.%player%} to selected hotbar slot of player
            set slot {slot.%player%} of player to diamond pickaxe of efficiency 3 and unbreaking 1 named "&9&lPickaxe" with lore "||&7Right click on a Player||&7to transform this tool||&7into a &9&lSword"
            add "{Unbeaking:1}" to nbt of player's tool
command /Pick [<player>]:
    permission: command.pick
    trigger:
        if arg 1 is not set:
            give player diamond pickaxe of efficiency 3 and unbreaking 1 named "&9&lPickaxe" with lore "||&7Right click on a Player||&7to transform this tool||&7into a &9&lSword"
        else:
            give arg 1 diamond pickaxe of efficiency 3 and unbreaking 1 named "&9&lPickaxe" with lore "||&7Right click on a Player||&7to transform this tool||&7into a &9&lSword"
on first join:
    give player diamond pickaxe of efficiency 3 and unbreaking 1 named "&9&lPickaxe" with lore "||&7Right click on a Player||&7to transform this tool||&7into a &9&lSword"

Error:
code_language.skript:
'player' is not an item stack (Tool.sk, line 6: add "{Unbreaking:1}" to nbt of player's tool')
'player' is not an item stack (Tool.sk, line 13: add "{Unbreaking:1}" to nbt of player's tool')
[doublepost=1544536856,1544536698][/doublepost]I tried removing the 'add "{Unbeaking:1}" to nbt of player's tool' and it workes perfectly ! So i suppose thats the problem
it's unbreaking not unbeaking
 
That is not the problem ! Even if it was wrong that was a minecraft problem and not skript !
anyways i fixed and still gave me error
 
You could also just do
code_language.skript:
set tool of player to unbreakable (tool of player)
I'm pretty sure.
 
Still not working:

error:
code_language.skript:
'unbreakable' is not an entity type
 
Status
Not open for further replies.