damage

damage <creature> <int> <spell-name>

Deal damage to a creature.

The creature loses the given number of hit points, typed by a named spell or damage form. When the owner is a mobile it is recorded as the attacker; from a room or object script there is no attributed attacker.

Arguments

Returns

null. Like the other action commands, a successful damage in the handle phase suppresses the event's default action.

Quirk

When the owner is an unapproved mobile, the attribution makes the attacker an unapproved mob, and the damage is reduced to 0 — the call runs but the victim takes no harm. Approved mobs and room/object owners deal the full amount.

Examples

after command (say) {
  damage $actor 5 fireball
}

The actor takes 5 points of fire damage. The script compiles and runs to completion.

handle death {
  require [eq $actor $self]
  damage $self -100 heal
}

A negative amount heals: this restores the owner on death (see the death-intercept idiom in handlers.md).

See also