432: Looping music and title when entering an area. [Minecraft Map Making]
Membership:
Ep432: Playing sounds on a loop while player is in an area.
00:00 Intro
00:20 Setup
01:00 Controller enter
07:30 Controller loop
Requested by: lazar5113 and alpererdgn
Version: 1.21
Commands, builds, hacks and ideas for people making their own Minecraft maps.
Check out my collabs on Coppit's channel:
Join the CoppitCraft server that I play on and the Discord where I hang out.
Server IP: 51.81.176.10:28386
Discord: https://discord.gg/amU84KykEu
The following commands are prefixed with three letters which represent the settings of the command block. E.g IUN: = Impulse Unconditional Needs_Redstone. These prefixes need to be removed if copying the commands.
Since angled brackets are not allowed in YouTube descriptions you will have to replace "greater than" and "less than" with the appropriate angled bracket.
Commands used:
Setup:
IUN: scoreboard objectives add timer dummy
Controller - Enter:
RUA: execute positioned x1 y1 z1 as @a[tag=!enter_area_a, distance=..3] run tag @s add target
CCA: execute as @a[tag=target] run title @s title {"text":"Location: Area A","color":"green"}
CCA: execute as @a[tag=target] run stopsound @s master minecraft:item.goat_horn.sound.0
CCA: execute as @a[tag=target] run scoreboard players reset #sound timer
CUA: execute as @a[tag=target] run setblock x2 y2 z2 redstone_block
CUA: tag @a[tag=target] add enter_area_a
CUA: execute positioned x1 y1 z1 as @a[tag=enter_area_a, distance=3.1..] run tag @s remove enter_area_a
CCA: setblock x2 y2 z2 white_wool
CUA: tag @a[tag=target] remove target
Controller - Loop:
RUA: scoreboard players add #sound timer 1
CUA: execute if score #sound timer matches 50.. run scoreboard players reset #sound timer
CUA: execute if score #sound timer matches 1 run playsound minecraft:item.goat_horn.sound.0 master @a x1 y1 z1 1 0
Setup title:
IUN: title @a times 60 20 10
Stop music:
IUN: stopsound @a master minecraft:item.goat_horn.sound.0