Denizen Script Commands


Commands are always written with a '-' before them, and are the core component of any script, the primary way to cause things to happen.
Learn about how commands work in The Beginner's Guide.


Showing 1 out of 184 commands...
NameHealth
Syntaxhealth ({npc}/<entity>|...) [<#>] (state:{true}/false/toggle) (heal)
Short DescriptionChanges the target's maximum health.
Full DescriptionUse this command to modify an entity's maximum health.

If the target is an NPC, you can use the 'state' argument to enable, disable, or toggle the Health trait
(which is used to track the NPC's health, and handle actions such as 'on death').
The Health trait will be enabled by default.

By default, this command will target the linked NPC but can be set to target any other living entity, such as a player or mob.

Optionally specify the 'heal' argument to automatically heal the entity to the new health value.
If not specified, the entity's health will remain wherever it was
(so for example a change from 20 max to 50 max will leave an entity with 20 health out of 50 max).

Additionally, you may input a list of entities, each one will calculate the effects explained above.
Related Tags<EntityTag.health> Returns the current health of the entity.
<EntityTag.health_max> Returns the maximum health of the entity.
<NPCTag.has_trait[health]> Returns whether the NPC has a specified trait.
Usage Example
# Use to set the NPC's maximum health to 50.
- health 50
Usage Example
# Use to disable tracking of health value on the NPC.
- health state:false
Usage Example
# Use to change a player's health limit and current health both to 50.
- health <player> 50 heal
Usage Example
# Use to change a list of entities' health limits all to 50.
- health <player.location.find.living_entities.within[10]> 50
Groupentity
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/entity/HealthCommand.java#L26