Number of living players is broken in Elimination

My “boss fight” gamemode uses “Number of living players” command to change health of the boss. For instance:

Condition:
If Number of living players (Team 1) =! [Random variable that detects if number of living players in team 1 has changed]
Action:
Set damage received (All players (Team 2)) Subtract (100, Number of living players (Team 1))

The problem is, if someone joins Team 1 midgame, workshop counts them as a living player, therefore the damage that boss receives is incorrect. How can I fix this?

You need to store the numbers of living players for each team and on the events if someone leaves/joins and spawns you need to update those variables each time or of event call. To get the actual number of living players currently in game you need to use count of and filtered/sorted array value.

1 Like

You could try to replace this:

with this:

count of(filtered array(all living players(team 1), has spawned(current array element)))
2 Likes

Thanks a lot, your answer fixed the problem.

2 Likes