How would you make a command that
- displays a boss bar to a player within an area
- shows the HP of a dolphin near that player, which is tagged with (Guide).
[meaning the bar will decrease as the dolphin takes damage, and increase as it is healed]
For the bossbar, you should find what you want here :
If you have any question, I could make an entire system for you
First, create the bossbar:
/bossbar add hp "Guide health"
then set the max value (which is the max health of the dolphin):
/bossbar set minecraft:hp max 10
now that the bossbar is configured, create a command lock chain with 1 repeating and 1 chain command blocks (all always active and unconditional)
and paste these commands in them in order:
execute as @e[tag=Guide] at @s run bossbar set minecraft:hp players @a[distance=..10]
execute as @e[tag=Guide] at @s if entity @a[distance=..10] run execute store result bossbar minecraft:hp value run data get entity @s Health