Enemy AI

From Chrono Compendium
Revision as of 06:36, 13 July 2008 by JLukas (Talk | contribs)

Jump to: navigation, search

Notes on Enemy AI are currently incomplete; eventually, data will be decoded and added into Temporal Flux for functionality. Enemy AI information will be updated as new stuff comes.

Offsets

Directly from Geiger's Offsets.txt
___________________________________________________________________
0C8B08 0C8D07 PTR No No Pointers to Enemy AI (local) 6/21/2004
0C8D08 0CCBC8 AI No No Enemy AI 7/14/2003
___________________________________________________________________



Summary

Enemy AI is divided into two blocks that terminate with FF.

AAAAAAAAFF
BBBBBBBBFF

The first block contains actions that the enemy performs on its own. The second block contains reactions when the enemy is attacked.

Each block can be broken down into sections that alternate between Condition and Action.


Condition

Conditions are a multiple of 4 bytes, each of which is a boolean statement. All must be true for the following Action section to be executed. The section is terminated by $FE.

Action

Actions can contain one or more commands to perform. An enemy's attack meter must refill first before it can continue with the next command. The section is terminated by $FE.

Conditions

There is a total of 41 Conditions ($00-28)

00 ?? ?? ?? nothing.  continue with following Action
01 hh ?? ?? check health.  hh - 03=50%
02 ?? ?? ??
03 ?? mm ?? unknown.  mm - monster index
04 ?? mm ?? check if monster is alive.  mm - monster index
05 nn ?? ?? check number of enemies.  nn - minimum? number of enemies that must exist for the following Action to be executed
06 ?? ?? ??
07 nn ?? ?? check times attacked.  nn - number of times the enemy must be attacked for the following Action section to be executed
08 ?? ?? ??
09 ?? ?? ??
0A ?? ?? ??
0B ?? ?? ??
0C ?? ?? ??
0D ?? ?? ??
0E ?? ?? ??
0F ?? ?? ??
10 ?? ?? ?? (only used once for Enemy $F8 R Series?)
11 ?? ?? ??
12 ?? tt ?? if hit with tech.  tt - tech index
13 ?? ?? ??
14 ?? ?? ??
15 ee ?? ?? if hit by attack.  ee - 80=lightning
16 ?? ?? ?? (possibly unused)
17 cc ?? ?? load random number.  cc - chance to execute following Action
18 ii ?? ?? if hit by specific weapon.  ii - weapon index
19 ?? ?? ??
1A ?? ?? ??
1B ?? ?? ??
1C ?? ?? ??
1D ?? ?? ??
1E ?? ?? ??
1F ?? ?? ?? check distance.
20 ?? ?? ?? check if defeated.
21 ?? ?? ??
22 ?? ?? ??
23 ?? ?? ?? (same as 18)
24 ?? ?? ?? (same as 18)
25 ?? ?? ?? (same as 18)
26 ?? ?? ?? (same as 18)
27 ?? ?? ?? (same as 18)
28 ?? ?? ?? (same as 18)


Older data not 100% confirmed:


05 XX 00 00 - number of enemies atleast XX
40 00 XX 01 - If monster XX is dead...byte 2/4 unexplored
09 00 00 00 - Physical Counter.
10 00 00 00 - Always Counter.
11 00 00 00 - Magical Counter.
15 XX 00 00 - Elemental Counter - 20 Ice, 10 Fire, 80 Lightning, 40 Shadow, 00 Physical. (02 and 04 have been used, only saw them skimming the listings)
1F 04 XX 00 - Is enemy distant (non-zero) or up close (zero)?

Actions

There is a total of 23 Actions ($00-16)

00 ?? ?? ??  wander mode.
01 aa ww ??  attack.  aa - attack index ww - who to attack 05 random pc 06 nearest pc
02 tt ww ?? ?? ss use tech.  tt - tech index ww - who to attack 05 random pc 06 nearest pc ss - battle enemy message string to display
03 (nothing, no routines)
04  random action start.  uses a random number to determine which action in current section to start on.
05 ?? ??  unknown.  not confirmed if it is a 3 byte command.  unused?
06 (nothing, no routines)
07 mm ?? ??  become monster.  mm - monster to turn into
08 (nothing, no routines)
09 ??  display flashes for distant attack?
0A aa ss  run away.  aa - action to show ss - battle enemy message string to display
0B ?? ?? ?? ss  set stat.  ss - battle enemy message string to display
0C ?? ?? ss  stat related.  ss - battle enemy message string to display
0D ?? ss  unknown.  ss - battle enemy message string to display
0E (nothing, no routines)
0F ss  display text.  ss - battle enemy message string to display
10 ?? ?? ?? ??
11 ?? ?? ?? ?? ?? ?? ?? ?? ??
12 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ss  unknown. ss - battle enemy message string to display
13 ?? ??  unknown.  not confirmed if it is a 3 byte command.  unused?
14 ?? ?? ?? ?? ?? ?? ?? ?? ??
15 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??
16 ?? ?? ?? ?? ?? ?? ?? ?? ?? ?? ??


Older data not 100% confirmed:


00 WW XX YY            - wander mode YY is how you wonder, WW animation related?
02 WW 05 XX YY ZZ      - Spell WW, Message ZZ, XX YY for double/triple?
04 WW XX YY ZZ         - Tech WW no message.  XX is usually 02, YY ZZ unknown
07 XX YY ZZ            - Become different monster XX using animation YY.  ZZ affects keeping HP requires event code
09 XX                  - Pretend to do attack XX
0A XX YY-              - Disable do animation XX display Message YY
0B XX YY 00 ZZ         - Set stat type XX, Stat YY, with message ZZ
0C XX YY ZZ            - Add stat XX by YY message ZZ
0F XX                  - Display Message XX
28 XX YY               - Change Stat XX by YY

Supplemental Material

From: Offsets (Chrono Trigger)