From 6dc7a5d76d5fcf9c33eadb7f51f604f72acb4035 Mon Sep 17 00:00:00 2001 From: Vincent Foriel Date: Sun, 10 Dec 2023 18:17:56 +0100 Subject: [PATCH] MagmaRun: Added post-start timer to tell player start to run --- .../magma_run/functions/game_tick.mcfunction | 9 ++++++--- .../functions/start/post_start.mcfunction | 17 +++++++++++++++++ .../functions/start/pre_start.mcfunction | 6 +----- .../magma_run/functions/start/start.mcfunction | 9 ++++++++- 4 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 minigames/data/magma_run/functions/start/post_start.mcfunction diff --git a/minigames/data/magma_run/functions/game_tick.mcfunction b/minigames/data/magma_run/functions/game_tick.mcfunction index a5f91bc..0c98808 100644 --- a/minigames/data/magma_run/functions/game_tick.mcfunction +++ b/minigames/data/magma_run/functions/game_tick.mcfunction @@ -1,6 +1,9 @@ -function #magma_run:destroy_sand -function #magma_run:fall + +execute at @a[team=magma_run] as @e[tag=lobby.horse,distance=..3] run function lobby:horse/kill + +execute if score $magma_run.post_start_timer data matches ..0 run function #magma_run:destroy_sand +execute if score $magma_run.post_start_timer data matches ..0 run function #magma_run:fall function #magma_run:stop -execute at @a[team=magma_run] as @e[tag=lobby.horse,distance=..3] run function lobby:horse/kill \ No newline at end of file +execute if score $magma_run.post_start_timer data matches 0.. run function magma_run:start/post_start \ No newline at end of file diff --git a/minigames/data/magma_run/functions/start/post_start.mcfunction b/minigames/data/magma_run/functions/start/post_start.mcfunction new file mode 100644 index 0000000..0658694 --- /dev/null +++ b/minigames/data/magma_run/functions/start/post_start.mcfunction @@ -0,0 +1,17 @@ + +scoreboard players remove $magma_run.post_start_timer data 1 + +scoreboard players operation $magma_run.post_start_timer.seconds data = $magma_run.post_start_timer data +scoreboard players operation $magma_run.post_start_timer.seconds data /= 20 const +scoreboard players add $magma_run.post_start_timer.seconds data 1 + + +execute if score $magma_run.post_start_timer data matches 0..60 run title @a[team=magma_run] title {"score":{"name":"$magma_run.post_start_timer.seconds","objective":"data"},"color":"gold","bold":true,"italic":true} + +execute if score $magma_run.post_start_timer data matches 0 run title @a[team=magma_run] title {"text":""} +execute if score $magma_run.post_start_timer data matches 0 run title @a[team=magma_run] subtitle {"text":""} + +execute if score $magma_run.post_start_timer data matches 60 as @a[team=magma_run] at @s run playsound minecraft:entity.experience_orb.pickup master @s ~ ~ ~ 1 1 0 +execute if score $magma_run.post_start_timer data matches 40 as @a[team=magma_run] at @s run playsound minecraft:entity.experience_orb.pickup master @s ~ ~ ~ 1 1 0 +execute if score $magma_run.post_start_timer data matches 20 as @a[team=magma_run] at @s run playsound minecraft:entity.experience_orb.pickup master @s ~ ~ ~ 1 1 0 +execute if score $magma_run.post_start_timer data matches 0 as @a[team=magma_run] at @s run playsound minecraft:entity.experience_orb.pickup master @s ~ ~ ~ 1 2 0 \ No newline at end of file diff --git a/minigames/data/magma_run/functions/start/pre_start.mcfunction b/minigames/data/magma_run/functions/start/pre_start.mcfunction index 7f1931d..67de291 100644 --- a/minigames/data/magma_run/functions/start/pre_start.mcfunction +++ b/minigames/data/magma_run/functions/start/pre_start.mcfunction @@ -10,8 +10,4 @@ function #lib:start_animation {\ size: 20,\ start_callback: "magma_run:start/start",\ cancel_callback: "magma_run:map/place_starting_signs"\ -} - -execute at @e[tag=lib.start_animation.magma_run] run title @a[distance=..21] times 0 90 5 -execute at @e[tag=lib.start_animation.magma_run] run title @a[distance=..21] title {"text":" "} -execute at @e[tag=lib.start_animation.magma_run] run title @a[distance=..21] subtitle {"text":"START TO RUN!","color":"gold","bold":true,"italic":true} \ No newline at end of file +} \ No newline at end of file diff --git a/minigames/data/magma_run/functions/start/start.mcfunction b/minigames/data/magma_run/functions/start/start.mcfunction index 94a2c3b..708da88 100644 --- a/minigames/data/magma_run/functions/start/start.mcfunction +++ b/minigames/data/magma_run/functions/start/start.mcfunction @@ -2,6 +2,11 @@ execute at @e[tag=lib.start_animation.magma_run] run team join magma_run @a[distance=..21] execute at @e[tag=lib.start_animation.magma_run] run kill @e[tag=global.lobby_horse,distance=..21] clear @a[team=magma_run] +tp @a[team=magma_run] -216 100 17 + +# execute at @e[tag=lib.start_animation.magma_run] run title @a[distance=..21] times 0 90 5 +# execute at @e[tag=lib.start_animation.magma_run] run title @a[distance=..21] title {"text":" "} +execute at @e[tag=lib.start_animation.magma_run] run title @a[distance=..21] subtitle {"text":"START TO RUN!","color":"gold","bold":true,"italic":true} execute as @a[team=magma_run] at @s run function #global:animated_title {type:"start"} execute as @a[team=magma_run] at @s run stopsound @s record @@ -11,4 +16,6 @@ execute as @a[team=magma_run] at @s run tellraw @s {"text":"Music by Oleksii Hol effect give @a[team=magma_run] speed infinite 2 true scoreboard players set $magma_run.game_started data 1 -function magma_run:map/lock \ No newline at end of file +function magma_run:map/lock + +scoreboard players set $magma_run.post_start_timer data 100 \ No newline at end of file