Todo: Write this thing so people actually know how to use it.
Part 1: AI Pointer Tables/The Existing AI
Before you make your own AI, you need to be familiar with the existing AI. It's all documented in the official FE7 AI thread. FE is the same, with the addition of the demon king AI.
So all of the AI is determined by AI commands pointed to in these pointer tables:
Pointer table for primary AI: B98994 (20 entries)
Pointer table for secondary AI: B98908 (35 entries)
It's replacing these entries or writing new AI to add to the tables that AI Assembly accomplishes.
When you tell a unit to have an AI of [0x0, 0x3], that means it should use the primary AI that's 0x0 in the first table, and if that fails, use the AI in the second table pointed to by the 0x3-rd pointer. In this case, that means if there's something to attack in range, it'll attack that. Otherwise it'll fail and fall through to AI2 0x3, which always fails. When both AIs fail, the unit does nothing. Thus, the observed behavior is AttackInRange.
Part 1.1: Repointing AI