TeamB,distance=..3]这些指令将创建两个队伍,然后在每个队伍中加入对应的生物。接下来,在每个队伍中将生物的攻击和血量设定为一定的数值,最后使用指令定期检测攻击目标并相应地进行传送。这样,就能实现生物互相攻击的效果了。
在《我的世界》中,要让生物互相攻击可以使用以下指令:
1. 使用“/team”指令创建两个不同的队伍,例如:
- /team add TeamA
- /team add TeamB
2. 使用“/scoreboard”指令创建两个计分板目标,例如:
- /scoreboard objectives add attack dummy
- /scoreboard objectives add health health
3. 使用“/scoreboard”指令为每个队伍的成员设置计分板目标,例如:
- /scoreboard teams join TeamA @e[type=minecraft:creeper]
- /scoreboard teams join TeamB @e[type=minecraft:skeleton]
4. 使用“/execute”指令设置每个队伍的攻击目标,例如:
- /execute as @e[team=TeamA] run scoreboard players set @s attack 1
- /execute as @e[team=TeamB] run scoreboard players set @s attack 1
5. 使用“/execute”指令设置每个队伍的血量目标,例如:
- /execute as @e[team=TeamA] run scoreboard players set @s health 20
- /execute as @e[team=TeamB] run scoreboard players set @s health 20
6. 在一个重复的命令方块中运行以下命令:
- /execute as @e[scores={attack=1}] run execute as @e[scores={attack=1}] at @s run tp @s @e[team=!TeamB,distance=..3]
这些指令将创建两个队伍(TeamA和TeamB),然后在每个队伍中加入对应的生物。接下来,在每个队伍中将生物的攻击和血量设定为一定的数值,最后使用指令定期检测攻击目标并相应地进行传送。这样,就能实现生物互相攻击的效果了。