I thought I had this figured out, but it turns out that it didn’t work completely the way I wanted to.
I have a chapter where one of the objectives is to prevent an enemy from taking the gate. In order for this to be free of dumb exploits, the enemy AI should move in the general direction of the gate, move onto the gate if the path is open, and otherwise attacks units if they can’t reach the gate.
My initial thought was to set an enemy escape point to the coordinate of the gate and then to set enemies to have AI byte 1 = 0x0 and AI byte 2 = 0xC. Here’s what happens:
- If path to gate is open and no targets in range, enemy moves towards gate. This is good.
- If enemy can reach gate, enemy takes gate. This is good.
- If path to gate is open and targets are in range, enemy attacks target. This is okay.
- If path to gate is blocked and no targets in range, enemy does nothing. This is bad.
- If path to gate is blocked and targets are in range, enemy attacks target. This is good.
So the problem right now is that if you block the path to the gate and stay out of enemy range, then the enemy does nothing, thus rendering the defense sub-objective pointless. How do I solve this problem in a non-exploitable way? I read the FE7 AI documentation and saw that there are some AI2 bytes that force enemies to prioritize a pre-determined coordinate. Does FE8 have this as well?
EDIT: AI2 0x10 sets enemies to target a coordinate specified at 0x5A90C0. However, this doesn’t solve my problem. With AI2 0x10, the enemy will continue to match towards the coordinate if the coordinate is blocked, which takes care of the issue specified above, but this creates new issues.
If AI1 is 0x0, the enemy fails to take the goal if it has a target in range, and if AI1 is 0x6, the enemy will steadfastedly go for the goal but never attack. Neither solution is satisfactory. AI1 0x3 is interesting - the enemy will usually go for the goal without attacking, but it will prioritize attacking over goal-taking if you leave a unit within its immediate attack range (i.e., as long as it doesn’t have to move).