[FE7] The Official AI Documentation Thread

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…

Two quick questions…On factions…Can animations be Used??
And how do i make a Thief that after looting gets angry and attacks your units instead of trying to run away??

On factions…Can animations be Used??

Don’t understand what you’re asking here, sorry.

after looting gets angry and attacks your units

I think you’d need to put an event on the chest that checks who opened it and CHAIs appropriately.

Yep, crazy colors made factions by changing one byte of the AI, but his tech demo had no animations, just map sprites. and ill check the Chai, or maybe Briggand Ai could work??

I was reading through to learn how the last part of the third AI byte (Target) works.
In summary of what @Gryz has put (as well as looking through fe 6) it would appear that:

00 = Prioritize damage taken more than 8 but much less than 10
prioritize accuracy more than 8 but much less than 20
(For intelligent enemies like bosses)

08 = Prioritize damage (Standard)
10 = Prioritize damage taken (Jaffar)
20 = Prioritize accuracy (Never used in Fe 7)
28 = Archers

In Fe 7, 08 is the standard while 00, 28, & 10, are used for a few commanders, almost every archer, and a few units who want to live (mainly NPC jaffar) respectivly.

In Fe 6, 00 is the standard behavior (used by most of the army), 08 is for the brigands at the beginning and some mercenaries, 10 is used by staff wielders,
20 I found to be used by a single poison axe user, and 28 is almost every bow user in the game.

I may do some more testing on how 28 works (something to do with adjacent allies maybe?) if I do I’ll put my results here.

2 Likes