How to testfor a player positively even if the player is dead

How to testfor a player positively even if the player is dead - Men playing guitars on sandy tropical beach

I'm working on a map that has four teams red, Blue, Yellow, and Green. I have this command in a repeating command block /testfor @e[team=Yellow] I have one of each of these for each team. When a player dies they're still on the team, but when they die the command block comes out negative as if there were no players on that team until they respawn.

To simply say it. When a player dies the command block output is negative until they respawn, but I need it to be positive until they are off the team. And I can't have any other entities on the team or else it screws up my map. I don't believe there is any way to fix it unless I have an entity join the team when they die, and leave when they respawn. But there's no way I know of to do that.

I'm using MC 1.9-pre2



Best Answer

Since @a can detect dead players, but you apparently also have entities on the team, I suggest you do the following:

/testfor @a[team=Yellow] /testfor @e[type=!Player,team=Yellow]

The result will be as you requested.

PS. Sorry for being a few years late. xP




Pictures about "How to testfor a player positively even if the player is dead"

How to testfor a player positively even if the player is dead - Side view of jumping little girl in jeans and jumper kicking colorful ball playing on sports yard
How to testfor a player positively even if the player is dead - Photo Of Person Playing Soccer On The Field
How to testfor a player positively even if the player is dead - Positive Asian boy wearing protective helmet and sportswear of American football player in yellow studio



How do you detect what a player is looking at?

To testfor player's death, put in another command block: /testfor @a[score_deaths_min=<number of deaths>] . And there you go!



How To Detect When a Player Dies in Minecraft Using Commands




Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.

Images: Plato Terentev, Allan Mas, RF._.studio, Amina Filkins