Difference between revisions of "Manual:DIL Manual/SFB DEAD"
Jump to navigation
Jump to search
(XML import) |
(checked against the compiler and the interpreter; example compiles) |
||
| Line 1: | Line 1: | ||
| − | + | = SFB_DEAD = | |
| − | + | '''Constant''' (integer, vme.h: 0x0010). | |
| − | + | wait(SFB_DEAD, condition) | |
| − | + | The death event. It is sent when a player or a monster dies, at the start of its death: it still carries and wears all its things, and no corpse has been made yet. | |
| − | |||
| − | + | == What the event holds == | |
| + | {| class="wikitable" | ||
| + | ! Variable !! Value | ||
| + | |- | ||
| + | | activator || the character who is dying | ||
| + | |- | ||
| + | | argument || empty | ||
| + | |- | ||
| + | | command(CMD_AUTO_DEATH) || TRUE | ||
| + | |- | ||
| + | | medium, target || null | ||
| + | |} | ||
| − | + | == Notes == | |
| − | + | * Unlike the other events, the dying character's own programs get it too, without <code>aware</code>: <code>wait(SFB_DEAD, activator == self)</code> on a monster catches its own death. | |
| − | + | * It also reaches the room, what the dying character carries and wears, and the others in the room, as a command does (see [[Manual:DIL Manual/SFB CMD|SFB_CMD]]). A cursed item can catch its owner's death with <code>activator == self.outside</code>. | |
| − | + | * It is sent by every real death: killed in combat, and killed by a god's <code>slay</code>. The killer isn't in the event. The dying character's <code>fighting</code> field usually points to an opponent, but not necessarily the one who struck last; the example looks for everyone who fought it. | |
| + | * The death itself goes on after the program has run; it can't be blocked. | ||
| − | + | == Example == | |
| − | + | <pre> | |
| − | + | dilbegin fnpri(FN_PRI_BLOCK-2) avenge(); | |
| − | + | var | |
| − | + | u : unitptr; | |
| − | + | code | |
| + | { | ||
| + | :loop: | ||
| + | wait(SFB_DEAD, activator == self); | ||
| − | + | foreach (UNIT_ST_PC, u) | |
| − | + | { | |
| − | + | if ((u.fighting == self) and (u.outside == self.outside)) | |
| + | log(u.name + " killed " + self.name + "."); | ||
| + | } | ||
| − | + | goto loop; | |
| + | } | ||
| + | dilend | ||
| + | </pre> | ||
| + | A monster that, as it dies, logs every player in the room who was fighting it, after MurderBanish in guilds.zon. | ||
| − | + | == See also == | |
| − | + | * [[Manual:DIL Manual/wait()|wait()]] | |
| − | + | * [[Manual:DIL Manual/interrupt()|interrupt()]] | |
| − | + | * [[Manual:DIL Manual/fighting|fighting]] | |
| − | + | * [[Manual:DIL Manual/SFB COM|SFB_COM]] | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
Latest revision as of 23:24, 14 November 2026
SFB_DEAD
Constant (integer, vme.h: 0x0010).
wait(SFB_DEAD, condition)
The death event. It is sent when a player or a monster dies, at the start of its death: it still carries and wears all its things, and no corpse has been made yet.
What the event holds
| Variable | Value |
|---|---|
| activator | the character who is dying |
| argument | empty |
| command(CMD_AUTO_DEATH) | TRUE |
| medium, target | null |
Notes
- Unlike the other events, the dying character's own programs get it too, without
aware:wait(SFB_DEAD, activator == self)on a monster catches its own death. - It also reaches the room, what the dying character carries and wears, and the others in the room, as a command does (see SFB_CMD). A cursed item can catch its owner's death with
activator == self.outside. - It is sent by every real death: killed in combat, and killed by a god's
slay. The killer isn't in the event. The dying character'sfightingfield usually points to an opponent, but not necessarily the one who struck last; the example looks for everyone who fought it. - The death itself goes on after the program has run; it can't be blocked.
Example
dilbegin fnpri(FN_PRI_BLOCK-2) avenge();
var
u : unitptr;
code
{
:loop:
wait(SFB_DEAD, activator == self);
foreach (UNIT_ST_PC, u)
{
if ((u.fighting == self) and (u.outside == self.outside))
log(u.name + " killed " + self.name + ".");
}
goto loop;
}
dilend
A monster that, as it dies, logs every player in the room who was fighting it, after MurderBanish in guilds.zon.