Manual:DIL Manual/SFB DEAD
Jump to navigation
Jump to search
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.