0

I am making a huge map (Not giving any spoilers!) it's taken me 13.4 days to make this, yet I ran into one problem. When a player dies the redstone still flows.

I was wondering if there is a way for a command block to detect whenever a player dies and be able to make it able to restart?

  • "When a player dies, the redstone still flows" What redstone? Who/what triggered that redstone? We need more information in order to solve your question – ALX Jul 8 '16 at 23:25
  • Ugh. The Redstone that powers the command blocks to send *cough command blocks to send aggressive items at the player/s – Emeraldimension Jul 8 '16 at 23:36
1

I believe you are asking for a way to send a redstone current whenever a player is "dead" (died and didn't hit respawn).

In Minecraft, being "dead" means you have 0 health, right? So all we need is a command to check their health. Luckily, that's pretty easy! All entities (or maybe just mobs, not 100% sure) have a "Health" tag. All we need is a testfor checking if you have 0 health, using this command:
/testfor @a {Health:0.0f}

What does the 's' mean?
Health is what is known as a short, a type of intsger value used in programming. You may have seen values such as "1b". 'B' stands for byte, a similar value, but with a smaller possible value. Bytes can store a number from -256 to 255, and shorts can store a number from -32,768 to 32,767.

One more thing! To receive the current, you must have a redstone comparator hooked up to the /testfor command block.
I hope this is what you are looking for! Just leave a comment or edit your question if this isn't!

  • 2
    Signed bytes have a range of -128 to 127. Also be aware that this will not work in 1.9+, as Health is a float rather than a short. That would be a very simple fix though, as you'd simply declare it as a float (Health:0.0f). – Skylinerw Jul 24 '16 at 1:22
  • Wait, Health used to be a signed byte? I thought it was a regular one, which just goes to show my command knowledge :) – Daniel G Jul 25 '16 at 2:05

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.