#Cooldowns not working

1 messages · Page 1 of 1 (latest)

merry nest
#

Please help, this cooldown doesn't work in specifically multiplayer. It is pretty important for it to work in multiplayer consider that I'm making this datapack for my friends servern. While testing I found that sometimes the cooldown bossbar (not the scoreboard) just goes down extra quickly, and sometimes the bossbar just disapears completely despite the scoreboard still ticking down (or I think so at least). Now this is just the code for one abilitys cooldown, but the other ones are just copy+pasted and changed.

Running every seconds using schedule: execute at @a as @a run function marbles:zephyr_marble/wind_dash_cooldown

Wind Dash Cooldown function:

execute store result bossbar minecraft:wind_dash_cool value run scoreboard players get @s wind_dash_cool
scoreboard players remove @s wind_dash_cool 1
bossbar set minecraft:wind_dash_cool name {"text":"Cooldown - Wind Dash: ","extra":[{"score":{"name":"@s","objective":"wind_dash_cool"}}],"color":"white"}
execute if score @s wind_dash_cool matches ..0 run bossbar set minecraft:wind_dash_cool visible false
execute unless score @s wind_dash_cool matches ..0 run bossbar set minecraft:wind_dash_cool visible true

The cooldown part of the ability:

scoreboard players set @s wind_dash_cool 16
bossbar add minecraft:wind_dash_cool "Cooldown - Wind Dash"
bossbar set minecraft:wind_dash_cool color white
bossbar set minecraft:wind_dash_cool players @s
execute store result bossbar minecraft:wind_dash_cool max run scoreboard players get @s wind_dash_cool
execute store result bossbar minecraft:wind_dash_cool value run scoreboard players get @s wind_dash_cool
bossbar set minecraft:wind_dash_cool name {"text":"Cooldown - Wind Dash: ","extra":[{"score":{"name":"@s","objective":"wind_dash_cool"}}]}
bossbar set minecraft:wind_dash_cool visible true

Version: 1.21.11

vague solstice
#

you are using the same bossbar to display cooldown for all players.. thats the problem..
you have to use the per player bossbar,
if you use the same bossbar for all players then all players will see the same score on bossbar at the end of the tick
even if you set the bossbar value to the players score, you change it before the end of the tick when you calculate it for another player so its not displaying the correct value

timid oakBOT
merry nest
timid oakBOT
vague solstice
merry nest
#

oh alr that explains it

vague solstice
#

you need to isolate the commands so they are run only by the player who has ability/score

merry nest
#

and how do I make sure that it is only run by one player?

vague solstice
#

and that one will only work if you are 100% sure that there is only one player with ability

vague solstice
merry nest
vague solstice
vague solstice
#

so bossbar would be called for example ability.player_name and you use the macro to access it with each players name

merry nest
#

Alr thx for the help!

vague solstice
#

but dont run the macro every tick unless you have to.. so if oyu dont have to activate the bossbar dont run it

#

and you should probbably delete the bossbar when you are done using it becouse othervise you will get bunch of bossbars filling up your memory

merry nest
#

yea that sounds like a good idea

#

time to go reasearch macros... yipee... (I heard they are difficuly oh god)