1

Assuming that there is only one entity with that same score for that objective

What I'm trying to do is, if certain conditions are met for one entity, it will execute a command at another entity with the same score for that objective (one way). Is that even possible?

4
  • Can you give an example of what needs to happen? I don't fully understand the question.
    – user176681
    May 22, 2017 at 2:32
  • @cloudrac3r Well, here's an example: If you place a block next to an entity, it will detect that and execute a command at another entity with the same score on the same scoreboard objective as the one that detected the block. (Don't worry about the detecting the block part, it's basically some way to trigger it)
    – Meh
    May 22, 2017 at 2:57
  • As far as I know, this isn't possible without setting up a command block for every possible scoreboard value. If you told us what this was actually going to be used for, instead of an example that doesn't fully apply, I might be able to come up with a workaround or alternative way of solving the same problem.
    – user176681
    May 22, 2017 at 3:15
  • @cloudrac3r Well, I'm trying to make a one command block creation that lets you generate a block that acts as a redstone circuit. This is the part that I wasn't sure would be achievable... I have an ID system that assigns each of these blocks/circuits a score and I want it so you can have the inputs and outputs wirelessly connected using those PIDs. If not, I can just forget about wirelessly doing that, but then I would have hundreds of command blocks because I would have to test for every possible direction the inputs and outputs could be, which wouldn't really be practical for a one-command.
    – Meh
    May 22, 2017 at 3:24

1 Answer 1

0

I'm a bit late, but I know a solution for your problem, so I thought I'd post it anyway. This is a method that I have used before to execute a command at entities with a similar score. This method works for minecraft 1.12

Let's pretend there are two different types of entities: armorstands and zombies. Each armorstand has a unique score and so have the zombies.

Let's also say there are two scoreboards: standScore and zombieScore.
For this method I need one extra scoreboard. I'll call it math.

Execute some command at armorstands with the same score as a certain zombie:

# set math score for each armor stand to their personal score
execute @e[type=armor_stand] ~ ~ ~ scoreboard players operation @s math = @s standScore

# subtract the score of this certain zombie from all the armorstands
scoreboard players operation * math -= [certain zombie] zombieScore

# all armor stands with the same score as the zombie, now have a score of 0 on the math objective
execute @e[score_math_min=0,score_math=0] ~ ~ ~ [some command]

# make sure that the math objective is cleaned after use to prevent errors in later commands

You can also do this the other way around, but you better use an extra math objective to store all the zombie entities, just to be sure.

This method has one drawback, which is that all the entities have to be inside render distance, because otherwise they don't get targeted by the target selectors.

I hope this helps

1
  • I thought I already replied to this, but apparently I didn't. I don't think the render distance is an issue. Thanks for your answer. Appreciate when people leave good explanations.
    – Meh
    Oct 19, 2017 at 20:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .