2
Title sums it up
basically I need to test if a player (with a certain tag) doesn't have that item in their inventory
I'm using it as a detector for shooting arrows instead of tagging the arrow as it spawns from the player, I'm using it to detect if a player has shot an arrow.
Basically what I've already done is run this command in a loop:
```execute if entity @a[tag=hasGun,nbt={Inventory:{id:"minecraft:arrow"}]}] run scoreboard players set @a[tag=hasGun,nbt={Inventory:{id:"minecraft:arrow"}]}] hasArrow 1```
which sets all players' score tagged "hasGun" with an arrow in their inventory to 1 meaning they have an arrow
then I need to detect when that player has shot their bow (and used up the arrow in their inventory) and then set their score to 0
how exactly does one do that
Create an account or sign in to comment.
7
1
Normally you'd also use a Count property when checking for an inventory item. So if you set Count to 0 you'd check if no items are present in the players inventory.
1
I do that all the time man! Sometimes it just takes a "stepping back" second and you usually realize you are over-complicating stuff. lol
1
i do remember im most languages including command blocks the "!" indicates a negative
so maybe try putting a ! infront of one of those things
it might just work you never know
so maybe try putting a ! infront of one of those things
it might just work you never know
2
it does work for [tag=!abc] but not for NBT tags
Also I found out a way to fix my problem as I only need to set all players score to 0 on a repeat command block
and set all with arrows to 1, it's a really simple fix I'm quite disappointed in myself for not thinking of it much more earlier
Also I found out a way to fix my problem as I only need to set all players score to 0 on a repeat command block
and set all with arrows to 1, it's a really simple fix I'm quite disappointed in myself for not thinking of it much more earlier
1
It does work for NBT tags, have you tried the following?
Also, that is a good solution you found. I use it a lot. :)
~SUPERIONtheKnight
/say @s[nbt=!{Inventory:[{id:"minecraft:arrow"}]}]
Also, that is a good solution you found. I use it a lot. :)
~SUPERIONtheKnight
1
I've already quite gotten over this but it's nice to see people eager to help, even though they are 16 days late xP
1
hehe the best can make the dumbest mistakes XD