A
/ \ _ Play Now Nemesis on
| | | | _______ _ _ _______ _______ _ _______
| |\ | | | ____| | \ / | | ____| / ____| | | / ____|
/-------/-------------------------------------------------------------------,
O= Home <=XX| About News Pics Adventurers Wizards Download Connect >
\-------\-------------------------------------------------------------------'
| | \ | | |____ | | | | | |____ ___ \ \ | | ___ \ \
| | \_| |_______| |_| |_| |_______| |_______/ |_| |_______/
\ /
V
Documentation Area
Document Path: /doc/monster/set_dead_ob
Lfun: set_dead_ob - define a dead object for a monster
Synopsis:
void set_dead_ob(object dead_ob)
Description:
The set_dead_ob call is used to give a monster a chance for a
second life if you simply cloned an obj/monster. If you inherit
obj/monster, use second_life - see 'man monster/second_life'.
Don't use set_dead_ob if you use 'inherit "obj/monster"'!
If dead_ob is set and a monster dies, a function called
monster_died() is called in the dead_ob with the monster object
as first argument and the fresh created corpse of the monster
as second argument. Except for this, monster_died() works the
same way as second_life().
See 'man object/monster_died' for required return codes of
monster_died()!
Return value:
none
Examples:
// e.g. in the room that creates the monster:
monster->set_dead_ob(this_object());
Note:
Set the dead_ob to a loaded object (a blueprint) and not to a
cloned object, as clones are lost definitely when destructed.
A room - the room creating the monster - is a good choice.
Since July 11th 2016 the set dead_ob is stored as a string if it
is a loaded object. So a set dead_ob even can be reloaded and it
still will work.
In the old days somebody stated here that set_dead_ob is obsolete
"nowadays" as there is inheritance. But nowadays I ('whois kiri'
or https://nemesis.de/lpc/bin/finger/kiri ) disagree! I think it
does not make sense to create a complete new object (via inherit
any/object in an extra file) for a simple and primitive feature,
e.g. no corspe or additional objects in the corpse.
// A code fragment from obj/monster showing what's going on:
second_life(corpse) {
if (dead_ob)
return dead_ob->monster_died(this_object(), corpse);
}
See also:
This page was generated in LPC
Imprint / Impressum