#Teleport Entity to another Entity with same score

1 messages · Page 1 of 1 (latest)

remote saddle
#

I saw #1305585292954177566But just need a little help understanding it a little, if this is still the way it would work.

I have all my entities stored in a scoreboard, lets say entity.ID

For example, a pig and sheep have the same score, 1.

As the pig, I want to teleport the the nearest sheep with the same score as itself.

The commands and predicate posted by theblackswitchᴰᵉᵛ;

scoreboard players operation .entity_1 score = @s score
tp @s @n[predicate=matches_score]
{
  "condition": "minecraft:entity_scores",
  "entity": "this",
  "scores": {
    "score": {
      "min": {
        "type": "minecraft:score",
        "target": {
          "type": "minecraft:fixed",
          "name": ".entity_1"
        },
        "score": "score"
      },
      "max": {
        "type": "minecraft:score",
        "target": {
          "type": "minecraft:fixed",
          "name": ".entity_1"
        },
        "score": "score"
      }
    }
  }
}```
...looks exactly like what I want.
But I need help using it in my system.

What parts do I need to change to use `entity.ID` as my objective name, over `score`?

I tried figuring it out but nothing worked
queen kayak
#

In "score": "score" is where you enter the scoreboard objective you want to use. Then you should copy over the ID of the pig onto a fake player which in this predicate is called .entity_1 although I recommend using one that starts with a hashtag for example #search instead because it's better for performance and . is actually a valid char in some playernames

#

Also don't forget to edit this field to the objective too.

remote saddle
#

So it would look something like this?

{
  "condition": "minecraft:entity_scores",
  "entity": "this",
  "scores": {
    "entity.ID": {
      "min": {
        "type": "minecraft:score",
        "target": {
          "type": "minecraft:fixed",
          "name": "#search"
        },
        "score": "entity.ID"
      },
      "max": {
        "type": "minecraft:score",
        "target": {
          "type": "minecraft:fixed",
          "name": "#search"
        },
        "score": "entity.ID"
      }
    }
  }
}
queen kayak
#

yea indeed

remote saddle
#

Okay thats great thanks, i thouht i tried that ill attempt again

remote saddle