Minecraft using player score as a variable
In a map I'm making I have a command block loop, and for every time it loops all players speed increases by 1 tier. Anyone know how to do this?
Best Answer
While being able to take a value from a scoreboard and use it as the tier of an effect would be nice, it is impossible without using many command blocks (one for each tier).
I'll give an idea of how I'd do it:
It's nice and easy to increment scoreboards using
/scoreboard players add @a <scoreboard name> 1
You could use a dummy player instead of every player, but doing it this way, you can exclude players (maybe when they die, or when they do, they're speed is reset).
Then in a bunch of command blocks (in 1.9 chain command blocks come in handy) put in each block:
/effect @a[score_<scoreboard>_min=<x>,score_<scoreboard>=<x>] speed <seconds> <x>
Pictures about "Minecraft using player score as a variable"
How do you code a scoreboard in Minecraft?
Scoreboard CommandCan you use variables in Minecraft commands?
Minecraft commands do have a form of variables, but, unfortunately, they can only store numeric values. This is called the scoreboard, and you can add and access variables by using the /scoreboard command.Minecraft Scoreboard Command Tutorial [1.18]
More answers regarding minecraft using player score as a variable
Answer 2
You could have the /effect speed code in a repeating command block or if you want it to happen slower, have it on a clock. If you wanted to have the speed go up after each loop, you cold have multiple command blocks with the different commands and use pistons after each clock loop to enable them to be powered.
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Pixabay, Fardad Postwala, RF._.studio, RF._.studio