mojira.dev
MC-185450

Tp in a function sometimes don't work.

I want to measure the distance between two armor stands in a mini-game. I created a function and a scroeboard objectiv. At the first armor stand I have an armor stand that looks at the second. There is the scoreboard object "dummy" with the players "counted" and "again?", Whose guards are both times 0, the object "number" with the "1" fen value 1 and the function "counter" with the content:

tp @s ^ ^ ^ 0.1
scoreboard players add counted dummy 1
scoreboard players set again? 1
execute at @e [tag = target, distance = .. 0.15] run scoreboard players set again? dummy 0
execute if score again? dummy = 1 number run function counter

However, the result of "counted" was 10.9XX (For the X I don't know the exact value anymore) even when the second armor stand was a block next to the first one. I have from the content of the function:

tp @s ^ ^ ^ 0.1
tp @s ^ ^ ^ 0.1
scoreboard players add counted dummy 1
scoreboard players set again? 1
execute at @e [tag = target, distance = .. 0.15] run scoreboard players set again? dummy 0
execute if score again? dummy = 1 number run function counter

made, and she carried out herself, but was only teleported 0.1 block forwards. With:

tp @s ^ ^ ^ 0.1
tp @s ^ ^ ^ -0.1
scoreboard players add counted dummy 1
scoreboard players set again? 1
execute at @e [tag = target, distance = .. 0.15] run scoreboard players set again? dummy 0
execute if score again? dummy = 1 number run function counter
however, I was teleported 0.1 blocks back and at:
tp @s ^ ^ ^ 0.1
tp @s ^ ^ ^ -0.1
tp @s ^ ^ ^ 0.1
scoreboard players add counted dummy 1
scoreboard players set again? 1
execute at @e [tag = target, distance = .. 0.15] run scoreboard players set again? dummy 0
execute if score again? dummy = 1 number run function counter

again 0.1 block forwards. I assume that this should not be the case.

Comments 1

execute at @e [tag = target, distance = .. 0.15] run scoreboard players set again? dummy 0

That's not a valid command.

pama__

(Unassigned)

Unconfirmed

(Unassigned)

1.15.2

Retrieved