Arqade Asked by IceFreez3r on December 5, 2020
I want to execute a command on all players withhin a distance from an armorstand (Let’s call him "A"). The distance is stored in the scoreboard "Distance" for that armorstand ("Distance" of A is e.g. 13). This means that execute as @e[name=A] at @s as @a[distance=..13] ...
doesn’t do the trick, because the 13 is a constant here and I don’t really want a command for every possible distance from 1 to 100.
I had the idea to store the distance of all players to that armorstand in their "Distance"-score and then compare the 2 scores for every player. But I don’t know a way to store the distance in an scoreboard or to get it with a command.
Is there a way to do this?
I found a solution on YouTube:
.Here is essentially what he is doing:
@e[tag=a]
, Take the second entity with at @e[sort=nearest,limit=1]
execute store result score @s math_in run data get entity @s Pos[0] 100
Newton-Raphson, 4 iterations approach
. I don't have the math skills to quickly understand that method, but the results the datapack give are correct. To get the full list of commands, download his datapack.Correct answer by IceFreez3r on December 5, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP