-2

I’m making a spleef mini game in Minecraft pe/bedrock and I need to detect if there is ONLY ONE player left in the arena. Only one player and no more and no less.

  • Detect two, exclude. Detect one, AND connect. – Fabian Röling May 29 '18 at 5:50
  • What do you mean @Fabian – NoScope May 29 '18 at 23:34
  • I'm pretty sure this has been answered before, just use Google. There are many possibilities, probably the best one is to test for two players and test for one player and only if the first one fails and the second one succeeds, you have exactly one player. I won't go into even more detail, because if I wanted to put more effort into this question, I would search the first question of this kind and close this as a duplicate of it. – Fabian Röling May 30 '18 at 6:39
0

/testfor @a[r=20,c=__]

How this works is the number after the “c” is the amount of max redstone strength through a comparator if 7 people are in the 20 block radius (toggle the number to the size of your area) if the number after c is 6 redstone goes 6. If it is 7 it will go 7. If it is 8 redstone goes 7. If you want a specific mode because a spectator can mess it up.

/testfor @a[r=20,c=__,m=0]

0 meaning survival m meaning mode

FURTHER IN

0 is survival mode

1 is creative mode

2 is adventure mode

3 is spectator mode

| improve this answer | |
0

When the match starts, have the respawn point be outside the render distance, maybe 400-500 away. For this to work, there will have to be an outdent in one of the walls. This area in the arena is where the last person must go to to win. Have a command block whose range stops about 1-2 blocks from this outdent. Then, run the command “/testfor @e[type=player]”. Have a chain command block place a repeater that connects two redstone lines. Wire the output into an inverter circuit. Run this new redstone output into command blocks THAT ARE WITHIN RANGE OF THE ENTIRE ARENA. I warn you that this system has two flaws, one which has an unorthodox solution. Firstly, should all the players go into the “win zone”, the command block module will activate, resulting into a collective victory. The other problem occurs when the second to last player is killed, but the “win zone” is cut off by holes, therefore making it impossible to get to the win zone. To solve this, I suggest this strange solution. Be warned that this will change gameplay a bit. Each player is to have 5 scaffolding blocks, preferably something like dirt, at the beginning of the round. The “/replaceitem” command makes sure they can only have 5 dirt blocks at once. If the gamemode is adventure, add the “can_be_placed” tag. The blocks dirt can be placed on should be itself, snow and the material(s) your walls are made of. Also, remember to add the “can_destroy” tag to the shovel.

| improve this answer | |
-1

Most of my experience is to do with the java edition, however this still might work

Edit: I've been informed that scoreboards do not exist on the pocket edition, as such this solution will not work for that version. However I'll leave this answer for people using the Java edition

If you have a command block with a /testfor for the area, you can use a /stats command to put the result, aka how many players are left, into a scoreboard objective.

First make the scoreboard:

/scoreboard objectives add <score_name> dummy

Note: <score_name> is whatever you want, just has to be the same everywhere

Then run this command once:

/scoreboard players set <name> <score_name> 0

This will make a fake player with name of <name> to store the count of players.

Then run this command in the command block that's going to have the /testfor command:

/stats block ~ ~ ~ set QueryResult <name> <score_name>

Note: you can also look at the command block and tab-complete in the x, y and z location of the command block and run it from the chat, I'd recommend this way. (if pocket edition has tab-completion idk)

Lastly to check if the right amount of players are left use:

/scoreboard players test <name> <score_name> 1 1

Note: the first 1 is the min, the second is the max, so it could be used to check if a range of players are left, or whatever.

I don't know if this will actually help, but I'm hoping it will. Enjoy your custom spleef.

| improve this answer | |
  • 1
    No scoreboards in mcpe. – holroy Jun 16 '18 at 11:38
  • 1
    They are going to be added in Minecraft Bedrock Edition 1.7 – Detmondyou Sep 11 '18 at 23:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.