I've been trying to figure this out for a few days now. These commands aren't working consistently
Update: I've got the commands to work consistently. The trick was to call the entire function as the entity ... forever
Update2: consistently... so long as the entity can be returned by target selectors. Move too far away and @e doesn't find it anymore
These are commands from my .mcfunction files. not command_block or console. They all execute within a single tick
'unique' is a scoreboard value I created that is common to the entity and the player that summoned it. I'm trying to tp the player to the entity (with the entity doing the tp to itself) if the scoreboard values match.
Here is my current command, called via execute as @e[name=home] run function v0923:home
execute if score @s unique = @p[scores={home=1..},limit=1] unique as @s run tp @p[scores={home=1..},limit=1] @s
This is how I'm summoning the entity and setting unique, tickcount is the global # of ticks the server has ever been running
execute as @s at @s run summon minecraft:armor_stand ~ ~ ~ {CustomName:"home",NoGravity:1b,Marker:1b,PersistenceRequired:1}
execute as @s at @s run scoreboard players operation @e[name=home,sort=nearest,limit=1] unique = @s tickcount
execute as @s run scoreboard players operation @s unique = @s tickcount
I've been trying to figure this out for a few days now. These commands aren't working consistently
Update: I've got the commands to work consistently. The trick was to call the entire function as the entity ... forever
Update2: consistently... so long as the entity can be returned by target selectors. Move too far away and @e doesn't find it anymore
These are commands from my .mcfunction files. not command_block or console. They all execute within a single tick
'unique' is a scoreboard value I created that is common to the entity and the player that summoned it. I'm trying to tp the player to the entity (with the entity doing the tp to itself) if the scoreboard values match.
Here is my current command, called via execute as @e[name=home] run function v0923:home
This is how I'm summoning the entity and setting unique, tickcount is the global # of ticks the server has ever been running
Anyone running 17w50a, Feel free to come test this out for me
Server: MC.NIGELTODMAN.COM
I usually do this:
create another temp scoreboard.
When you need to check it,
do something like (x is the temp score, y is the score of the player or entity)
/scoreboard players operation @e[...] x = @e[...] y
Then, do (z is the score you wanna compare, can be an entity or player)
/scoreboard players operation @e[...] x -= @e[...] z
After that, just do the /execute if stuff.