                           The NPC Inheritable
                          written by Zaxan@Haven

This document details the different functions in the Nightmare IV LPC
Library's NPC inheritable. This document is divided into
many sections. Each section explains a different type of function
in the lib inheritable.

The following is the header of the item inheritable with what it
includes, inherits, and its definitions:

****************************************************************************
#include <lib.h>
#include <daemons.h>
#include <position.h>
#include <armour_types.h>
#include <message_class.h>
#include "include/npc.h"

inherit "/lib/eventDescribe";
inherit LIB_CHAT;
inherit LIB_COMMAND;
inherit LIB_CONTAINER;
inherit LIB_LIVING;
inherit LIB_MESSAGES;
inherit LIB_MOVE;
inherit LIB_OBJECT;
****************************************************************************

           ************************************************
                        Part 1: Events Section
           ************************************************

int eventCompleteMove(mixed dest);
This function is built off of the basic eventMove() by controlling the 
movement of the NPC as well as the loading of objects that will end up in the
inventory of the NPC. It checks to see if items are unique. Dest may be
either a number, string, or function.

int eventDestruct();
This function controls the destruction of the NPC.

varargs int eventDie(object agent);
Whenever an NPC dies, this function is called. The agent is the object that
is reponsible for the death of the NPC. It also controls the destruction
of the NPC as well as the printing of death messages to the appropriate
locations.

void eventEnemyDied(object ob);
Whenever an enemy of an NPC dies (during battle), this function is called to
remove that enemy from the list of current enemies. This is a common function
to be overriden if you want to make the NPC do something every time it kills
someone in battle.

int eventMove(mixed dest);
This function calls for eventCompleteMove() as well as moving of all of the
followers of the NPC to the new location.

varargs int eventMoveLiving(mixed dest, string omsg, string imsg);
This function controls the interactive moving of an NPC (such as room to room).
Dest is the destination of the move, omsg is the message printed when the
NPC leaves, and imsg is printed to the room that they arrive in.

varargs int eventPrint(string msg, mixed arg2, mixed arg3);
This function is used to print string msg to an NPC. Arg2 and arg3 are used
for identifying what types of messages are being printed to the NPC.

int eventReceiveObject();
This function is responsible for handling whenever an NPC receives an object.
It makes sure it's a valid object as well as making sure that the mass of the
object is added to the carried mass of the NPC.

varargs int eventShow(object who, string str);
This function is responsible for whenever someone looks at an NPC. It calls
eventShow() in /lib/living.c, then it prints the proper messages to the NPC.

           ************************************************
                     Part 2: Modal Methods Section
           ************************************************

int CanCarry(int amount);
This function is reponsible for checking whether an NPC is able to carry 
something or not.

mixed CanGet(object who);
This function makes sure that nobody can pick up a living being, such as the
NPC.

int CanReceive(object ob);
This function checks if an NPC can receive an object by passing it through
CanCarry().

           ************************************************
                  Part 3: Data Manipulation Functions
           ************************************************

mapping SetInventory(mapping mp);
This function is used to define what is in the NPC's inventory.

mixed AddInventory(string prop, mixed val);
This function is used to add one item at a time to the NPC's current inventory.

varargs string SetRace(string race, mixed extra);
This function is used to set what the race of an NPC is. After it is set, it
completely heals the NPC.

string SetClass(string cls);
This function defines what class an NPC is and then sets up all of the skills
that the NPC should have for that class.

int SetLevel(int x);
This function readjusts what level an NPC is at by completely healing it as 
well as redefining what level their skills are at. It will also make sure 
stats are at the proper levels.

int GetLevel();
This returns what level an NPC is.

int SetHealthPoints(int x);
This function will make the NPC have x amount of health points available. If
x is greater than the maximum amount they can have, it will automatically set
it to that maxmum.

int SetMaxHealthPoints(int x);
This function adjusts their durability stat and returns x as the new maximum
value that the NPC may have for health points.

int SetMagicPoints(int x);
This function works similarly to SetHealthPoints(), except that it determines
how many magic points the NPC has readily available to use. Again, if it's
greater than the maximum amount they can have, it will automatically set it
to that maximum.

int SetMaxMagicPoints(int x);
This function adjusts an NPC's intelligence stat and returns x as the new
maximum value that the NPC can have for magic points.

int SetStaminaPoints(int x);
This function sets how many stamina points the NPC has readily available to
use. If x is greater than the max that has been set, it will automatically
set it to that maximum.

int SetMaxStaminaPoints(int x);
This function adjusts an NPC's agility stat and returns x as the new maximum
value that the NPC can have for stamina points.

varargs void SetCurrency(mixed val, int amount);
This function will make it so an NPC is holding a certain amount of money.
This is useful for giving away treasure when it dies. Val is the currency
to be given away (imperials, rupies, etc). Amount is the amount of that
currency that the NPC should have.

mixed SetEncounter(mixed val);
This function is used to determine whether an NPC will attack something else
the second that it comes in contact with it. If val is a function, it will
evaluate that function to the conditions that you set it. If it is an array
it will attack all players that GetKeyName()'s match in the array. Finally,
if it is just a normal int, it will attack the player if their charisma is
lower than the int.

string *AddEncounter(string nom);
This function is used to add a living object's key name to the list of people
that should be attacked upon contact of the NPC.

string *RemoveEncounter(string rom);
This function is used to remove a living object's key name from the list of
people that the NPC should attack upon contact.

mixed GetEncounter();
This will return the value of the encounter variable. It can be either a
function, int, or array.

mixed SetDie(mixed val);
If val is set to a string, it will print that string to the screen of the 
NPC's killer when it dies. If it is a function, it will evaluate that 
function normally.

mixed GetDie();
This function returns what has been set in SetDie().

string SetKeyName(string nom);
This function will set the key name of the NPC.

string GetName();
This function will call the object inheritable to get the name of the NPC.

string GetCapName();
This function will call the object inheritable to get the capital name of
the NPC.

string GetShort();
This function calls the object inheritable and returns the short description
of the NPC.

varargs string GetLong(string str);
Whenever an NPC is looked at by another living being, this function is used
to put together all of the vital information of the NPC such as the 
description, inventory, and health. It is then printed to that person that
looked at it.

void SetAction(int chance, mixed val);
This function is used to make an NPC do something every once in awhile. Val is
what the NPC should do while chance is how much of a chance the NPC has to do
it every heartbeat. The larger chance is, the more often it will do it every
heartbeat.

mixed GetAction();
This returns what action(s) the NPC has a chance of doing every heartbeat.

void SetCombatAction(int chance, mixed val);
This function is used to make an NPC do something during combat only. Val is
what the NPC should do while chance is how much of a chance the NPC has to do
it every heartbeat. The larger chance is, the more often it will do it every
heartbeat in combat.

mixed GetCombatAction();
This returns what action(s) the NPC has a chance of doing every heartbeat in
combat.

int AddCarriedMass(int x);
This function adds x to the amount of mass that the NPC is carrying.

int SetUnique(int x);
This function is used to define whether an NPC is unique or not.

int GetUnique();
This function will return whether an NPC is uniqe or not.

int AddEnemy(object ob);
This function will add an object to the list of enemies that an NPC currently
has on its list.

string *GetEnemyNames();
This function will return the full list of enemies that an NPC currently has.

string *SetFriends(string *args);
This function sets the list of people that the NPC will protect. When an NPC's
friend is attacked, he will attack the person that attacked his friend.

string *GetFriends();
This function returns the full list of friends that an NPC currently has.

string *AddFriend(string *arg);
This function adds to the list of people that an NPC currently has as friends.

string *RemoveFriend(string *arg);
This function removes from the list of people that an NPC currently has as its
friends.

int eventDisplayStatus();
This function will display the hp, mp, and sp to the screen of the NPC. This
function is normally used for when an immortal assumes an NPC.

int SetTestChar(int x);
This function sets whether an NPC is a test character or not.

int GetTestChar();
This function will return whether an NPC is a test character or not.

void eventPage(string *lines);
This function is used for when something needs to be printed to the NPC. It
is basically a duplicate of eventPrint().
