โค๏ธ Health#
#bs.health:help
Management of the life of an entity.
๐ง Functions#
You can find below all the function available in this module.
Add / Remove#
#bs.helth:add_health
Add health points to the player.
- Inputs
- (execution)
as <player>
The player whose health will be updated.
- (macro variable)
points
: double The health points to add to the player.
- (execution)
- Outputs
- (state) players health
The players health is updated.
- Example
Add 5 health point to the player:
# Once (execute on you) function #bs.health:add_health {points:5}
#bs.helth:add_health
Add health points to the player.
- Inputs
- (execution)
as <player>
The player whose health will be updated.
- (storage)
bs:in health.add_health.points
: double The health points to add to the player.
- (execution)
- Outputs
- (state) players health
The players health is updated.
- Example
Add 5 health point to the player:
# Once (execute on you) data modify storage bs:in health.add_health.points set value 5 function #bs.health:add_health
#bs.helth:add_health
Add health points to the player.
- Inputs
- (execution)
as <player>
The player whose health will be updated.
- (score)
$health.add_health.points bs.in
: int The health points to add to the player.
- (execution)
- Outputs
- (state) players health
The players health is updated.
- Example
Add 5 health point to the player:
# Once (execute on you) scoreboard players set $health.add_health.points bs.in 5 function #bs.health:add_health
#bs.helth:add_max_health
Add max health points to the player.
- Inputs
- (execution)
as <player>
The player whose max health will be updated.
- (macro variable)
points
: double The max health points to add to the player.
- (execution)
- Outputs
- (state) players health
The players max health is updated.
- Example
Add 5 max health point to the player:
# Once (execute on you) function #bs.health:add_max_health {points:5}
#bs.helth:add_max_health
Add max health points to the player.
- Inputs
- (execution)
as <player>
The player whose max health will be updated.
- (storage)
bs:in health.add_max_health.points
: double The max health points to add to the player.
- (execution)
- Outputs
- (state) players health
The players max health is updated.
- Example
Add 5 max health point to the player:
# Once (execute on you) data modify storage bs:in health.add_max_health.points set value 5 function #bs.health:add_max_health
#bs.helth:add_max_health
Add max health points to the player.
- Inputs
- (execution)
as <player>
The player whose max health will be updated.
- (score)
$health.add_max_health.points bs.in
: int The max health points to add to the player.
- (execution)
- Outputs
- (state) players health
The players max health is updated.
- Example
Add 5 max health point to the player:
# Once (execute on you) scoreboard players set $health.add_max_health.points bs.in 5 function #bs.health:add_max_health
How to remove
You can use negative numbers to remove experience from the player.
Credits: Aksiome
Set#
#bs.helth:set_health
Set the player health.
- Inputs
- (execution)
as <player>
The player whose health will be updated.
- (macro variable)
points
: double The health of the player.
- (execution)
- Outputs
- (state) players health
The players health is updated.
- Example
Set the player health to 10 using a macro:
# Once (execute on you) function #bs.health:set_health {points:10}
#bs.helth:set_health
Set the player health.
- Inputs
- (execution)
as <player>
The player whose health will be updated.
- (storage)
bs:in health.set_health.points
: double The health of the player.
- (execution)
- Outputs
- (state) players health
The players health is updated.
- Example
Set the player health to 10 using a macro:
# Once (execute on you) data modify storage bs:in health.set_health.points set value 10 function #bs.health:set_health
#bs.helth:set_health
Set the player health.
- Inputs
- (execution)
as <player>
The player whose health will be updated.
- (score)
$health.set_health.points bs.in
: int The health of the player.
- (execution)
- Outputs
- (state) players health
The players health is updated.
- Example
Set the player health to 10 using a macro:
# Once (execute on you) scoreboard players set $health.set_health.points bs.in 10 function #bs.health:set_health
#bs.helth:set_max_health
Set the player maximum health.
- Inputs
- (execution)
as <player>
The player whose maximum health will be updated.
- (macro variable)
points
: double The maximum health of the player.
- (execution)
- Outputs
- (state) players health
The players maximum health is updated.
- Example
Set the player maximum health to 10 using a macro:
# Once (execute on you) function #bs.health:set_max_health {points:10}
#bs.helth:set_max_health
Set the player maximum health.
- Inputs
- (execution)
as <player>
The player whose maximum health will be updated.
- (storage)
bs:in health.set_max_health.points
: double The maximum health of the player.
- (execution)
- Outputs
- (state) players health
The players maximum health is updated.
- Example
Set the player maximum health to 10 using a macro:
# Once (execute on you) data modify storage bs:in health.set_max_health.points set value 10 function #bs.health:set_max_health {points:10}
#bs.helth:set_max_health
Set the player maximum health.
- Inputs
- (execution)
as <player>
The player whose maximum health will be updated.
- (score)
$health.set_max_health.points bs.in
: int The maximum health of the player.
- (execution)
- Outputs
- (state) players health
The players maximum health is updated.
- Example
Set the player maximum health to 10 using a macro:
# Once (execute on you) scoreboard players set $health.set_max_health.points bs.in 10 function #bs.health:set_max_health {points:10}
Credits: Aksiome
Time to live#
#bs.helth:time_to_live
Allows to define the time of life of the entities.
- Inputs
- (execution)
as <entity>
The entity to add a life time to.
- (macro variable)
time
: int (optional) The time to live. In ticks by default if unit is not defined.
- (macro variable)
unit
: string (optional) The unit of the specified time. Possible values: โtickโ, โsecondโ, โminuteโ, โhourโ, โtโ, โsโ, โmโ, โhโ.
- (macro variable)
on_death
: string (optional) A command that will be run as the entity on its death.
- (execution)
- Example
Give the creepers a 10 second life time:
# Once execute as @e[type=minecraft:creeper] run function #bs.health:time_to_live {time:10,unit:"s"}
Give an explosion effect to creepers at the end of their life:
# Once execute as @e[type=minecraft:creeper] run function #bs.health:time_to_live {time:10,on_death:"execute at @s run particle minecraft:explosion_emitter ~ ~ ~"}
Update the on_death callback at any given time:
# Once execute as @e[type=minecraft:creeper] run function #bs.health:time_to_live {time:100,on_death:"execute at @s run particle minecraft:explosion_emitter ~ ~ ~"} # Update the on_death callback of a single creeper before it dies execute as @e[type=minecraft:creeper,limit=1] run function #bs.health:time_to_live {on_death:"say GOTCHA"}
Credits: Aksiome, Leirof
๐ฌ Did it help you?
Feel free to leave your questions and feedbacks below!