更好的组队系统(指令)
版本适用:1.19.51 条件限制:玩家人数在3-11人 优点:满足组队需求且组队队伍颜色随机,两队人数相对平均,比较公平 局限性:只能分配两个队伍,不能主动选队伍颜色 原理:只改变分队顺序(半穷举),无判断两队人数部分 PS:指令太多了不方便打我就简写吧,想看完整的详看视频 新版指令格式: execute if score a/b/c(虚拟实体) num (计分板名称) matches 分数范围 run 简化版指令(太懒) team(队伍)num(人数) a (组队玩家人数) b(游戏玩家总数)c(组队队伍颜色) ---------------------------------------------------------------------- sc ob add team dummy(循环红控) sc ob add num dummy tag @e[hasitem=..,tag=!zd] add zd1 exe if entity @e[tag=zd1] run playsound.. exe as @e[tag=zd1] run tellraw ..selector:tag=zd1,"text":"加入组队! exe as @e[tag=zd] run replaceitem .. air 1 0 exe as @e[tag=zd1] run tag @s add zd2 exe as @e[tag=zd2] run tag @s remove zd1 sc pl set @e[tag=zd2] num 1 sc pl set a num 0 sc pl op a num += @e[tag=zd2] num exe if score a num matches 0..3 run tag @e[tag=zd2] add zd exe if score a num matches 4 run tellraw .. selector:tag=zd2,tag=!zd,"text":"被移除 了组队“ exe if score a num matches 4 run tag @e[tag=zd2,tag=!zd] remove zd2 exe as @e[tag=zd] run titleraw @a ..."text""组队玩家”selector:tag=zd tag @e[tag=!zd] add fzd sc pl set @e num 1 sc pl set b num 0 sc pl op b num += @e num sc pl ran c num 1 2 ---------------------------------------------------------------------- sc pl set @e team 0 setblock *** air(坐标是上边那一部分红石块位置) exe if score b num matches 3..4 run tag @e[tag=zd] remove zd exe if score b num matches 3..4 run tag @e[tag=!zd] add fzd exe if score b num matches 3..4 run tellraw .."text":"人数不足4人,取消所有人组队“ exe if score b num matches 3..4 run sc pl set @e[tag=fzd,c=2,scores={team=0}] team 1 exe if score b num matches 3..4 run sc pl set @e[tag=fzd,c=2,scores={team=0}] team 2 exe if sc b num ma 5..11 run exe if sc c num ma 1 run sc pl set @e[tag=zd,scores ={team=0}] team 1 exe if sc b num ma 5..11 run exe if sc c num ma 1 run sc pl set @e[c=3,tag=fzd, scores={team=0}] team 2 exe..run exe if sc a num ma 0..2 run sc pl set @e[tag=fzd,scores={team=0}] team 1 exe if sc b num ma 7..11 run exe if sc c num ma 1 run sc pl set @e[tag=fzd,c=1, scores={team=0}] team 2 exe if sc b num ma 9..11 run exe if sc c num ma 1 run sc pl set @e[tag=fzd,c=1, scores={team=0}] team 2 exe if sc b num ma 11..11 run exe if sc c num ma 1 run sc pl set @e[tag=fzd,c=1, scores={team=0}] team 2 exe..run sc pl set @e[c=4,tag=fzd,scores={team=0}] team 1 exe if sc b num ma 5..11 run exe if sc c num ma 2 run sc pl set @e[tag=zd,scores ={team=0}] team 2 exe if sc b num ma 5..11 run exe if sc c num ma 2 run sc pl set @e[c=3,tag=fzd, scores={team=0}] team 1 exe..run exe if sc a num ma 0..2 run sc pl set @e[tag=fzd,scores={team=0}] team 2 exe if sc b num ma 7..11 run exe if sc c num ma 2 run sc pl set @e[tag=fzd,c=1, scores={team=0}] team 1 exe if sc b num ma 9..11 run exe if sc c num ma 2 run sc pl set @e[tag=fzd,c=1, scores={team=0}] team 1 exe if sc b num ma 11..11 run exe if sc c num ma 2 run sc pl set @e[tag=fzd,c=1, scores={team=0}] team 1 exe..run sc pl set @e[c=4,tag=fzd,scores={team=0}] team 2 playsound random.levelup .. spreadplayers *** @e[scores={team=1}] spreadplayers *** @e[scores={team=2}] sc ob remove num tag @e remove zd zd1 zd2 fzd