player_failed.mcfunction 658 B

1234567891011121314151617
  1. # 玩家失败时由玩家自己触发
  2. # 计数
  3. tag @s remove mini_running
  4. execute store result score $t_finish mem if entity @a[tag=mini_running]
  5. execute if score $t_alive mem matches 1.. run tellraw @a [{"selector": "@s","color":"red"}," 已失败! 剩余 ",{"score": {"name": "$t_alive","objective": "mem"}}," 人!"]
  6. # 给存活的玩减分
  7. scoreboard players add @a[tag=mini_running] mini_score 1
  8. # 进入旁观
  9. gamemode spectator @s
  10. spectate @r[tag=mini_running]
  11. # 如果只有一个玩家没有失败,则游戏结束
  12. # 这里设置成等于就不会触发多次 game_end 了
  13. execute if score $t_alive mem matches 1 run function mini:main/game_end