#Make a bossbar which is assigned to multiple mobs.

1 messages · Page 1 of 1 (latest)

twilit plover
#

You see the Raid bossbar during minecraft Raid? Its assigned to every raider mob. I can only create a bossbar for single mob in minecraft but I want to create single bossbar for multiple mobs.

marsh thornBOT
#
Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

🙇 After a while, hit the Summon Helpers button to ping the helper team. They'll be happy to help you

✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve

jade belfry
twilit plover
#

but i am not really sure what that means

wooden geode
#

take the health of all the mobs as scores, add them together, store it on the bossbar with execute store result bossbar

jade belfry
#
execute store result bossbar <id> value if entity <selector>
twilit plover
#

how to add healths

#

like

wooden geode
#

you can use scoreboard players operation ENTITY1 SCOREBOARD += ENTITY2 SCOREBOARD to add two scoreboard objectives together and output the result in ENTITY1’s scoreboard value

twilit plover
#

ok += operator

jade belfry
#

why their health?

twilit plover
#

i will try to make one now

wooden geode
#

This goes up or down when one is damaged

jade belfry
#

Well, if you want to count your health, do it. mobs are counted in vanilla

twilit plover
#

i want it to empty a little, when one is damaged or killed, and want it to fill back up if you heal the mobs assigned to bossbar

wooden geode
#

yeah then you’re want to count their health

twilit plover
#

i will try what silabear said

#

+= operator

jade belfry
#

is the number of your mobs the same and the amount of maximum health will always be the same for different waves of mobs?

twilit plover
wooden geode
#

You could loop through them

twilit plover
#

its not fixed how many entities are assigned to bossbar

wooden geode
#

so for each entity, set it’s current health to some value on a scoreboard, and add it to the original value

#

do that for each entity and you’ll have the health of all the entities combined :P

twilit plover
jade belfry
wooden geode
#

you’ll also need to set the max value of the bossbar to the max health of the mobs combined, you can do that by adding all their health when they are all at full health (start of battle maybe) and then store that to the max value of the bossbar (again with execute store result bossbar)

twilit plover
wooden geode
#

yeah mb

twilit plover
#

hold on, how to know max health of a mob if its health is not full

wooden geode
#

could you maybe get their base max_health attribute?

twilit plover
#

right

jade belfry
#

start_wave function

summon zombie 96 13 19 {Tags: ["bossbar"]}
summon spider 54 15 86 {Tags: ["bossbar"]}

...

scoreboard players set *amount_health main_score 0
execute as @e[tag=bossbar] run function namespace:add_amount_health
execute store result bossbar <bossbar_id> max run scoreboard players get *amount_health main_score

tick function

scoreboard players set *amount_health main_score 0
execute as @e[tag=bossbar] run function namespace:add_amount_health
execute store result bossbar <bossbar_id> value run scoreboard players get *amount_health main_score

add_amount_health function

execute store result score *temp main_score run data get entity @s Health
scoreboard players operation *amount_health main_score += *temp main_score

twilit plover
#

/attribute @s generic.max_health base get

wooden geode
jade belfry
#

I helped with the code

twilit plover
wooden geode
#

i agree

#

but spoonfeeding isn’t good

jade belfry
twilit plover
jade belfry
#

you can replace main_score with your scoreboard for fake players

wooden geode
twilit plover
twilit plover
#

leme try doing that first

jade belfry
wooden geode
#

I suggest using a .

#

Viewing it in the sidebar is very useful

twilit plover
twilit plover
#

namespace.scorename (while also trying to adjust it till 16 or less characters)

jade belfry
wooden geode
#

as I said this isn’t the place to discuss it

jade belfry
wooden geode
#

for debugging lol

jade belfry
#

yes

#

for debugging

wooden geode
#

Why would I care about optimising it if I’m debugging?

jade belfry
wooden geode
#

I keep it as . so people who download/fork can also debug

jade belfry
#

I suggest we stop there

wooden geode
#

finally

twilit plover
#

I would close this thread with a simple project bcoz the information you both provided really means alot to me and I would like to prove it.

#

but if it's disallowed, I can close it rn

twilit plover
#

Ok, done with the project
#💬┃general message