2

I know that there is no direct way to create a variable in Minecraft but is there any way to manipulate scoreboard objectives into creating one?

Basically, I need to create a variable that will store a players X Y Z when they reach less than 10 health. The name of the "Health" objective is "down".

I'm not sure how to make this question less like a demand. I'm not sure where to start on this but the main thing that I am "Capable" of is looking online for other questions. The only thing that has come up are people asking for this to be added, but someone in a forum mentioned scoreboard objectives being able to do the trick.

EDIT

So I don't beleive I was clear enough: I need this to store the players location data live. As in a repeating command block test's for a player with less than ten health and then stores the players current location which I can then use later to teleport the player to the saved coordinates. E.g

/testfor @a[score_down=10] {Coordinated:[{X(var X) = 1,Y(var Y) = 2,Z(var Z) = 3}]}

Basicall y ^ that works like Coordinated < Position Tag, X < X position tag, var < declared that the output will be the variable.

THAT IS IMPOSSIBLE ^

But I hope you catch my drift by the way I explain it.

  • 1
    Third result on google: gaming.stackexchange.com/questions/224479/… – Jouramie Feb 24 '17 at 1:54
  • Wow I was expecting ten's of thousands worth of code. – Reflexive Feb 24 '17 at 2:01
  • Ah this is just creating a scoreboard objective, how to add to it, and how to set its display. I will update the question to make it more clear. – Reflexive Feb 24 '17 at 2:04
1

I realised that there was an alternative way to do what I needed to do and this did not involve creating a variable. The reason I wanted to know the player's location live was so I could freeze them on the spot. Instead, I used this:

/execute @a[score_down=10] ~ ~ ~ /summon ArmorStand ~ ~ ~ {Invisible:1b,Invulnerable:1b,NoBasePlate:1b,NoGravity:1b,Small:1b}

/tp @a[score_down=10] @e[type=ArmorStand]

You can, of course, give the ArmorStand a custom name to reduce glitchiness but I did not need it.

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.