TransWikia.com

How to track when all team players die (mc 1.16)

Arqade Asked by Mabel on July 12, 2021

I am trying to make my own dodgebolt minigame (from mcc) and I’m struggling with the teams aspect.

I know I need to create a scoreboard to track deaths so that when all the players on the team die, it executes another command saying the other team won and will teleport everyone back to the main area.

I am not too sure how to code the scoreboard though, if anyone can help, that would be amazing !

One Answer

First, take a look at the answer to the question "Use tellraw to display a player death message about the player who died", in order to setup a scoreboard which tracks deaths. (The goal here is very similar to yours, so we can adapt this answer to suit your needs.) The scoreboard is set up the same way:

 /scoreboard players set @a hasDied 0
 /scoreboard objectives add hasDied deathCount

In order for all players to have died, that means the lowest score on the scoreboard is 1 or higher. So you would want to test for score = 0. Try a command block with:

/testfor @a[score_hasDied_min=0,score_hasDied=0]

This works because without a qualifier the test checks for score <= 0, and score <= 0 && score >= 0 EQUIV score = 0. See this answer for more clarification.

You can then chain any commands you would like to execute if the test fails. To check for a failed test, you need to invert the result of the command block. See this answer on how to do this.

Answered by aphid on July 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP