I have a checkpoint system in Minecraft 1.9 that detects a when a player is standing on a certain block, and then summons an armorstand where they are. If they step on a different kind of block, it teleports the player back to the armorstand. The problem is that this only works in single player. If there are 2 players, they will both keep setting checkpoints for each other, and it will become chaotic pretty fast. How can I make this work in multiplayer? PS: I have already tried naming armorstands after players, but you can't put selectors in the customname tag. I tried using scoreboards also, but I'm not so clear on how to use them, so I'm not sure if I'm going about it in the right way.
-
2Have you made any attempt to solve this yourself? Arqade works better when askers show effort to solve their own problems; we see that you have a problem you've worked on, and answerers respond to that. You also get a more specific answer that's tailored exactly to the part you're stuck, and Arqade gets a very specific question. Everybody wins!– FrankFeb 27, 2016 at 0:14
-
1I have. I have looked at naming the armorstand after the player, so that each player has their own personal checkpoint, but it turns out you can't use selectors in the customname tag. You also can't use selectors in scoreboards, and I have absolutely no idea how to solve this now.– cmotFeb 27, 2016 at 0:17
-
You could replace your check point with the /spawnpoint command– Jason_Feb 27, 2016 at 3:21
-
1Would that work?– Jason_Feb 27, 2016 at 5:03
-
Do you want to maintain the player's normal spawnpoint? Are players returned to their checkpoint in any other scenario than death?– SirBenetFeb 27, 2016 at 13:05
3 Answers
At the beginning, in order:
/scoreboard objectives add id dummy
/scoreboard players set @r[score_id=0] id 1
/scoreboard players set @r[score_id=0] id 2
/scoreboard players set @r[score_id=0] id 3
...
On checkpoint reached:
/execute @p[score_id=1,score_id_min=1] ~ ~ ~ detect ~ ~-1 ~ minecraft:diamond_ore 0 summon ArmorStand ~ ~ ~ {customName:'1'}
/kill @e[type=ArmorStand,name:'1',rm=3]
(repeat for all players, replacing all the 1's except the middle '~-1' with the player's id)
On fail:
/execute @p[score_id=1,score_id_min=1] ~ ~ ~ detect ~ ~-1 ~ minecraft:lit_redstone_ore 0 tp @p @e[type=ArmorStand,name='1'
(repeat for all players, replacing all the 1's except the right middle '~-1' with the player's id)
For silent checkpoints use these commands
/execute @r[type=armor_stand] ~ ~ ~ /spawnpoint @a[type=player,r=1]
/execute @r[type=armor_stand,name=NAME] ~ ~ ~ /spawnpoint @a[type=player,r=1]
Have the first command running at all times in your world and when a player goes in a armor_stand (that you can make invisible) then it will set their spawnpoint at the last point they touched the armor_stand ( The edge of its hitbox). If you are making a parkour map where you jump on thin platforms then put the armor_stand on the closest edge of the block where you are jumping from and it will set their spawn on the "checkpoint block". You can name the armor_stand(The name is invisible) but use the second command. This is a multiplayer friendly checkpoint system that is tested and will work for all of your checkpoints. But the more checkpoints you have the slower it is but you can have more of this command running to speed it back up. 1 command(At full speed = 10 checkpoints.
If you want the checkpoint to make a "ding" sound when you step on it just once then use these commands. Command 1 & 2 Only Need to be used Once, while 3, 4 & 5 always need to be running. 6 is a optional command that you should only use if you the players to see what checkpoint their on.
/scoreboard objective add CheckPoint dummy
/scoreboard players add [name] CheckPoint 0
execute @r[type=armor_stand,name=ARMORSTANDNAME] ~ ~ ~ /spawnpoint @a[type=player,r=1]
playsound minecraft:entity.experience_orb.pickup neutral @a[score_dummy=0] ~ ~ ~ 300
scoreboard players add @a CheckPoint 1
Optional 6. scoreboard objective setdisplay sidebar CheckPoint
For Each Checkpoint like this you a named armorstand (differant for each checkpoint) and in command #4 you need to change the "0" to the checkpoint your on (0 = checkpoint 1).