Свой сервер

Death Swap: обмен местами

Раз в несколько минут все игроки меняются местами — кто стоял над лавой, тот и окажется там. Готовьте ловушку на своём месте и выживайте на чужом: последний живой побеждает. Датапак для Minecraft 1.21.9 — 26.3, старт — без прав оператора.

Время до обмена

От 1 до 20 минут. Пять — время на ловушку, одна — суета без передышки.

Как играть

Датапак · 1.21.9 — 26.3

Начать — любой игрок

/trigger deathswap

Остановить (права оператора)

/function deathswap:stop
Обмен
5 мин
Таймер
виден
Разлёт
до 1000 блоков
Скачать датапак
Что внутри архива — 20 файлов

data/minecraft/tags/function/load.json

Тег load: игра зовёт эти функции при загрузке мира и после /reload.

{
  "values": [
    "deathswap:load"
  ]
}

data/minecraft/tags/function/tick.json

Тег tick: эти функции идут каждый тик — 20 раз в секунду.

{
  "values": [
    "deathswap:tick"
  ]
}

data/deathswap/function/load.mcfunction

При загрузке мира: счета, триггер старта и подсказка в чат.

scoreboard objectives add deathswap_game dummy
scoreboard objectives add deathswap trigger "Начать Death Swap"
scoreboard objectives add deathswap_deaths deathCount
scoreboard objectives add deathswap_id dummy
tellraw @a ["",{"text":"Death Swap загружен. Начать — "},{"text":"/trigger deathswap","color":"gold","click_event":{"action":"run_command","command":"/trigger deathswap"}},{"text":"."}]

data/deathswap/function/tick.mcfunction

Каждый тик: старт по триггеру, выбывшие и не остался ли один.

scoreboard players enable @a deathswap
execute as @a[scores={deathswap=1..}] run function deathswap:start
execute if score #running deathswap_game matches 1 as @a[tag=ds_alive,scores={deathswap_deaths=1..}] run function deathswap:out
execute if score #running deathswap_game matches 1 store result score #alive deathswap_game if entity @a[tag=ds_alive]
execute if score #running deathswap_game matches 1 if score #alive deathswap_game matches ..1 run function deathswap:finish

data/deathswap/function/start.mcfunction

Старт: участники — все не наблюдатели, режим выживания, разлёт.

scoreboard players set @s deathswap 0
execute if score #running deathswap_game matches 1 run return run tellraw @s {"text":"Игра уже идёт."}
execute store result score #n deathswap_game if entity @a[gamemode=!spectator]
execute if score #n deathswap_game matches ..1 run return run tellraw @s {"text":"Нужно хотя бы двое игроков не в режиме наблюдателя."}
tag @a remove ds_alive
tag @a remove ds_player
tag @a[gamemode=!spectator] add ds_alive
tag @a[tag=ds_alive] add ds_player
scoreboard players reset @a deathswap_deaths
gamemode survival @a[tag=ds_alive]
effect give @a[tag=ds_alive] minecraft:instant_health 1 10 true
effect give @a[tag=ds_alive] minecraft:saturation 1 20 true
execute at @s run spreadplayers ~ ~ 300 1000 false @a[tag=ds_alive]
scoreboard players set #running deathswap_game 1
title @a[tag=ds_alive] times 10 50 10
title @a title {"text":"Death Swap","color":"gold"}
title @a subtitle {"text":"Обмен каждые 5 мин"}
function deathswap:round

data/deathswap/function/warn/start.mcfunction

Старт отсчёта цифрами: 5 с.

title @a[tag=ds_alive] times 0 25 5
scoreboard players set #warn deathswap_game 5
function deathswap:warn/second

data/deathswap/function/warn/second.mcfunction

Раз в секунду: цифра на весь экран и щелчок.

execute if score #warn deathswap_game matches ..0 run return run function deathswap:warn/end
title @a[tag=ds_alive] title {"score":{"name":"#warn","objective":"deathswap_game"},"color":"gold"}
execute as @a[tag=ds_alive] at @s run playsound minecraft:block.note_block.hat master @s ~ ~ ~ 1 1
scoreboard players remove #warn deathswap_game 1
schedule function deathswap:warn/second 1s

data/deathswap/function/warn/end.mcfunction

Отсчёт кончился.

title @a[tag=ds_alive] clear

data/deathswap/function/timer/start.mcfunction

Старт отсчёта: 300 с полосой босса.

bossbar remove deathswap:timer
bossbar add deathswap:timer {"text":"До обмена"}
bossbar set deathswap:timer color yellow
bossbar set deathswap:timer max 300
scoreboard players set #timer deathswap_game 300
function deathswap:timer/second

data/deathswap/function/timer/second.mcfunction

Раз в секунду: полоса и надпись «мм:сс», по нулю — конец.

execute if score #timer deathswap_game matches ..0 run return run function deathswap:timer/end
bossbar set deathswap:timer players @a
execute store result bossbar deathswap:timer value run scoreboard players get #timer deathswap_game
scoreboard players operation #m deathswap_game = #timer deathswap_game
scoreboard players operation #s deathswap_game = #timer deathswap_game
scoreboard players set #60 deathswap_game 60
scoreboard players operation #m deathswap_game /= #60 deathswap_game
scoreboard players operation #s deathswap_game %= #60 deathswap_game
execute if score #s deathswap_game matches 10.. run bossbar set deathswap:timer name ["",{"text":"До обмена "},{"score":{"name":"#m","objective":"deathswap_game"}},{"text":":"},{"score":{"name":"#s","objective":"deathswap_game"}}]
execute if score #s deathswap_game matches ..9 run bossbar set deathswap:timer name ["",{"text":"До обмена "},{"score":{"name":"#m","objective":"deathswap_game"}},{"text":":0"},{"score":{"name":"#s","objective":"deathswap_game"}}]
scoreboard players remove #timer deathswap_game 1
schedule function deathswap:timer/second 1s

data/deathswap/function/timer/end.mcfunction

Время вышло: полосу убрать, дальше — своё.

bossbar remove deathswap:timer
function deathswap:swap

data/deathswap/function/timer/stop.mcfunction

Остановить отсчёт.

schedule clear deathswap:timer/second
bossbar remove deathswap:timer

data/deathswap/function/round.mcfunction

Новый круг: обмен через 5 мин, цифры — за 5 с, время — полосой босса.

schedule function deathswap:warn/start 295s
function deathswap:timer/start

data/deathswap/function/swap.mcfunction

Обмен: маркеры на местах в случайном порядке, каждый — на место следующего.

execute unless score #running deathswap_game matches 1 run return 0
kill @e[type=minecraft:marker,tag=ds_spot]
scoreboard players set #i deathswap_game 0
execute as @a[tag=ds_alive,sort=random] at @s run function deathswap:mark
execute as @a[tag=ds_alive] run function deathswap:go
kill @e[type=minecraft:marker,tag=ds_spot]
title @a[tag=ds_alive] title {"text":"Обмен!","color":"gold"}
execute as @a[tag=ds_alive] at @s run playsound minecraft:entity.enderman.teleport master @s ~ ~ ~
function deathswap:round

data/deathswap/function/mark.mcfunction

Место игрока — маркер с его номером по порядку.

scoreboard players add #i deathswap_game 1
scoreboard players operation @s deathswap_id = #i deathswap_game
summon minecraft:marker ~ ~ ~ {Tags:["ds_spot","ds_new"]}
scoreboard players operation @e[type=minecraft:marker,tag=ds_new] deathswap_id = #i deathswap_game
tag @e[type=minecraft:marker,tag=ds_new] remove ds_new

data/deathswap/function/go.mcfunction

Игрок — на маркер следующего номера, последний — на первый.

scoreboard players operation #to deathswap_game = @s deathswap_id
scoreboard players add #to deathswap_game 1
execute if score #to deathswap_game > #i deathswap_game run scoreboard players set #to deathswap_game 1
execute as @e[type=minecraft:marker,tag=ds_spot] if score @s deathswap_id = #to deathswap_game run tag @s add ds_here
execute at @e[type=minecraft:marker,tag=ds_here,limit=1] run tp @s ~ ~ ~
tag @e[type=minecraft:marker,tag=ds_here] remove ds_here

data/deathswap/function/out.mcfunction

Игрок умер: выбыл, дальше смотрит наблюдателем.

tag @s remove ds_alive
scoreboard players reset @s deathswap_deaths
gamemode spectator @s
tellraw @a ["",{"selector":"@s","color":"red"},{"text":" выбывает."}]

data/deathswap/function/finish.mcfunction

Остался один: победитель на весь экран, выбывшие — к нему.

scoreboard players set #running deathswap_game 0
function deathswap:timer/stop
schedule clear deathswap:swap
schedule clear deathswap:warn/start
schedule clear deathswap:warn/second
kill @e[type=minecraft:marker,tag=ds_spot]
execute if entity @a[tag=ds_alive] run title @a title {"selector":"@a[tag=ds_alive]","color":"gold"}
execute if entity @a[tag=ds_alive] run title @a subtitle {"text":"побеждает в Death Swap!"}
execute unless entity @a[tag=ds_alive] run title @a title {"text":"Ничья"}
execute if entity @a[tag=ds_alive] as @a[tag=ds_player,gamemode=spectator] run function deathswap:back
tag @a remove ds_alive
tag @a remove ds_player
tellraw @a ["",{"text":"Ещё раз — "},{"text":"/trigger deathswap","color":"gold","click_event":{"action":"run_command","command":"/trigger deathswap"}},{"text":"."}]

data/deathswap/function/back.mcfunction

Выбывший — к победителю, снова в выживание.

tp @s @a[tag=ds_alive,limit=1]
gamemode survival @s

data/deathswap/function/stop.mcfunction

/function deathswap:stop — остановить игру (оператору).

scoreboard players set #running deathswap_game 0
function deathswap:timer/stop
schedule clear deathswap:swap
schedule clear deathswap:warn/start
schedule clear deathswap:warn/second
kill @e[type=minecraft:marker,tag=ds_spot]
tag @a remove ds_alive
tag @a remove ds_player
tellraw @a {"text":"Death Swap остановлен."}

Как поставить

  1. Скачайте датапак

    Распаковывать не нужно: игра читает его прямо из zip.

  2. Положите в мир

    В одиночной игре — saves/<мир>/datapacks, на сервере — world/datapacks. Лучше новый мир: игроки разлетятся по нетронутой земле.

  3. Начните

    /reload, все заходят, кто-нибудь пишет /trigger deathswap. Нужно хотя бы двое.

Что нужно знать

  • Трое и больше — по кругу. Каждый попадает на место следующего, последний — на место первого. Порядок каждый раз случайный: заранее не угадать, кто окажется в ловушке.
  • Измерение — тоже чужое. Стоял соперник в Незере — в Незер и попадёте.
  • Отсчёт. За 5 секунд до обмена на экране идут цифры, а время до обмена всегда видно полосой босса.
  • Кто умер — выбыл. Выбывший смотрит наблюдателем, последний живой побеждает. Остальные после игры переносятся к нему в режиме выживания.

Охота с компасом на одного — манхант, ещё игры для друзей — прятки и сплиф. Сервер с мини-играми — в мониторинге.

Частые вопросы

Как играть в Death Swap в Майнкрафте?

Поставьте датапак в мир, все игроки — в выживании. Любой пишет /trigger deathswap: раз в несколько минут игроки меняются местами. Кто умер, тот выбыл, последний живой побеждает.

Как Death Swap работает с тремя игроками и больше?

Игроки меняются по кругу в случайном порядке: каждый попадает на место следующего, последний — на место первого. Круг каждый раз новый, поэтому заранее не угадать, кто окажется в ловушке.

Видно ли, когда будет обмен?

По выбору: полоса босса с временем до обмена или тайный таймер. В обоих случаях за пять секунд до обмена на экране идут цифры.