Currently, there is no easy way to change the position of the execution context based on a scoreboard value.
If you don't know that the position you want to go to is loaded, the only way to accomplish this is essentially converting the coordinate to binary and moving using `/execute positioned` for every binary digit; i.e.:
execute if score x coord matches 0.. positioned 0 ~ ~ run function move_1
execute if score x coord matches ..-1 positioned -33554432 ~ ~ run function move_1
move_1.mcfunction:
execute if score x coord matches ..-1 scoreboard players add 33554432
execute if score x coord matches ..16777215 run function move_2
execute if score x coord matches 16777216.. positioned ~16777216 ~ ~ run function move_2
move_2.mcfunction
execute if score x coord matches 16777216.. scoreboard players remove 16777216
execute if score x coord matches ..8388607 run function move_3
execute if score x coord matches 8388608.. positioned ~8388608 ~ ~ run function move_3
... and so on.
My proposal is to add a new execute sub command for this purpose which can change the coordinate context based on a scoreboard value. This could look like this:
/execute position (set|add|remove) (x|y|z) <score_holder> <objective> <scale>
<scale> is there to allow for changing decimal places as well, the rest should be self-explanitory.
Note that /execute store coordinate would not work, since you'd need the command after run to read the coordinate, so you couldn't have a command to apply the new execution context to.
Please sign in to leave a comment.
1 Comments