Minecraft – How to create automatic different levels for a mob arena 1.13.2

minecraft-commandsminecraft-java-edition

I am creating a mob arena using command blocks and redstone. But i need to know how to be able to create different levels that can only be started by defeating the entire prior level without having multiple buttons, and if i had multiple buttons for each level the player could abuse this system by farming a easier level to get items to buy items for the next battles, not to mention i am creating a hundred levels so thats a hundred buttons and a hundred redstone lines… So i would like to have one button that you can only click after defeating all of the current wave to be able to start the next wave.

Mob drops are unreliable so i cant create a giant hopper system requiring a drops from the mobs of that wave to start the next level, sometimes you will get extra drops then you need so they can start it before the current level is complete and sometimes less, not to mention i am using mob drops of a way to buy items so that would undermine the shopping system i have in place.

I haven't played minecraft since it seems countless updates ago so all my prior knowledge of commands has died because they changed the format for most commands.

Best Answer

You could have a single command block with your button and a command to check if there are no mobs left in the arena (tag them with arenaMob or something) and if there are none you increase their score in a currentLevel scoreboard: execute unless @e[tag=arenaMob] run scoreboard players add @p currentLevel 1. Then, for each possible level n you have a repeating command block checking for if the currentLevel of the player in the arena matches n and if it does you power a 'needs redstone' command block with a redstone block: execute if score @p matches n run setblock (some coords) minecraft:redstone_block. That command block and chained blocks coming from it spawn whatever mobs you need for the next level. Whenever they finish the level and push the button, the score increases and the always active repeating command block for the n+1 level powers the n+1 chain. Each level can only be done once unless you clear the redstone block powering the mob spawning chain. To do multiplayer you'd need to tag the player in the arena with arenaFighter or something like that and replace all of the @p's with @a[tag=arenaFighter]. Make sure to remove the tag when they're done fighting.