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...
NameHurt
Syntaxhurt (<#.#>) ({player}/<entity>|...) (cause:<cause>) (source:<entity>/<location>)
Short DescriptionHurts the player or a list of entities.
Full DescriptionDoes damage to a list of entities, or to any single entity.

If no entities are specified: if there is a linked player, the command targets that. If there is no linked
player but there is a linked NPC, the command targets the NPC. If neither is available, the command will error.

Does a specified amount of damage usually, but, if no damage is specified, does precisely 1HP worth of damage (half a heart).

Optionally, specify (source:<entity>) to make the system treat that entity as the attacker.
If using a block-type cause such as "contact", you *must* specify (source:<location>) to set that block location as the attacker. The block can be any block, even just "<player.location>" (as long as the player in inside a world).

You may also specify a damage cause to fire a proper damage event with the given cause, only doing the damage if the event wasn't cancelled.
Calculates the 'final damage' rather than using the raw damage input number. See Language:damage cause for damage causes.

Using a valid 'cause' value is best when trying to replicate natural damage, excluding it is best when trying to force the raw damage through.
Note that using invalid or impossible causes may lead to bugs
Related Tags<EntityTag.health> Returns the current health of the entity.
<EntityTag.last_damage.amount> Returns the amount of the last damage taken by the entity.
<EntityTag.last_damage.cause> Returns the cause of the last damage taken by the entity.
<EntityTag.last_damage.duration> Returns the duration of the last damage taken by the entity.
<EntityTag.last_damage.max_duration> Returns the maximum duration of the last damage taken by the entity.
Usage Example
# Use to hurt the player for 1 HP.
- hurt
Usage Example
# Use to hurt the NPC for 5 HP.
- hurt 5 <npc>
Usage Example
# Use to cause the player to hurt the NPC for all its health (if unarmored).
- hurt <npc.health> <npc> cause:CUSTOM source:<player>
Synonyms (Search Aid)damage, injure
Groupentity
Sourcehttps://github.com/DenizenScript/Denizen/blob/dev/plugin/src/main/java/com/denizenscript/denizen/scripts/commands/entity/HurtCommand.java#L31