TransWikia.com

How to increase / decrease value in minecraft bossbar without entering a specific number 1.16.4

Arqade Asked by WolfPlay013 on February 6, 2021

Hello I am working on my first minecraft map! But I don’t know how to decrease / increase a number in the bossbar, without entering a specific number, instead, for example, incrementing by 1.

I am using version 1.16.4.

2 Answers

I think this answers your question:
Use /bossbar set <id> value <value> to change the value.
Example: /bossbar set bsb1 value 50

Use /bossbar set <id> max <max> to set the maximum value (defualt is 100, you do not have to change this)

Answered by Leten on February 6, 2021

Bossbars don't support math operations directly. Instead, you'll have to use a scoreboard to manage your bossbars.

I usually create an objective named bossbar for my bossbars, and use fake player names as descriptors.

scoreboard objectives add bossbar dummy [{"text":"Bossbar Values"}]

We need a repeating command block with the following command. This will make the bossbar use the scoreboard value.

execute store result bossbar minecraft:myBossbar value run scoreboard players get myBossbar bossbar

Then, all you need to do is increment the scoreboard and the value in the bossbar will change automatically. Use the following command to decrease bossbar by 5:

scoreboard players remove myBossbar bossbar 5

Answered by ExpertCoder14 on February 6, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP