Note: This is not for 1.13, but 1.12
I want to create a checkpoint system for my Parkour map, but I fail everytime.
When a player stands on an emerald block, this should be his checkpoint. If he needs to get back, he should use an item (like Carrot on a Stick) to get back to his latest checkpoint. There will be more than 1 emerald block and this should be multiplayer friendly (for up to 4 players).
What I did:
- Set up a scoreboard that checks if a carrot on a stick gets
rightclicked, and on what team the player is (only 1 player per
team) - An execute command that checks if the player stands on an command block. If it's true, an already summoned armor stand with the name will teleport to the player, while the command block is active.
When the player now fails, he can right click his carrot on a stick, to get teleported to the Armor stand (I don't have this command, because when the other thing don't works, it's useless anyways)
/summon armor_stand ~ ~ ~ {Invisible:1b,Invulnerable:1b,PersistenceRequired:1b,NoGravity:1b,Small:1b,Marker:1b,CustomName:"P1CP",DisabledSlots:2039583}
/execute @p[score_P1=1,score_P1_min=1] ~ ~ ~ detect ~ ~-1 ~ minecraft:emerald_block 0 tp @e[Name:P1CP] @p
P1CP = Name of Armorstand (P1 = player 1; CP = checkpoint)
Best Answer
Answer:
/scoreboard objectives add carrot stat.useItem.minecraft.carrot_on_a_stick
/scoreboard objectives add P1 dummy
/summon armor_stand 151 102 -188 {Invisibility:1b,Invulnerable:1b,Small:1b,Marker:1b,CustomName:"P1CP",DisabledSlots:2039583}
/testfor @p[score_P1=1,score_P1_min=1,score_carrot=1,score_carrot_min=1]
tp @p[score_P1=1,score_P1_min=1] @e[name=P1CP]
tp @p[score_P1=1,score_P1_min=1] ~ ~ ~ ~ 0
scoreboard players set @p[score_carrot=1,score_carrot_min=1] carrot 0
/execute @p[score_P1=1,score_P1_min=1] ~ ~ ~ detect ~ ~-1 ~ minecraft:emerald_block 0 tp @e[name=P1CP] @p[score_P1=1,score_P1_min=1]
The scoreboard names "carrot" and "P1" and the armor stand name "P1CP" can be changed, but don't forget to change the name in every command block that has the names in it. "minecraft:emerald_block" can be changed into a block of your choice. Make sure your command blocks are in the spawn chunks, so when you can't see the command block's chunks, it will still work.