Solved "if player has 1 iron ingot named" not working if the item has other nbt

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

Denloself

Member
Oct 3, 2021
12
0
1
23
it can't check the item name if the item has other nbt (like if it was renamed by anvil, it will not work)

Code:
command /skriptitemchecktest:
    permission: skript.thing
    trigger:
        if player has 1 iron ingot with name "test":
            message "you have 1 iron ingot" to the player
i have also tried
Code:
command /skriptitemchecktest2:
    permission: skript.thing
    trigger:
        if player's inventory contains iron ingot named "test":
            message "you have 1 iron ingot" to the player
 
it can't check the item name if the item has other nbt (like if it was renamed by anvil, it will not work)

Code:
command /skriptitemchecktest:
    permission: skript.thing
    trigger:
        if player has 1 iron ingot with name "test":
            message "you have 1 iron ingot" to the player
i have also tried
Code:
command /skriptitemchecktest2:
    permission: skript.thing
    trigger:
        if player's inventory contains iron ingot named "test":
            message "you have 1 iron ingot" to the player
you can try to use a filter

all items in player's inventory where [nbt of input contains "test"]
or
all items in player's inventory where [name of input is "test"]
 
hmm is it how do i do it? or i have to edit something?

Code:
command /skriptitemchecktest:
    permission: skript.thing
    trigger:
        if all items in player's inventory [where nbt of input contains "test"]:
            message "you have 1 iron ingot" to the player
 

Attachments

  • 2021-10-03_20.52.31.png
    2021-10-03_20.52.31.png
    399.5 KB · Views: 91
Uhh sorry, but can you show me the code? I did never try this way before so i don't know what should i do
 
hmm do i need some addon to make this work?
i have:
Skript git-Paper-788 (MC:1.16.5)
skript-placeholders v1.5
SharpSK v1.6.3

my code now look like:
Code:
command /skriptitemchecktest:
    permission: skript.thing
    trigger:
        if all items in player's inventory [where nbt of input contains "test"] is set:
            message "you have 1 iron ingot" to the player
 

Attachments

  • 2021-10-04_04.14.19.png
    2021-10-04_04.14.19.png
    1.3 MB · Views: 100
hmm do i need some addon to make this work?
i have:
Skript git-Paper-788 (MC:1.16.5)
skript-placeholders v1.5
SharpSK v1.6.3

my code now look like:
Code:
command /skriptitemchecktest:
    permission: skript.thing
    trigger:
        if all items in player's inventory [where nbt of input contains "test"] is set:
            message "you have 1 iron ingot" to the player
That's not what I said tho,

it's `where [nbt of ..]`

not `[where nbt of ...]`
 
Hmm I did also tried:
Code:
command /skriptitemchecktest:
    permission: skript.thing
    trigger:
        if all items in player's inventory where [nbt of input contains "test"] is set:
            message "you have 1 iron ingot" to the player
but it is still not working,
oh and I looked up other forums again and seem the problem fixed in 2.6-alpha1
  • Fix more issues with item comparisons (#3960. closes #3618)
This fix also adds a new expression, ExprPlain. A plain item is an item with no modifications. It can be used to convert items to their default state or to match with other default items. This is to provide a replacement for using if player's tool is a diamond named "" (you would instead use if the player's tool is a plain diamond)
But i am not at home rn, I will test it when I get home
[doublepost=1633340504,1633306544][/doublepost]hmm nope updating it did not fix the problem, i will just use another method for the thing i want
 
Status
Not open for further replies.