MUDL:Every corpse
From SlothMUD Wiki
Revision as of 15:48, 18 May 2017 by Teker (Talk | contribs) (Created page with " __TOC__ = Overview = This MUDL function gets called each time a dead mobile is turned into a corpse. It is called after every_death occurs. This function is valid for the...")
Contents
Overview
This MUDL function gets called each time a dead mobile is turned into a corpse. It is called after every_death occurs. This function is valid for the mobile that is killed, the room, and the rea/
Command Syntax
addproc room mudl setproc room ## every_corpse addproc area mudl setproc area ## every_corpse
Global Variables
The following global variables are available:
Name | Type | Description |
---|---|---|
%a | Character | The character that performed the kill that created the corpse. |
%x | Character | The mobile that died to create the corpse. |
%o | Object | The new corpse object. |
%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:
- All every_death scripts are run prior to every_corpse.
- Every_corpse scripts are triggered on the mobile that died.
- Every_corpse scripts are triggered on the room.
- Every_corpse scripts are triggered on the area.
Examples
addproc <mobile> mudl setproc <mobile> ## every_corpse msg_room(room(%c), 'MOBILE CORPSE!'), msg_room(room(%c), 'CORPSE 1! c = ' + name(%c)), msg_room(room(%c), 'CORPSE 2! a = ' + name(%a)), msg_room(room(%c), 'CORPSE 2! x = ' + name(%x)), msg_room(room(%o), 'CORPSE 2! o = ' + name(%o)), msg_room(room(%o), 'CORPSE 2! room = ' + name(%room)), msg_room(room(%o), 'CORPSE 2! area = ' + name(%area)), destroy(%o), return(false) @ setproc <mobile> ## PROC_ENABLED 1 compile
addproc <mobile> mudl setproc <mobile> ## every_corpse msg_room( room(%c), get_attr('death_msg') ), make_obj( integer(get_attr('corpse_replacement_vnum') ), room(%c) ), foreach(contents(%o), %9, teleport(%9, room(%c)) ), destroy(%o) setproc <mobile> ## corpse_replacement_vnum 5077 setproc <mobile> ## death_msg The slime becomes a lifeless puddle of goo.@
Notes
You can destroy the corpse by calling destroy(%o). This also destroys all objects in the corpse. In order to preserve the objects, see the 2nd example above which uses teleport() to put the items in the room before destroying the corpse.