|
CHAPTER 1
Monsters:
Monsters are just another form of objects that have to be resetted if
they are gone (probably killed). Therefore we have to clone a monster
right before the "if (arg) return;" line. An example of a nice monster:
if (!present("fred")) {
object monster; /* Object is an LPC data structure */
monster=clone_object("obj/monster");
monster->set_name("fred");
monster->set_race("human");
monster->set_short("Fred the melancholic");
monster->set_long("Fred looks sadly into your eyes.\n");
monster->move_player("x", this_object());
}
For more information about functions you can call in monsters to set up
them, read 'man monster'. Generally you should use this form to create
monster if it is unique without special features. Otherwise you should
create another class of monsters, using a separate file and inheriting
obj/monster.
Addendum:
And it nicer to use move_player() to move a monster into a room instead
of move_object(). Then the above "Fred arrives." when he is recreated at
reset after he is gone/killed.
Changed/modified/modernised in August 2016 and before.
See also: |
|