0

I'm trying to make a couple of command blocks that are capable of emitting a redstone signal whenever the player jumps. I thought I would do it by constantly checking whether the Jump objective was the same as a dummy objective which always changes itself to the Jump objective.

To get to the point I need to set a dummy scoreboard objective called OldTotalJumps to an scoreboard objective which I've named TotalJumps. I have tried: scoreboard players set OldTotalJumps TotalJumps but it keeps coming up with the error: "TotalJumps is not a valid number". I hope someone can help.

1
  • 1
    As a side note, please don't mix redstone and command blocks, its a really bad idea. Instead, if you need to activate some redstone based on a command block, use the setblock command to place a block of redstone in an appropriate place.
    – MBraedley
    Commented Aug 31, 2017 at 14:19

1 Answer 1

4

There is a better way of solving your problem. Instead of creating a new dummy objective, you can simply reset the jumps objective to 0 every tick.

You would need to run the following command once:

/scoreboard objectives add jumps stat.jump

And these on a clock:

/execute @a[score_jumps_min=1] ~ ~ ~ do stuff
/scoreboard players set @a[score_jumps_min=1] jumps 0

Of course you replace do stuff with the command/function you actually want to run.

 

If you're still interested in solving the exact problem you posed, there is a different /scoreboard 'subcommand' that can do that: operation. The following command sets the command executor's oldtotaljumps score to its totaljumps score.

/scoreboard players operation @s oldtotaljumps = @s totaljumps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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