A
/ \ _ Play Now Nemesis on
| | | | _______ _ _ _______ _______ _ _______
| |\ | | | ____| | \ / | | ____| / ____| | | / ____|
/-------/-------------------------------------------------------------------,
O= Home <=XX| About News Pics Adventurers Wizards Download Connect >
\-------\-------------------------------------------------------------------'
| | \ | | |____ | | | | | |____ ___ \ \ | | ___ \ \
| | \_| |_______| |_| |_| |_______| |_______/ |_| |_______/
\ /
V
Documentation Area
Document Path: /doc/concepts/armours
Armours are items that can be carried around by players or monsters. Each
player can wield as many armours as he wants to, as long as they don't overlap.
Armours have the following default properties:
Armour class: An armour can cover one or more of the four body zones High,
Middle, Side and Low. The armour class is an array of four
numbers containing the armour class for each zone.
Armour type: The armour type indicates the area that is covered by the
armour. Two armours with overlapping types cannot be worn
at the same time.
The proper way to create armours is to use the convenience function set_class
to set the default values for a wide range of armours. The different available
classes are listed in the file /include/armour_tbl.h. It is possible to change
the default values of course.
If your armour doesn't need to change the default values, you should create
the armour using clone_object from inside your room or monster file:
object armour;
armour=clone_object("obj/armour");
armour->set_class("helmet");
move_object(armour, this_object());
If your armour differs from the defaults in one or more cases, you have to put
the armour into a separate file:
inherit "obj/armour";
reset(arg) {
::reset(arg);
if (arg) return;
set_class("helmet");
set_short("a shiny helmet");
set_value(200);
}
Make sure that set_class is the first function you call, else it will delete
your previous settings.
If you need the defines for properties, such as P_NO_SELL (listed in
/include/properties.h and /include/armour.h), you have to replace the
inherit "obj/armour"; line with #include <armour.h>.
Addendum 2016: There has never been and is NO property P_NO_SELL!
But there was and is a property P_DESTRUCT_WHEN_SOLD!
To get a complete list of functions you can call, look at the files
/obj/item.c and /obj/armour.c. To get more information about properties
read 'man properties'.
A useful function you can override is wear(), which is called when the player
wants to wear the armour. The proper way to do it is like this:
wear(str) {
if (this_player()->query_guild()!="fighters") {
write("You cannot wear this fine armour.\n");
return 1;
}
return ::wear(str);
}
Examples for various armours are listed in /lib/armour.
This page was generated in LPC
Imprint / Impressum