AI.TXT File Format

The file consists of a description of combat parameters for the player and all NPC classes in the game. Descriptions are separated from one another with an empty line. Each description consists of the (unique) name of the class and settings. Below is a list of parameters in alphabetical order, which is how they are always written in the file. "string" means that the value should be text; "N" indicates a numeric value; and "mixed" can be either.

There seems to be a mismatch between some of the string values used and what the engine actually looks for. Potentially incorrect values are indicated with a (*).

[Class Name]

This option must be specified first. For example, [Enclave Patrol], [Fighting Mantis] or [Arroyo Villager]. The player is the class named Player AI. Every party member must have the following classes: [PARTY NAME AGGRESSIVE] [PARTY NAME BERSERK] [PARTY NAME COWARD] [PARTY NAME CUSTOM] [PARTY NAME DEFENSIVE] Here NAME is the name of a member of the team, such as: DOC, LENNY, etc. GORIS

aggression = N

The chance of aggressive behavior by the NPC in combat. Measured as a percentage. Valid values are: 0-100.

area_attack_mode = string

Conditions for burst-fire. Existing values, the internal numeric representation, and the text used for setting custom behavior in-game: no_pref*              -1  "Not Applicable." always                 0  "Always!" sometimes              1  "Sometimes, don't worry about hitting me" be_sure                2  "Be sure you won't hit me" be_careful             3  "Be careful not to hit me" be_absolutely_sure     4  "Be absolutely sure you won't hit me" 'no_pref' is used by Cyberdog and Goris, and has a line in custom.msg, but is not checked for by the engine.

attack_end = N 

attack_start = N

Combat taunts said when attacking. At the beginning of the attack, a random number between the two values is chosen. Then the appropriate line number from master.dat/text/english/game/combatai.msg is displayed.

attack_who = string

Who the NPC should attack. Existing values: whomever_attacking_me    0  "Whomever is attacking me" strongest                1  "The strongest" weakest                  2  "The weakest" whomever                 3  "Whomever you want" closest                  4  "Whomever is closest"

best_weapon = string

Preferred weapon types. This option does not exist for all NPCs. Available values: no_pref              0  "None" melee                1  "Melee" melee_over_ranged    2  "Melee then ranged" ranged_over_melee    3  "Ranged then melee" ranged               4  "Ranged" unarmed              5  "Unarmed" unarmed_over_thrown  ? (Spore Plant) random               ? never*               ? (Deathclaw)

body_type = string

Defines the block of messages that critters say in response to being hit. The blocks are from master.dat/data/AIBDYMSG.TXT, which in turn refers to lines in combatai.msg. Existing values (examples of critters that use them in parens): None Primitive Wimpy Person (Whimpy, Coward ...) Punk (SF) Berserk Person (Kamakazi. ..) Tough Person (Bounty Hunter, Caravan Driver ...) Boxer Normal Person Robot Junkie (Crazy Addict) Elron (Habologisty) Ghoul Kaga Raider (Khan) Raider (Non-Khan) Gangster (Mobsters) Shi Super Mutant (Master Army) Goris Miron Marcus Lenny Cassidy Robo Brain (Hum / Cyb) Sulik

called_freq = N

Sets the probability of using an aimed attack, which is calculated as 1/N. Cannot be zero.

chance = N

The likelihood of any message. Measured as a percentage. Valid values are: 0-100.

chem_primary_desire = N

Preference for drug use. PIDs of items, or -1 if there is no preference. If you want to specify multiple types of drugs, they are listed separated by commas (e.g., 284,81,103). Strangely, most critters use 81 (Iguana-on-a-stick, whole).

chem_use = string

NPC drug use in combat. Existing values: clean                     0  "I'm clean" stims_when_hurt_little    1  "Stimpacks when hurt a bit" stims_when_hurt_lots      2  "Stimpacks when hurt a lot" sometimes                 3  "Any drug some of the time" anytime                   4  "Any drug any time" always                    ?

color = N

Perhaps the font color used for combat taunts. It is 58 for all critter types.

disposition = mixed

Determines NPC behavior during a battle. Existing values: -1* none custom coward defensive aggressive berserk

distance = string

The distance between the NPC and its enemy, managing battle tactics. Existing values: stay_close       0  "Stay close to me" charge           1  "Charge!" snipe            2  "Snipe the enemy" on_your_own      3  "On your own" stay             4  "Stay where you are" random*          ? (listed only for Mobsters and Tough Khan)

font = N

Perhaps, the font used for combat taunts. Value in the US version of the game is 101. In other versions 102, 103, and 104 are used.

general_type = string

Defines the block of combat taunts that the critter periodically shouts during a battle (attack, retreat, miss). The blocks are in master.dat/data/AIGENMSG.TXT, and refer to lines in combatai.msg. Existing values: Badger Berserk Person Bounty Hunter Boxer Cassidy Chip Crazed Robot Cyberdog Dragon (The) Elron Guards Gangster Ghoul Goris Guard (Normal) Guard (Tough) Junkie Kaga (1) Lenny Lo Pan Marcus Myron None Normal Person OZ - 7 OZ - 9 Primitive Raider Raider Captain Raider Mercs Rat God Robot Ryan Shi Guards Sulik Super Mutant (Master Army) The Brain Tough Person Wimpy Person

hit_eyes_end = N 

hit_eyes_start = N

hit_groin_end = N 

hit_groin_start = N

hit_head_end = N 

hit_head_start = N

hit_left_arm_end = N 

hit_left_arm_start = N

hit_left_leg_end = N 

hit_left_leg_start = N

hit_right_arm_end = N 

hit_right_arm_start = N

hit_right_leg_end = N 

hit_right_leg_start = N

hit_torso_end = N 

hit_torso_start = N

NPC messages when hit in the eyes, groin, head, left arm, left leg, right arm, right leg and torso, respectively. For details, see the description of attack_end.

hurt_too_much = string

Indicates the condition in which the NPC starts running away. Multiple conditions are separated by commas. blind         40 crippled      3c crippled_arms 30 crippled_legs 0c 'crippled' is equivalent to 'crippled_arms, crippled_legs'

max_dist = N

The maximum distance from the player where the NPC is hostile. Measured in hexes.

min_hp = N

The minimum number of hit points, at which the NPC starts running away.

min_to_hit = N

The NPC will attack only if it has at least this high a chance (percentage) of hitting its target.

miss_end = N 

miss_start = N

NPC combat taunts when missing a target. For details, see the description of attack_end.

move_end = N 

move_start = N

Combat taunts used when moving to attack (i.e., when not yet in range of the enemy, but already hostile) For details, see description of attack_end.

outline_color = N

Maybe the color used for target highlighting. For all NPC classes, it is 55.

packet_num = N

Number of the AI package. Never change it! If the new AI package you indicate packet_num, which already exists, then when you click on the AI button in the mapper (in critter properties), it closes the window. When you create a new AI package, the value of packet_num must be consecutive. In AI.txt there are 187 values for packet_num, from 0 to 186 inclusive. If you want to add a new package, it should have packet_num 187, the next added package 188, and so on. If packet_num is not followed consecutively, for example, 188 immediately after 186, the mapper will close.

run_away_mode = string

Condition when the NPC will run away. Existing values (second column is minimum amount of damage taken, as a percentage of max HP): coward             0%   0  "Abject coward" finger_hurts      25%   1  "Your finger hurts" bleeding          40%   2  "You're bleeding a bit" not_feeling_good  60%   3  "Not feeling good" tourniquet        75%   4  "You need a tourniquet" never            100%   5  "Never!" none               0%   6  "None"

run_end = N 

run_start = N

Combat taunts used when running away. For details, see the description of attack_end.

secondary_freq = N

Similar to called_freq. Sets the probability of using a secondary (i.e., burst) attack mode, which is calculated as 1/N. Cannot be zero. Only used when area_attack_mode is 'sometimes' or 'no_pref'.

[| Original document] at TeamX.ru (in Russian)