How to change scoreboard score if player does not have item in his inventory? [duplicate]
I want to make a killstreak award system. for that I need to be able to make a player choose to use his killstreak points to get an ability/potion effect or open a certain gate.
I wanted to make the player use a bottle of enchanting to get to level 1 and then make a commandblock test for those players and execute the killstreak ability and then reset the system.
But what if the player does not reach level 1. what if another player gets the XP from the bottle.
Is there a more secure way to acheve the remote activation of a command block for a certain player? Do I have to use a scoreboard variable?
EDIT: I tried to setup a way to see if players are not having a custom named item in their inventory (if they dropped it) and then according to that, preform an action.
I got to the point in which I can tell if none of the players have that item (Red command blocks), kill the item if they throw it on the ground (Yellow + Blue command blocks) and give the item back to the player who has a score for objective execute of 1.
Commands used in the command blocks: one row for each item (TNT called:"Choose Class" and TNT called:"Launch Killstreak")
- RED:
clear @a minecraft:tnt 0 0 {display:{Name:"Choose Class"}} - BLUE:
testfor @e[type=Item] {Item:{id:"minecraft:tnt",tag:{display:{Name:"Choose Class"}}}} - YELLOW:
kill @e[type=Item] {Item:{id:"minecraft:tnt",tag:{display:{Name:"Choose Class"}}}} - GREEN:
give @a[score_execute_min=1] minecraft:tnt 1 0 {display:{Name:"Choose Class",Lore:[Change your class when you get killed]}} - WHITE: Command to set the score of
execute,a scoreboard objective, to 1 for all players that don't have the item in their inventory.
Now the problem is that I don't know how to give a point to a scoreboard objective of a player does not have the item in his inventory. How do I do that?
Pictures about "How to change scoreboard score if player does not have item in his inventory? [duplicate]"
![How to change scoreboard score if player does not have item in his inventory? [duplicate] - Gathering Football Players How to change scoreboard score if player does not have item in his inventory? [duplicate] - Gathering Football Players](/assets/images/how_to_change_scoreboard_score_if_player_does_not_have_item_in_his_inventory_duplicate_1.jpeg)
![How to change scoreboard score if player does not have item in his inventory? [duplicate] - Carton box and suitcases for relocation on bed How to change scoreboard score if player does not have item in his inventory? [duplicate] - Carton box and suitcases for relocation on bed](/assets/images/how_to_change_scoreboard_score_if_player_does_not_have_item_in_his_inventory_duplicate_2.jpeg)
![How to change scoreboard score if player does not have item in his inventory? [duplicate] - Crop man packing carton box with scotch tape dispenser How to change scoreboard score if player does not have item in his inventory? [duplicate] - Crop man packing carton box with scotch tape dispenser](/assets/images/how_to_change_scoreboard_score_if_player_does_not_have_item_in_his_inventory_duplicate_3.jpeg)
How do you edit a scoreboard?
You can use the /replaceitem command to instanty replace one item with another item. You can replace armor items worn, weapons held in your hands, items stored in chests and items in your inventory/hotbar. This is a great way to quickly put armor on a player during a Minecraft battle or change out a worn out weapon.Minecraft Scoreboard Command Tutorial [1.18]
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Ketut Subiyanto, Pixabay, Ketut Subiyanto, Ketut Subiyanto

