3

I am making a skywars map and I am almost finished, I just need to teleport players with the deathCount of 1 back to the islands while turning them into gamemode 3 (spectator). Is there a way to only teleport the dead players, but keep the alive players still at their places? I don't want to use a fake player or anything, I just need the tag for the scoreboard that isn't [team="team name"]. I need something to testfor the deathCount objective on the scoreboard.

For example, with /testfor @a[Q=1] with Q as deathCount, what would Q be?

  • 4
    Please don't change your question to ask something different. Someone's already answered your question, so changing what your asking means they put in that hard work for nothing. – Frank Jan 2 '17 at 15:43
1

You can use a scoreboard objective to count deaths.

/scoreboard objectives add deaths deathCount will create an objective to count deaths.

You can then /tp @a[score_deaths=1,score_deaths_min=1] <wherever>

Of course, you would need to reset the score when the game is over.

1

UPDATE: This answer has become outdated due to a change in the question.

You need a scoreboard objective and a target.

Target: Some entity selector, or a fake player, whose score you can use for tracking on the objective, but it should only be one entity for lag purposes.

Then, here are the commands:

R=Repeating C=Chain`
TARGET=The target mentioned above
OBJ=The objective mentioned above

R: /scoreboard players set TARGET OBJ 0
C: /scoreboard players tag @a[tag=finalSurvivor] remove finalSurvivor
C: /execute @a[m=0, OTHER SELECTORS HERE ] ~ ~ ~ /scoreboard players add TARGET OBJ 1
C: /scoreboard players test TARGET OBJ 1 1
Conditional C: /scoreboard players tag @p[m=0] finalSurvivor

Remember to put it in standard chain fashion.

Then you can use @a[tag=finalSurvivor] to target the final player, you should do it at the end of the same chain.

0
/scoreboard objectives add Q deathCount
/tp @p[score_Q=1] X Y Z
/scoreboard players set @a[score_Q=1] Q 0
  • 2
    You should always try and include more than just a code snippet. It typically doesn't bode well for the poster otherwise. – Timmy Jim Jan 16 '17 at 19:46

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.