[FE7] The Official AI Documentation Thread

Taking a look at the AI Commands for AI2 0x8:

AI2 0x08 - 08B975B8 - ???
01 00 FF 00 00 00 00 00 D9 A4 03 08 00 00 00 00 @Seen in unreached commands in AI 0x17?
00 00 FF 01 00 00 00 00 72 A9 03 02 00 00 00 00 @If 0<Memory, Goto 1
03 00 FF 00 00 00 00 00 00 00 00 00 00 00 00 00 @Goto 0
1B 00 FF 01 00 00 00 00 00 00 00 00 00 00 00 00 @Label 1
01 00 FF 00 00 00 00 00 F1 A3 03 08 44 3B 1D 08 @ Parameters = FF 01 00 00
01 00 FF 00 00 00 00 00 C1 A0 03 08 48 3B 1D 08 @Get Foe in Expanded Range
00 00 FF 01 00 00 00 00 72 A9 03 02 00 00 00 00 @If foe in expanded range, goto 1
0E 00 FF 00 00 00 00 00 00 00 00 00 00 00 00 00 @Nop
03 00 FF 00 00 00 00 00 00 00 00 00 00 00 00 00 @Goto 0

Had a hunch based on the 0x32 there, confirmed experimentally.

Is there a way to make the enemy target more units?
I know AI1 0x0A makes the enemy attack the character 0x03, but can you make them attack other units?
Like, 0x0A = Target 0x03, 0x1A = Target 0x04, 0x1B = Target 0x05 and so on.

I don’t know is this is doable, but is there something to force the enemy to attack certain units?
–But I suppose this haven’t been figured out yet, because I remember someone wanted to create the Provoke skill based on AI and he couldn’t.–

The actual code for AI 0xA is
AI 0xA - 08B97ABC - Only attack character 0x03 (tutorial Lyn) (B97AC0)
04 64 FF 00 03 00 00 00 00 00 00 00 00 00 00 00 @??? Data = 03 = Lyn_t
00 05 FF 00 03 00 00 00 72 A9 03 02 00 00 00 00 @If memory != 0x3, goto top
05 64 FF 00 00 00 00 00 00 00 00 00 00 00 00 00 @Default behaviour if can’t find Lyn_t?
03 00 FF 00 00 00 00 00 00 00 00 00 00 00 00 00 @Goto top

So to expand it just add more 04-type commands. AI Assembly. Blah. Stuff. Sorry I’d explain more but I have to leave so this is a rushed post.

A post was split to a new topic: AI Help Needed

ok I think it’s better to just ask because my own tests are giving me something weird. For making the custom AI, is the order [A1,A2,A3,A4] or is it actually [A3,A4,A1,A2] like the first post was suggesting?

I think they are read in the latter order but actually written in the first

If you’re asking about when assembling events, the traditional [AI1, AI2, AI3, AI3] order still works, but I’m now recommending the format which I defined for the newest event assembler of [AI1, AI2] AI3 AI4.

If you’re talking about making your own AI, then it doesn’t matter; you specify whether it’s AI1 or AI2 by overwriting different pointer tables.

Ah thank you both, using the old event assembler so it will be a1 - a4 then.

Reposting from the FE8 AI thread:

This routine is super important for AI execution.
Routine 08034E50
Writes command data to 0203A97C

Parameters:
r0 = move to x
r1 = move to y
r2 = command
r3 = target unit deployment number (escape x)
sp+0x00 = inventory slot to use or steal (0xFF = ballista)(escape y)
sp+0x04 = snag/wall x-coordinate (escape direction)
sp+0x08 = snag/wall y-coordinate

Commands:
00 = none. 01 = attack. 02 = escape (remove unit from map). 03 = steal.
04 = pillage village. 05 = staff. 06 = item. 07 = dance/play. 08 = talk.
Note: dance/play doesn’t work.

0203A97C
0x00 = command
0x01 = enemy deployment number
0x02 = move to x
0x03 = move to y
0x04 = (skipped)
0x05 = (skipped)
0x06 = target unit deployment number (escape x)
0x07 = inventory slot to use or steal (0xFF = ballista)(escape y)
0x08 = snag/wall x-coordinate (escape direction)
0x09 = snag/wall y-coordinate
0x0A = 01 (indicates a command was written)

Not 100% sure on talk command bytes 0x06-0x09 yet.
Looks like the deployment numbers of the talkers and maybe the talk event id.

5 Likes

Oh my god this is amazing I’m going to put this to good use.

Edit: Can you find a corresponding routine in FE8?

Edit2: I don’t have time this week, but I want to mess with this asap. So, next week. Not being able to/not putting enough effort into find this routine was a sticking point with me not meddling too much with AI anymore.

It’s so lit tho

1 Like

What am I looking for in these images?

Enemies using items that they normally don’t, like promotion and stats boost items.
I’m not sure about the Batta vs. Batta.

Promoting enemies would be the biggest troll

2 Likes

Yeti had a video where he attacks an enemy in fexp and the enemy autolevels to 20/20 and promotes. It was pretty funny.

Enemies using stat boost items is suuuuuuch a tease.

1 Like

Aha I found it. https://www.youtube.com/watch?v=GruSYlciNLs

1 Like

It would be a good challenge on maps, putting stat boost items on chests and a thief stealing and using them.
Even better with promotion items.
I wonder if is possible to give items to brigand/thief after destroying villages and then they’re able to use them…