MUDL:Every death

From WikiName
Revision as of 16:47, 18 May 2017 by Teker (talk | contribs) (Created page with " __TOC__ = Overview = This MUDL function gets called each time a character is killed. It is called after the death cry and before every_corpse occurs. This function is val...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Overview

This MUDL function gets called each time a character is killed. It is called after the death cry and before every_corpse occurs. This function is valid for items in the room, items carried and worn by characters in the room, mobiles in the room, the room, and the area.


Command Syntax

addproc <mobile> mudl
setproc <mobile> ## every_death

addproc <item> mudl
setproc <item> ## every_death

addproc room mudl
setproc room ## every_death

addproc area mudl
setproc area ## every_death


Global Variables

The following global variables are available:

Name Type Description
 %a Character The character that performed the kill.
 %x Character The character that died.
 %c Character The mobile that has the MUDL script is attached to or null if it's a room or area script.
 %room Room The room in the game where the kill occurred.
 %area Area The area (zone) in the game where the kill occurred.
 %parent Character or Room or Area The in-game element that the MUDL script is attached to. It will be identical to %c or %room or %area.
 %procedure_index Integer The index of the current MUDL procedure on the %parent variable.


Return Values

The return value from this function is ignored.


Triggered Scripts

Events are triggered in the following order:

  1. Every_death scripts are triggered on items worn by characters in the room (and their clasps and runes).
  2. Every_death scripts are triggered on items on the floor in the room (and their clasps, but not runes).
  3. Every_death scripts are triggered on items carried by the killer (and their clasps and runes).
  4. Every_death scripts are triggered on the items carried by the character who was killed (and their clasps and runes).
  5. Every_death scripts are triggered on the mobiles in the room (including the killer and character that was killed).
  6. Every_death scripts are triggered on the room.
  7. Every_death scripts are triggered on the area.
  8. All every_corpse scripts are run after every_death.


Examples

addproc <mobile> mudl

setproc <mobile> ## every_death
msg_room(%room, 'DEATH!'),
msg_room(%room, 'DEATH! c = ' + name(%c)),
msg_room(%room, 'DEATH! a = ' + name(%a)),
msg_room(%room, 'DEATH! x = ' + name(%x)),
msg_room(%room, 'DEATH! room = ' + name(%room)),
msg_room(%room, 'DEATH! area = ' + name(%area)),
return(false)
@


setproc <mobile> ## PROC_ENABLED 1
compile


Notes

The killer %a may be equal to the actor %x if the character died from a trap, poison, or some other method where a specific killer doesn't exist or can not be found.