I'm trying to figure out how to set up an arena game, where whoever gets the most kills on the other person wins. I have everything set up, except i can't figure out how to get the game to end, telling who won once either person gets a certain amount of kills. 1.12.2 btw
200 ticks mean 10 seconds. The way you get the number of ticks needed is 20 * seconds = the number of ticks for the timer. In case you're wondering, we use 20 because 20 ticks in Minecraft is 1 second in real life.
and now you need a command block chain (see included image for layout) and paste all of these in:
execute if entity @a[tag=player] run scoreboard players add match timer 1
execute if score match timer = match matchDuration run execute as @a[tag=player] at @s if score @s kills < @a[limit=1,tag=player,distance=0.5..] kills run tag @s remove player
execute if score match timer = match matchDuration store result score match playerCount run execute if entity @a[tag=player]
execute if score match timer = match matchDuration if score match playerCount matches 1 run tellraw @a[distance=..50] {"text":"Winner: ","extra":[{"selector":"@a[tag=player]"}]}
execute if score match timer = match matchDuration if score match playerCount matches 2.. run tellraw @a[distance=..50] {"text":"It's a draw!"}
execute if score match timer = match matchDuration run scoreboard players reset match playerCount
execute if score match timer = match matchDuration run tag @a remove player
execute if score match timer = match matchDuration run scoreboard players reset match timer
To active the system, all you need to do is tag the players in the arena with "player" and the timer will start. Once the timer reaches the matchDuration, it will remove the tags and reset the timer.
I tested this with a sheep but it SHOULD theoretically work with players as well. Also, I suggest un-powering and re-powering the first two command blocks after you build this as they can freeze sometimes.
Sorry, I was so excited to write all the commands and I completely forgot you wanted those for 1.12. I will try to re-write them.
EDIT: I have no idea how to re-write some of these commands as I haven't touched the old 1.12 syntax in a while. If someone else who knows how to do it wants to take over, the template is right there.
I'm trying to figure out how to set up an arena game, where whoever gets the most kills on the other person wins. I have everything set up, except i can't figure out how to get the game to end, telling who won once either person gets a certain amount of kills. 1.12.2 btw
Create the following objectives:
set your match duration with this command:
200 ticks mean 10 seconds. The way you get the number of ticks needed is 20 * seconds = the number of ticks for the timer. In case you're wondering, we use 20 because 20 ticks in Minecraft is 1 second in real life.
and now you need a command block chain (see included image for layout) and paste all of these in:
To active the system, all you need to do is tag the players in the arena with "player" and the timer will start. Once the timer reaches the matchDuration, it will remove the tags and reset the timer.
I tested this with a sheep but it SHOULD theoretically work with players as well. Also, I suggest un-powering and re-powering the first two command blocks after you build this as they can freeze sometimes.
Command block engineer // Developer // #TeamTrees
I keep getting the message "Entity "if" cannot be found" in all command blocks but the second.
Sorry, I was so excited to write all the commands and I completely forgot you wanted those for 1.12. I will try to re-write them.
EDIT: I have no idea how to re-write some of these commands as I haven't touched the old 1.12 syntax in a while. If someone else who knows how to do it wants to take over, the template is right there.
Command block engineer // Developer // #TeamTrees
thanks anyway!