#Make a bossbar which is assigned to multiple mobs.
1 messages · Page 1 of 1 (latest)
💬 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
Do you want to set the number of mobs in the boss bar?
yes
but i am not really sure what that means
take the health of all the mobs as scores, add them together, store it on the bossbar with execute store result bossbar
execute store result bossbar <id> value if entity <selector>
OK, what i cannot do is, "add"
how to add healths
like
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
ok += operator
why their health?
i will try to make one now
I mean you can also do the amount of entities if you want but then it will only go up/down when one is killed
This goes up or down when one is damaged
Well, if you want to count your health, do it. mobs are counted in vanilla
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
yeah then you’re want to count their health
is the number of your mobs the same and the amount of maximum health will always be the same for different waves of mobs?
wait, what if the entities are dynamic in count? Do i make more scoreboards?
You could loop through them
its not fixed how many entities are assigned to bossbar
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
no, max health is unfixed, nothing is fixed, i just want mobs with {Tags:["bossbar"]} to be assigned. Doesnt matter how many or how much health
then will you indicate the maximum amount of health in the bossbar at the beginning of each wave?
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)
no, the bossbar will just be filled up completely when the wave of mobs spawn, and when you start killing/damaging one by one, the bossbar will go down
store* i think
yeah mb
hold on, how to know max health of a mob if its health is not full
could you maybe get their base max_health attribute?
oh yes attribute command
right
start_wave function
[35msummon [0mzombie [32m96 [32m13 [32m19 [33m{[0mTags[34m: [35m[[33m"bossbar"[35m][33m}
[35msummon [0mspider [32m54 [32m15 [32m86 [33m{[0mTags[34m: [35m[[33m"bossbar"[35m][33m}
...
[35mscoreboard [34mplayers [34mset [0m*amount_health [0mmain_score [32m0
[35mexecute [34mas [36m@e[33m[[0mtag[34m=[32mbossbar[33m] [34mrun [35mfunction [33mnamespace:add_amount_health
[35mexecute [34mstore [34mresult [35mbossbar [0m<bossbar_id> [34mmax [0mrun [35mscoreboard [34mplayers [34mget [0m*amount_health [0mmain_score
tick function
[35mscoreboard [34mplayers [34mset [0m*amount_health [0mmain_score [32m0
[35mexecute [34mas [36m@e[33m[[0mtag[34m=[32mbossbar[33m] [34mrun [35mfunction [33mnamespace:add_amount_health
[35mexecute [34mstore [34mresult [35mbossbar [0m<bossbar_id> [34mvalue [0mrun [35mscoreboard [34mplayers [34mget [0m*amount_health [0mmain_score
add_amount_health function
[35mexecute [34mstore [34mresult [34mscore [0m*temp [0mmain_score [34mrun [35mdata [34mget [34mentity [36m@s [0mHealth
[35mscoreboard [34mplayers [34moperation [0m*amount_health [0mmain_score [34m+= [0m*temp [0mmain_score
/attribute @s generic.max_health base get
useful, but try not to spoonfeed
I helped with the code
damn, genius
thats really useful tbh
note that you can use the names of fake players and store them on the same objective
*temp main_score
its not spoonfeeding, its the right way of doing it
you can replace main_score with your scoreboard for fake players
im not gonna argue but it is, #💬┃general if you want to discuss it
yeah, use illegal characters like * . ( etc in fake player names
later
leme try doing that first
if you use # at the beginning of the fake player's name, then it will not be displayed in the sidebar, so it is usually used #
thats really useful information, thank you so much ❤️
i do use a .
namespace.scorename (while also trying to adjust it till 16 or less characters)
it seems to me that in this case it is necessary to show what the code looks like, then the person will try to make loops with fake players himself
as I said this isn’t the place to discuss it
it is not useful for optimization 😄
tellraw @a [{"score":{"name":"#temp","objective":"main_score"}}] is very useful
for debugging lol
Why would I care about optimising it if I’m debugging?
ah, if you immediately change the name after debagging to #, then good. it's just that when I write the code, it's very large and I initially use # so that I don't get confused with the replacement later
I keep it as . so people who download/fork can also debug
I suggest we stop there
finally
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
Ok, done with the project
#💬┃general message