How do you make a value-dependent variable scoreboard objective? (Command Blocks, 1.16.5)
It's a bit difficult to explain in the title - basically, what I'm doing is making a Red vs. Blue team game that's almost completely powered by command blocks for its inner workings. A friend of mine helped me with the start, but he's become burned out and has shown me how a lot of it works so far so that I can continue it on my own.
The gamemode puts people in a small arena separated by a wall cutting off the entire middle, where people fight it out after the walls fall in a certain amount of time. Command blocks power most of it, but there's also an operator that controls a panel above the arena. I could just have the operator press a button to trigger some command blocks to say a team has won, but I want to cut out as much of this manual operation as possible.
The teams win via a kill requirement that varies based on how many teammates there are. Teams are selected evenly, but there can be times when there is an extra member on one of the two teams due to it not being even. This is fine, as the win requirement is that teams must get to 5 kills per person on the team. If there were 7 people on a team, it would require 35 kills to win. If the other team had 6 people, it would require 30 kills.
My problem: I've already worked out the combined number of kills. I don't know how to set a variable based on the number of players on the team, which (once the requirements are met) then triggers a series of command blocks to say a team has won.
It should also be noted that this is being done on a 1.16.5 (latest) Paper server with EssentialsX, WorldGuard, and some other QoL plugins.
TL;DR - Need a command, based on a # of teammates on one of two teams, that determines a playercount-based win requirement of kills.
What you will need to do is compare the scores against one another. Here I store the kill quota in another score:
execute if score RedTeam kills >= RedTeam killQuota run say Red wins! execute if score BlueTeam kills >= BlueTeam killQuota run say Blue wins!