Change entity score within a rectangular area of the player
I am trying to set an entity to have a score of one in a scoreboard system, but only when they are within a specified range of the player. I do not want to use the r=[number]
specifier. I am trying to use x, y, z and then use dx, dy, and dz to set a very specific area. Right now I am using:
/execute @a[score_rightClick_min=1,score_spellActive.fire_min=1,lm=5] ~ ~ ~ scoreboard players set @e[x=~4.5,y=~0.25,z=~-4.5,dx=-8.5,dy=-0.1,dz=8.5,team=!Players] target.fire 1
The only problem with this is that it doesn't get the correct radius. It only seems to give them the score if they are right next to the player.
Part 2: Okay, so I am having the same issue now, but this time it is doing things outside of the range that I have specified.
/execute @e[score_burned_min=1,score_burnTimer_min=5] ~0.5 ~ ~-0.5 scoreboard players set @e[dx=-1,dy=0,dz=1,team=!Players] burnChained 1
Not really sure what is going wrong here. If anyone knows that would be great.
You cannot use relative coordinates in target selectors. You also cannot use decimal values, only whole integers.
You can use /execute
's coordinates to modify the origin relative to the target, but you will have to adjust the dx/dy/dz
values yourself to a proper whole number that fits your needs:
/execute @a[score_rightClick_min=1,score_spellActive.fire_min=1,lm=5] ~4.5 ~0.25 ~-4.5 scoreboard players set @e[dx=-8,dy=-1,dz=8,team=!Players] target.fire 1