I'm trying to recreate Runner in Minecraft 1.9 singleplayer, but I cannot get how to set up a delay so that the player can run without getting killed.

  • 2
    What do you mean by "a delay within a command block"?
    – SirBenet
    Nov 8 '15 at 18:28
  • 2
    so that the player can run without getting killed., I think u don't mean it like that, right? You wan't the player having to run, for not getting killed. Please fix that.
    – Mystery
    Nov 8 '15 at 23:22

Add an scoreboard objective: /scoreboard objectives add Moving stat.walkOneCm

Run the following commands in a clock(in exactly that order):

/kill @a[score_Moving=0,m=!1]
/scoreboard players set @a Moving 0

Warning: Be careful when setting this up. You will get killed, when not walking/running. And when the machine is killing you the whole time, you have no chance to disable it(except for external tools).

  • You could change that to /kill @a[score_Moving=0,m=!1] so it only kills you, if you are not in creative mode.
    – Lars
    Nov 10 '15 at 12:36
  • @Lars Thanks for the suggestion, I edited the answer accordingly.
    – Mystery
    Nov 10 '15 at 12:46
  • Jumping will kill you in this setup, as stat.walkOneCm does not increase when jumping.
    – MrLemon
    Nov 10 '15 at 13:46
  • Whoops. I accidentally approved and realised that the edit was a 'hijack'.
    – aytimothy
    Mar 10 '16 at 0:02

I think what you want is a "grace period" for not running? I.e. the command blocks kill you if you stand still for more than, say, a second?

If so, you can run these in a repeat/chain setup:

/scoreboard players set @a OnGround 0 {OnGround:0b}
/scoreboard players set @a OnGround 1 {OnGround:1b}
/scoreboard players remove @a[score_Moving_min=1] Moving 1
/scoreboard players set @a[score_Moving_min=20] Moving 20
/kill @a[score_Moving=0,score_OnGround_min=1,tag=Running]
/scoreboard players tag @a[score_Moving=0,score_OnGround_min=1,tag=Running] remove Running

Moving is a stat.walkOneCm type objective, the OnGround tag is dummy. Moving does not increase while jumping/falling, which makes this addition necessary or else jumping or falling could kill you. The Running tag is to prevent an endless kill loop, add it to anyone that has to run to not die.

To adjust the timing, adjust the score set in the second command (both in the target selector and the set command) to the number of ticks the player may stand still (20 ticks = 1 second). This command acts like a "hard cap" on the Moving score (it can never exceed the value given).

  • You should mention, that the "tag" commands are only available in the latest 1.9 Snapshots, as the full 1.9 version isn't available yet.
    – Mystery
    Nov 10 '15 at 22:12
  • Milesman32 uses 1.9(snapshots), but other people with a similar problem, may use an earlier version.
    – Mystery
    Nov 10 '15 at 23:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.