Using the commands:
/scoreboard players set @a Rupees 1 {Inventory:[{Count:1b,tag:{display:{Name:"Rupee"}}}]}
or
/scoreboard players set @a Rupees 2 {Inventory:[{Count:2b,tag:{display:{Name:"Rupee"}}}]}
does work,
/scoreboard players set @a Rupees 0 {Inventory:[{Count:0b,tag:{display:{Name:"Rupee"}}}]}
does not.
I am trying to make a Zelda like shop system - so the player score of an objective called "Rupees" has to be exactly the same as the amount of items called Rupee the player has in his inventory (because /clear does not have a minimum value).
It works with the values 1-50 (max moneybag size, because 50 command-blocks is much) but not with zero.
So if a player buys an item and I remove the rupees, the scoreboard will never be zero even if the player has no more rupees - and therefore he can always keep buying items.
Comments 10
+Kumasasa
#Kumasasa
@Kumasasa
Huh, I am sorry I am that blind, but isn't that the tag, I used?
In your command, don't you need to define which item of, he does not have any?
What you said:
{Inventory:[{Count:0b}]}
What I said:
{Inventory:[{Count:0b,tag:{display:{Name:"Rupee"}}}]}
Sorry, but I can not agree that it "works as intended".
But it is not about having no item in your inventory!! It is about having no item of a specific kind in your inventory!! xD
the thing is, you can't test for no items in your inventory, so you also can't test if a player has none of a kind
it isn' a bug it's just way the game works,if you have no items then the Inventory tag is EMPTY
so you can't test for an missing item, nor an specific missing item
How the game works causes problems in this specific case, and since it is a sandbox game, it is limiting possibilites that are there through a command, but not with a specific number, the number zero. Therefore it is a bug.
If a player has no item of a kind, the inventory slot looks something like
Tip: Set the minimum price for any Item to 2, so that player cannot buy anthing with only 1 money item left
For feature suggestions or changes please see: Minecraft Suggestions on Reddit.