楼主说可以指定范围,然而问题还是太抽象,我就按照我自己的理解来写了
按你说的
比如要以 x y z为基点,长宽高10 20 30大小的长方体体积内,在所有命令方块下放一个命令方块
xyz均为某实体[tag=pos]在XYZ记分版的分数
- gamerule gameLoopFucntion a:b
- a\b.mcfunction:
- summon area_effect_cloud ~ ~ ~ {Tags:["marker"]}
- tp @e[tag=marker] 0 0 0
- function a:c
- function a:d
- function a:e
- a\c.mcfunction:
- tp @e[tag=marker] ~1 ~ ~
- scoreboard players add @e[tag=pos,score_X=-1] X 1
- scoreboard players remove @e[tag=pos,score_X_min=1] X 1
- function a:c unless @e[tag=pos,score_X_min=0,score_X=0]
- a\d.mcfunction:
- tp @e[tag=marker] ~ ~1 ~
- scoreboard players add @e[tag=pos,score_Y=-1] Y 1
- scoreboard players remove @e[tag=pos,score_Y_min=1] Y 1
- function a:d unless @e[tag=pos,score_Y_min=0,score_Y=0]
- a\e.mcfunction:
- tp @e[tag=marker] ~ ~ ~1
- scoreboard players add @e[tag=pos,score_Z=-1] Z 1
- scoreboard players remove @e[tag=pos,score_Z_min=1] Z 1
- function a:e unless @e[tag=pos,score_Z_min=0,score_Z=0]
- a\b.mcfunction续:
- summon area_effect_cloud ~ ~ ~ {Tags:["pos2"]}
- scoreboard players set @e[tag=pos2] X 9
- scoreboard players set @e[tag=pos2] Y 19
- scoreboard players set @e[tag=pos2] Z 29
- function a:f
- function a:g
- function a:h
- a\f.mcfunction:
- execute @e[tag=pos] ~1 ~ ~ function a:i unless @e[tag=pos,r=1]
- a\i.mcfunction:
- summon area_effect_cloud ~ ~ ~ {Tags:["pos"]}
- a\f.mcfuntion续:
- scoreboard players remove @e[tag=pos2] X 1
- function a:f if @e[tag=pos2,score_X_min=1]
- a\g.mcfunction:
- execute @e[tag=pos] ~ ~1 ~ function a:i unless @e[tag=pos,r=1]
- scoreboard players remove @e[tag=pos2] Y 1
- function a:g if @e[tag=pos2,score_Y_min=1]
- a\h.mcfunction
- execute @e[tag=pos] ~ ~ ~1 function a:i unless @e[tag=pos,r=1]
- scoreboard players remove @e[tag=pos2] Z 1
- function a:h if @e[tag=pos2,score_Z_min=1]
- a\b.mcfunction续:
- execute @e[tag=pos] ~ ~ ~ detect ~ ~1 ~ commond_block -1 setblock ~ ~ ~ command_block 0 replace
- kill @e[tag=pos]
- kill @e[tag=pos2]
复制代码