1

I have found some answers for this, but they were all outdated and didn't work. So I'm making a kind of battle royale type minigame in vanilla minecraft, and all I have left is seeing how many players are left. So I need to emit a redstone signal once only 1 player is in adventure mode. Currently, I am putting dead players in spectator mode.

9
  • 1
    I'm kinda new to this place, so sorry if I caused you any inconvenience :). but heres the link, gaming.stackexchange.com/a/303654/263657
    – puff
    Dec 27, 2020 at 19:34
  • You can try an alternate solution: maybe check how many players died, and if this amount is 1 less than the total amount of players, declare victory.
    – John
    Dec 27, 2020 at 19:58
  • 1
    @puff I would suggest not using redstone unless you're linking it to a redstone contraption. Store it to a scoreboard using the /execute store command, and use /execute if score to detect when there's only one player left.
    – One 2 Many
    Dec 27, 2020 at 23:22
  • 1
    @puff If you want to trigger commands when the condition is true, run /execute if score FakePlayer myObjective matches 1 run setblock 12 23 34 redstone_block. This will set a redstone block next to the command blocks you want to run. Don't use comparators because they don't work well with command blocks.
    – One 2 Many
    Dec 28, 2020 at 0:11
  • 4

1 Answer 1

0

Make a dummy scoreboard to store players alive and wether there's only one player left

/scoreboard objectives add PlayerStats dummy

then test how many people are alive each tick

execute store result score Alive PlayerStats run execute as @a[gamemode=survival] run difficulty

this part checks how many are alive, runs the next line for each of them and stores how many times the next line was ran to player "Alive"'s score (difficulty is a dummy command that always returns yes and doesn't spam the chat)

then after run add the next part. it add's 1 to Last's score if Alive's score is 1 then add a chain command block that runs this

execute if score Last PlayerStats matches 1 run scoreboard players add Last PlayerStats 1

chainblock -> and now just check for dummy's last for being 1 or higher and set a redstone block where you need

execute if score Last PlayerStats matches 1 run setblock ~ ~ ~3 minecraft:redstone_block

and after all that rest all the scores

scoreboard players reset Alive PlayerStats
scoreboard players reset Last PlayerStats
1
  • Ok edited to actually answer the question. sorry for the mishap at start :/
    – jklw10
    Jan 1, 2021 at 16:43

Not the answer you're looking for? Browse other questions tagged .