forum Forumsplay_arrow Minecraft fiber_manual_record Help


How can I count the number of players on a team in 1.13?

1 emerald3 replies659 views
created 07/19/2018 7:42 pm by The Fox Nation
last reply 07/23/2018 2:26 pm
I'm trying to make a deathmatch mode in minecraft but what I can't figure out is how to actually find out who the last one standing is. Originally I used the "successcount" value but now that that doesn't work I've been trying to figure out how to use the execute subcommands. If someone could help me out on how I can set up a "detection" system of sorts that would be greatly appreciated. Thanks
Posted by avatar
The Fox Nation
Level 29 : Expert Explorer

3 replies

07/22/2018 7:32 pm
Level 17 : Journeyman Engineer
You can now use "/execute store" to store the success count of a command (or the output/result, in commands like /scoreboard players get) to an NBT tag or a scoreboard score.

Syntax for the whole command
The syntax is:
/execute store (result|success) <target (where the data's stored)> run <chained command>
result- the result of the chained command (ex. /scoreboard players get)
success- the success count (like from /stats) of the chained command

These are the 3 possible targets:
score <name> <objective> - Stores as <name>'s score in <objective>
entity <selector> <path to NBT tag> <data type> <scale> - Stores as <data type> in the selected NBT tag in <selector>'s data, multiplies it by <scale> first
block <coordinates> <path> <data type> <scale> - Same thing, only stored in the NBT of the block at <coordinates>, assuming it can store NBT

The command you want is probably something like
/execute store score Red playercount run team list Red (playercount is an objective, Red is a dummy)
If that doesn't work, this will
/execute store score Red playercount as @a[team=Red] at @s run tp @s ~ ~ ~ (test how many red players can teleport to the exact location they are in)

Good luck,
07/23/2018 2:16 pm
Level 29 : Expert Explorer
The Fox Nation
So how would I run it to say run a command when there is only one player left on a team as that would be when the game ends. I have it set to give you a score when you are dead I just need help setting up it detecting for only 1 player. Thanks for replying btw.
07/23/2018 2:26 pm
Level 17 : Journeyman Engineer
To check when a team has only one player on it that is alive, use commands like this:
/scoreboard players set RedTeam playercount 0
/execute as @a[team=Red,scores={dead=0}] run scoreboard players add RedTeam playercount 1
/execute if score RedTeam playercount matches 0 run <chained command>

The chained command you want is probably one of these
-setting a redstone block somewhere to trigger a line of command blocks (to announce the winner, etc)
-running a function to do the same thing




© 2010 - 2019