You should run the following command before the /effect
command, to make all entities with the tag "Detector" give all players within a radius of 10 a tooClose score of 1:
/execute @e[tag=Detector] ~ ~ ~ /scoreboard players set @a[r=10,rm=1] tooClose 1
And then reset the score after the /effect
command has been run:
/scoreboard players set @a[score_tooClose_min=1] tooClose 0
You can replace r=10
with your detection radius, and tag=Detector
with however you're identifying the mobs you are wanting to detect the player, or keep the tag and do something like to add the tag to mobs:
/scoreboard players tag @e[type=Zombie] add Detector
If each player has individual scores, the first step would be to add them all up into one cohesive team score. One way to do this would be to use a fake player for each team.
Setup:
/scoreboard objectives add teamScore dummy
Run whenever you want to update the scores:
/scoreboard players set red teamScore 0
/scoreboard players operation red teamScore += @a[team=red] enemyKills
/scoreboard players set blue teamScore 0
/scoreboard players operation blue teamScore += @a[team=blue] enemyKills
This will create two scores in teamScore
. One named red
with the combined enemyKills
scores of everyone on the red
team, and one named blue
with the combined enemyKills
scores of everyone on the blue
team.
To test if a team has won:
/scoreboard players test red teamScore 100
will test if the red team has won, while
/scoreboard players test blue teamScore 100
will test if the blue team has won.
Obviously, you don't have to use red
and blue
for the team names, and you could do this for more teams if necessary. And you don't need to use enemyKills
for your scoreboard objective, the names were just arbitrarily chosen and could be any valid name.
Hope this helps! If you find anything unclear, just comment below.
Best Answer
Well the problem here is that you can't make scoreboards for things such as health, or damage dealt in Bedrock Edition (BE), so it's almost impossible.
I can't think of any way you could do this.