[FE7/FE8] Thief Escape Point AI

I got bored and decided to figure out where all of the thieves escape in FE7. However, that would take way too long because no one has that stuff documented.
I found one location, in 7x, which made me wonder about the thief AI once again.
As I thought, the thief AIs are not the same in every chapter, they are slightly different. The 3rd byte seems to be the byte of interest, but I can’t figure out it’s link to the location. This is all I have for now, bear with me. The chapters are by Hector Mode, and byte 17 is the 17th byte in the chapter in the chapter data editor module. My initial hunch was that it was related, but I don’t think so anymore.

BYTE 17    THIEF AI           CHAPTER    ESCAPE POINT
0x01    [0x06,0x05,0x01,0x00]    7x    [01,01]
0x01    [0x06,0x05,0x01,0x00]    15    Unknown
0x11    [0x00,0x05,0x0A,0x00]    19xx  Unknown*
0x0D    [0x06,0x05,0x09,0x00]    20    Unknown
0x0B    [0x06,0x05,0x0A,0x00]    22    Unknown
0x09    [0x06,0x05,0x0A,0x00]    28    Unknown
0x05    [0x06,0x05,0x0A,0x00]    30    [00,05]
0x10    [0x06,0x05,0x02,0x00]    31    [13,27]
* - AI not tested

If you can’t make any sense out of this either, join the club.

Man, somebody should really try to figure this out someday.

Going to leave this here, copy and pasted from my topic,

Theif AI:
-This was a bitch, This took me all day to beta test to get down, basically it comes down to the 4 bytes in Enemy AI which looks like this [0x00, 0x00, 0x00, 0x00].
1st place = Attack AI
2nd place =Movement AI
3rd place = Healing AI
4th place = some kind of flag
(credit goes to the theif AI topic in fe universe and VincentASM in serenes forest AI question topic)

So this got me thinking that I should try messing with movement because I have seen FE AI do some cool shit by running away from me or moving randomly. I played around and found out 0x8,0x13-0x16, 0x19,0x1A, and 0x1D (that is as far as I tested) caused the thief to run like he was escaping then will stop at a random point. So it will look like this [0x6 0x15 0x9 0x0] once you change it from opening chests.
I have confirmed this works however it seems it strongly works best during turn events. Couldn’t get conditions events to work with it. Hopefully someone with more patience and know how can figure it out. >.>

I think the major issue is figuring out where the escape point is determined, which I suspect is hardcoded to certain chapters. Once we open that up, we’ll finally get this working properly. It looks like you’re using CHAI to get this effect (I don’t know for certain, but I’ve observed the game shifting to this behavior once all chests are opened).

To get around this dilemma in Elibian Nights, I just made the thieves trollier by making them disappear the turn after they open a single chest (one-hit-wonders), which you can find the source for here.

Thank you, This will come in handy no matter what happens. As for the AI, I am using a turn event code that changes the thief AI into escape after a number of turns I think is enough time for 1 of the thief to get to a chest. That was the best I could manage because again, the condition codes just refused to work right. (was probably coded wrong somewhere.)

If you want to PM me your events and conditions I can take a look at them.

1 Like

Hot damn that is too pro, now I can come up with some even cooler chapter event shit

So, I managed to find where FE8 puts its values for escape tiles. You could say Gryz’s work inspired me.

The earliest set of escape coordinates used are located at $D84E0, and is used by chapters that don’t have escaping enemies.
There are some escape coordinates before D84E0, up to as early as D83D0, but they don’t appear to be used.

The pointer table to these escape coordinates is at $5A8188.

Otherwise, they follow the same format as FE7’s system.

It appears that FE8 has a separate pointer table for NPC units; it starts at $5A828C. By default it is filled up with pointers to the null list, but of course you can change it to be whatever you like.

1 Like

Thanks to Venno, I came to the realization that NPC units could also escape in FE7. I wrote a module for NPC pointers. Also, the enemy pointer module was edited from 66 entries to 47 since it went into NPC pointer territory. (My SF post was also updated with this info)

1
Enemy Escape Pointer Editor
0xB97100
47
4
Chapters.txt
NULL

Escape Pointer
0
4
NEHU


1
NPC Escape Pointer Editor
0xB971C0
47
4
Chapters.txt
NULL

Escape Pointer
0
4
NEHU

For completion, here is the escape data for FE6:
Escape tile coordinates start at address 0x10D9A8
Enemy pointer table at 0x5C86B8
NPC pointer table at 0x5C876C
In-game chapters only use a single coordinate, although the game can support multiple coordinates.

2 Likes

I guess I never doc’d it, but I made macros for these that have been shipping with EA since I started fiddling with it. It’s in EAstdlib and the file looks like this:

//Escape Point Macro
#ifdef _FE7_

#ifndef EscapePointTableOffset
#define EscapePointTableOffset 0xB97100
#endif

#ifndef NPCEscapePointTableOffset
#define NPCEscapePointTableOffset 0xB971C0
#endif

#endif


#ifdef _FE8_

#ifndef EscapePointTableOffset
#define EscapePointTableOffset 0x5A8188
#endif

#ifndef NPCEscapePointTableOffset
#define NPCEscapePointTableOffset 0x5A828C
#endif

#endif


#define MoveLeft 0x0
#define MoveRight 0x1
#define MoveDown 0x2
#define MoveUp 0x3
#define NoMove 0x5

#define TerminateEscapePoints "WORD 0xFF"
#define EscapePointEnd "WORD 0xFF"

#define EscapePoint(xLoc, yLoc, exitAnimation) "BYTE xLoc yLoc exitAnimation 0x00"

#define EscapePointPointerTable(entry, pointer) "PUSH; ORG EscapePointTableOffset+(4*entry); POIN pointer; POP"
#define NPCEscapePointPointerTable(entry, pointer) "PUSH; ORG NPCEscapePointTableOffset+(4*entry); POIN pointer; POP"