In a minigame I created, I have a scoreboard dummy objective called "Gold" and two fake players called "Team_Red" and "Team_Green" that are holding the scores for team "Red" and team "Green" respectively. I would like to create a game over title command for all players, displaying "Team ____ Won." I have a scoreboard timer set for 6 minutes and once that ends, the title will be shown displaying who won. It seems that there are no target selectors that can test for this, so how can this be done? You can't "testfor" anymore either. So how can one do this in Minecraft 1.13?
1 Answer
execute
has an if score
subcommand that lets you easily compare any two scores, and run a command if the test succeeds. The following commands should work for what you want to do:
execute if score Team_Red Gold > Team_Green Gold run title @a title {"text":"Team red won!","color":"red"}
execute if score Team_Red Gold < Team_Green Gold run title @a title {"text":"Team green won!","color":"green"}
execute if score Team_Red Gold = Team_Green Gold run title @a title {"text":"It's a draw!","color":"gray"}
-
Oh! I get it now! Okay yeah I knew that there were conditions for the 'execute if' command, I didn't realize you could link and compare scores in that way. Perfect! Commented Dec 25, 2018 at 21:58
*
work as the selector in this case? And if not, dummy entities always work.