How to make enemies leave the map after looting chests/villages:
1. Define escape tiles
Escape tile format:
4 bytes: [x, y, exit, 00]
x = x coordinate of escape tile.
y = y coordinate of escape tile.
The top-left corner of the map is (0,0).
exit = Determines what animation is used when the enemy steps on the escape tile.
00 = Move left then disappear.
01 = Move right then disappear.
02 = Move down then disappear.
03 = Move up then disappear.
05 = Disappear without moving.
The game uses 00-03 for escape tiles located on the edges of the map. 05 is used on escape tiles located on stairs.
Create a sequence of escape tiles and then terminate it with FF 00 00 00.
Example - Chapter 7x escape points (01, 01, stairs) and (03, 01, stairs):
01 01 05 00 03 01 05 00 FF 00 00 00
The escape tiles used in FE7 chapters begin at address 0x1D3974.
2. Set chapter pointer to escape tiles
Each chapter has a pointer for escape tile data. The pointer locations
start at0xB97100. The pointers are stored in the same order as
the chapters in the Chapter Data Editor nightmare module.
Simple nightmare module for modifying pointers.
Chapters without escape tiles point to FF 00 00 00.
FE7 chapters without escape tiles point to the FF 00 00 00 located at address 0x1D3A5C.
3. Set enemy AI bytes with Chapter Unit Editor
AI byte 1 - Aggression Factor
00 = Attack or steal from player units that are in-range.
06 = Do not attack or steal from player units.
AI byte 2 - Looting and Escaping
04 = Open/loot doors-chests-villages. After no more targets, remain on the map and attack player units.
05 = Open/loot doors-chests-villages. After no more targets, move towards nearest escape tile.
0C = Immediately start moving towards escape tiles. Ignore player units.
The standard in-game Brigand uses 00 + 04 for their first two AI bytes.
The standard in-game Thief uses 06 + 05 for their first two AI bytes.
Other phase units can open/loot, but they won't escape.
You can't give enemies specific targets, so you have to manipulate their behavior through door/chest placement, starting position, inventory, and escape tile locations. Be careful with door placement. Even if all chests are opened, an enemy will go after unopened doors (instead of escaping) if the enemy still has Door Keys or Lockpicks. However, an enemy will ignore unopened doors and begin to escape if inventory becomes full.
Okay. Thanks for reading.