So, I've found the weirdest of bugs.
I have this event with event ID 0x4 (which triggers AFEV 0x76, but it isn't important here) that occurs when you engage any enemy in combat. I play my chapter normally, triggering the event, and nothing strange happens until a certain unit dies. Look, I have these two troubadours. The second one (lvl.11) is the one causing the problem.
1) UNIT 0x99 0x4B 0x00 Level(12,Enemy,True) [1,12] 0x00 0x00 0x01 megarepo15 [0xA1] [0x00,0x12,0x02,0x00]
2) UNIT 0x99 0x4B 0x00 Level(11,Enemy,True) [1,15] 0x00 0x00 0x01 megarepo16 [0xA1] [0x00,0x12,0x02,0x00]
It's identical to the other one (barring the level) but the problem occurs if:
- the second troubadour dies
- you close and reopen your emulator
- you move any unit on the map
In that case, the event associated with event ID 0x4 plays again, even if event 0x4 should be already triggered! I've closed/opened the ROM a hundred times, but it definitely happens only when that troubadour dies.
I'm already trying to fix this with some workarounds, but... huh, it's really weird.
Edit: Fixed. I had literally made a single-digit mistake in more than 3700 lines of code-- took 6 hours to hunt that down.