It’s recommended that you take a glance at the corresponding FE7 documentation so you get a general idea of how the AI functions.
It is assumed you have read that.
AI1: Primary AI Byte
AI1 0x00 through 0x06 are all identical to the FE7 entries.
0x00 = Action 100% 0x01 = Action 80%, end turn without moving/acting 20% 0x02 = Action 50%, end turn without moving/acting 50% 0x03 = Action without moving 100% 0x04 = Action without moving 80%, end turn without moving/acting 20% 0x05 = Action without moving 50%, end turn without moving/acting 50% 0x06 = Do Nothing 0x07 = Do not attack character 0xD (Natasha, character at 5A8A00) 0x08 = Do not attack character 0xFC (character at 5A8B3C) 0x09 = Do not attack character 0x0 (character at 5A817C) 0x0A = Only attack character ??? if deployed. (currently 00 01, set it at 5A8BA4) 0x0B = Same as 0x0 0x0C = Attack if within Mov/2+Range(?) 0x0D = CHAI [0x0, 0x0] if the unit's leader has foe in range.(?) 0x0E = Heal allies under 50% HP(?) 0x0F = Alternate between 0xE and 0x3 0x10 = Pick Locks/Steal, then CHAI [0x6, 0xC] (Escape) 0x11 = Pick Locks/Steal 0x12 = Do not attack character ??? (points to 00 01 00 01) 0x13 = Do not attack character ??? (points to 00 01 00 00) 0x14 = Try to use Nightmare (but not on turn one), then try to Summon Units, then act like 0x0 (AttackInRange)
AI2: Secondary AI Byte
0x00 = Move towards opponents. If blocked, do nothing 0x01 = Move towards opponents, but not character(s) 0x0 (5A817A) 0x02 = Move towards opponents, but not character(s) 0x0 (5A817C) 0x03 = Do nothing 0x04 = Loot villages/open chests, then change AI2 to 0x0 0x05 = Loot villages/open chests, then change AI2 to 0xC 0x06 = If could reach opponents in two turns, change AI2 to 0x0 0x07 = If could reach opponents in two turns, change AI2 to 0x1 0x08 = Do nothing 0x09 = Random movement 0x0A = Move to character 0x1 Eirika if not in range, or move to opponents if so 0x0B = Move to character 0xF Ephraim if not in range, or move to opponents if so 0x0C = Move to escape point and escape; if cannot escape, do nothing 0x0D = Move on to nearest terrain 0x1B/0x1F (Throne/Fence) (0x5A8182) 0x0E = Attack walls until no more remain(?), then CHAI [0x0,0x0] 0x0F = Move towards opponents. Move as close as possible when blocked. 0x10 = If not in area [13,15]-[18,19], move to [15,17]; if in area, CHAI [0x0,0x0] 0x11 = Wait one turn, then change AI2 to 0x4 (raid then attack) 0x12 = Wait one turn, then change AI2 to 0x0 (Pursue)
AI3: Recovery and Targeting
FE8’s TP mod table is identical to the table in FE6 and FE7. Like FE7, there are no classes defined to get TP bonuses.
FE8 TP mod table: 080D8178
Pointers to class sets (all point to 00): 085A8150
The units the demon king summons are at 88D1F54, just as event assembler units.
807B2BC - number of units in that array