I am wondering if there is a better way to track, or test, how fast a player is going, then activate command off that. So far I have: /scoreboard objective add Sprint stat.WalkOneCm
Then, every tick I have that set to zero. /scoreboard players set @p Sprint 0
Then, after it resets 5 times, It tests to see if the players movement speed if in between 150 and 200 WalkOneCm score per tick. If true, then you get a speed boost. However, sometimes it fails, and tests when its at 50 or so. Is there a better measurement?
-
2Are you using 1.8 or 1.9 version of Minecraft?– Jason_Commented Mar 24, 2016 at 0:45
-
How are you doing your test? That seems to be the important part.– MBraedleyCommented Mar 24, 2016 at 9:56
-
I am using 1.8 Jason_ @MBraedley I am using a testfor command /testfor @p[score_Sprint=200,score_Sprint_min=150] and that activates every 5 ticks. Each reset is 1 tick– c15kenworthmanCommented Mar 27, 2016 at 1:45
-
also, I have no idea how to highlight test, only bold and italic it. sorry about that, I would highlight commands if I knew how.– c15kenworthmanCommented Mar 27, 2016 at 1:45
-
With the editor just push the button that looks like two brackets { } and it will format your code nicely for you.– Shoddy WeatherCommented Feb 26, 2020 at 17:26
1 Answer
I found a possible answer, but I haven't got it to work yet:
First, you build a clock (with a bit longer delay).
Then, you let a set of Command blocks be triggered at once. Theese CMD blocks should summon a circle of Armour Stands with different names around the Player.
Then, after a small delay, a CMD Block row tests the Player distance from each ArmorStand (by name). If any Player-ArmorStand distance is smaller then, let's say, 1 block, another command is executed, eg.:
/execute @e[name=ArmorStand1] ~ ~ ~ execute @a[r=1] say @p is sprinting
If summoned in this way, it gives a total of 24 CMD blocks:
_ ■ ■ ■ _
■ _ _ _ ■
■ _ P _ ■
■ _ _ _ ■
_ ■ ■ ■ _
P for Player, ■ for ArmorStand, _ for nothing.