# brainAI DOCUMENTATION

Version 5, codename "Krang", by Austin Heilman.

## npcInit.inc

npcInit.inc Functions
Constants
The following constants are inside npcInit.inc
Constants for NPC_SetupRandomEquipment() CONST EQUIP_NOGENDER := 0x0; // Items suited for both genders. CONST EQUIP_MALE := 0x1; // Use male-only items (do any exist?). CONST EQUIP_FEMALE := 0x2; // Use female-only items. CONST EQUIP_BOTHGENDER := 0x3; // Cross-dresser.
NPC_SetupAmmo
Parameters
(mobile)
Name | Type
mobile | The npc that will be given the ammunition.
Explanation
Creates ammunition in the NPC's pack based on its 'AmmoType' and 'AmmoAmount' settings in its npcdesc.cfg template.
Return Values
Returns 1 or error
NPC_SetupBackPack
Parameters
(mobile)
Name | Type
mobile | The NPC that will be given a backpack.
Explanation
Creates a backpack and places it on an NPC. If it can't equip it, it removes it.
Return Values
Returns an item reference on success. Will also return an item reference if a backpack already exists.
NPC_SetupEquipment
Parameters
(mobile, elem_name:=0)
Name | Type
mobile | The NPC to place equipment onto.
elem_name | Name of the equipment template to use in equip.cfg. If no name is set, it will use the 'EquipTemplate' line in the NPC's npcdesc.cfg template.
Explanation
Equips an NPC with EquipFromTemplate() and ::equip.cfg
Return Values
Returns 1 or error
NPC_SetupName
Parameters
(mobile, name_elem:=0)
Name | Type
mobile | The NPC to do a name check on.
name_elem | Name of the elem in names.cfg to use. If no name is set, it will use the 'NameList' line in the NPC's npcdesc.cfg template.
Explanation
Replaces every instance of <random> in an NPC's name with a valid name using ::names.cfg
Return Values
Returns 1 or error
NPC_SetupRandomEquipment
Parameters
(mobile, elem_name:=0, flags:=EQUIP_NOGENDER)
Name | Type
mobile | The NPC to place equipment onto.
elem_name | Name of the equipment template to use in :brainAI:config/equipIndex.cfg If no name is set, it will use the 'EquipTemplate' line in the NPC's npcdesc.cfg template.
flags | Flags to control which lines to use in equipGroups.cfg. EQUIP_NOGENDER - 'Item' lines that work for both genders (this list is used with all flags). EQUIP_MALE - 'Male' lines for male-only equipment. EQUIP_FEMALE - 'Female' lines for female-only equipment. EQUIP_BOTHGENDER - Uses all entries to allow for cross dressing npcs.
Explanation
Equips an NPC randomy-yet-still-fashionably.
Return Values
Returns 1 or error