A
/ \ _ Play Now Nemesis on
| | | | _______ _ _ _______ _______ _ _______
| |\ | | | ____| | \ / | | ____| / ____| | | / ____|
/-------/-------------------------------------------------------------------,
O= Home <=XX| About News Pics Adventurers Wizards Download Connect >
\-------\-------------------------------------------------------------------'
| | \ | | |____ | | | | | |____ ___ \ \ | | ___ \ \
| | \_| |_______| |_| |_| |_______| |_______/ |_| |_______/
\ /
V
Documentation Area
Document Path: /doc/monster/set_init_ob
Lfun: set_init_ob - define a init object for a monster
Synopsis:
void set_init_ob(object init_ob)
Description:
The set_init_ob call is used to add code to the init of the
monster (e.g. greeting) if you simply cloned an obj/monster.
If you inherit obj/monster, overwrite the original init() of
obj/monster. And DON'T forget to call it via '::init();' if
all the stuff there should be done - as most of the time!
Don't use set_init_ob if you use 'inherit "obj/monster"'!
If init_ob is set and a living enters the room, a function
called monster_init() is called in the init_ob with the monster
object as argument.
See 'man object/monster_init' for required return codes of
monster_init()!
Return value:
none
Examples:
// e.g. in the room that creates the monster:
monster->set_init_ob(this_object());
Note:
Set the init_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 December 28th 2016 the set init_ob is stored as a string if
it is a loaded object. So a set init_ob even can be reloaded and
it still will work.
In the old days somebody stated here that set_init_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. if a monster should greet players entering the room.
See also:
This page was generated in LPC
Imprint / Impressum