Denizen Script Events

Events are a way to listen to things that happened on your server and respond to them through a script. These usually pair with 'world' script containers.
Learn about how events work in The Beginner's Guide.

Showing 1 out of 342 events...
Nameentity damaged by entity
Event Lines <entity> damaged by <entity>
<entity> damaged (by <cause>)
<entity> damages <entity>
Triggerswhen an entity is damaged.
on entity damaged:
- announce "A <context.entity.entity_type> took damage!"
on player damages cow:
- announce "<> damaged a cow at <context.entity.location.simple>"
on player damages cow|sheep|chicken with:*_hoe:
- narrate "Whoa there farmer, you almost hurt your farm animals with that farmin' tool!"
- determine cancelled
# This example disambiguates this event from the "vehicle damaged" event for specific vehicle entity types.
on entity damaged type:minecart:
- announce "A minecart took non-vehicular damage!"
Has Playerwhen the damager or damaged entity is a player. Cannot be both. - this adds switches 'flagged:<flag name>' + 'permission:<node>', in addition to the '<player>' link.
Has NPCwhen the damager or damaged entity is an NPC. Cannot be both.
Switcheswith:<item> to only process the event when the item used to cause damage (in the damager's hand) is a specified item.
type:<entity> to only run if the entity damaged matches the entity input.
block:<block-matcher> to only run if the damage came from a block that matches the given material or location matcher.
Contexts<context.entity> returns the EntityTag that was damaged.
<context.damager> returns the EntityTag damaging the other entity, if any.
<context.damager_block> returns the LocationTag of a block that damaged the entity, if any.
<context.cause> returns an ElementTag of reason the entity was damaged - see Language:damage cause for causes.
<context.damage> returns an ElementTag(Decimal) of the amount of damage dealt.
<context.final_damage> returns an ElementTag(Decimal) of the amount of damage dealt, after armor is calculated.
<context.projectile> returns a EntityTag of the projectile, if one caused the event.
<context.damage_type_map> returns a MapTag the damage dealt by a specific damage type with keys: BASE, HARD_HAT, BLOCKING, ARMOR, RESISTANCE, MAGIC, ABSORPTION.
<context.was_critical> returns 'true' if the damage was a critical hit. (Warning: this value is calculated and not guaranteed to be correct if the event is altered).
DetermineElementTag(Decimal) to set the amount of damage the entity receives.
"CLEAR_MODIFIERS" to zero out all damage modifiers other than "BASE", effectively making damage == final_damage.
CancellableTrue - This adds <context.cancelled> and determine 'cancelled' or 'cancelled:false'
Has LocationTrue - This adds the switches 'in:<area>', 'location_flagged:<flag>', ...