#Selecting entities with a lower score

1 messages · Page 1 of 1 (latest)

white marlin
#

Hi, I'm trying to get some entities to work in a chain and they all have a different score that is their position in the chain. I need to get some information between them so I was wondering how I may select entities in a radius with a lower score than the entity that is executing the command.

E.g. if there is one entity that is in position 5, I need to run a command from 5 to all entities with a score of 4, then from 4 to 3, 3 to 2, etc.

Specifically I'm moving a secondary score, An entity in position 5 that has a score of say 3 needs to move that score down the line.

Thanks,

supple fern
#

Can you send a screenshot or short clip of what the entity setup looks like? I'm just imagining a bunch of villagers in an assembly line.

white marlin
#

It's actually a setup for electricity poles, The secondary score is how much power is being generated/consumed. The idea of a bunch of villagers in a factory line is quite funny though,

sour thicket
#
scoreboard players reset * powerCal
execute as @e[type=addon:pole] run scoreboard players operation @s powerCal = @s power
scoreboard players add @e[type=addon:pole] powerCal -1
execute as @e[type=addon:pole] at @s as @e[type=addon:pole,r=10] if score @s power = @e[c=1] powerCal run particle minecraft:balloon_gas_particle ~~5~
sour thicket
#

just make sure to change the entity identifier and scoreboard name

#

( this can also get pretty laggy if you have a bunch of poles bunched up in one place )

#

since its executing a if score check for every entity thats in a 10 block radius so if you had 10 poles grouped up together

the amount of commands running each tick would be 10x10

pure mesa
#

Meegy ur built like an egg