I was looking for a way to make the enemies trigger the Game Over screen if they seized the throne/gate, but I didn’t know if that required ASM or something fancy like that.
Luckily I figured out a simple way to make a “if enemy reaches the throne is Game Over”
First, you set up the AREA event:
MiscBasedEvents:
AREA eventID eventPointer [X,Y] [X,Y]
END_MAIN
eventID has to be an unique ID.
Then the event:
eventPointer:
CHECK_ALLEGIANCE 0xFFFF
SVAL 0x7 0x02
BEQ 2 0x7 0xC
ENUF eventID
GOTO 1
LABEL 2
GameOver
LABEL 1
EVBIT_T 0x7
ENDA
Ok, CHECK_ALLEGIANCE returns 0x00 if the unit is Ally, 0x01 if it’s NPC and 0x02 if it’s enemy. We use 0xFFFF to check the allegiance of the unit that triggered the event.
If the unit is not an enemy, then we turn off the flag so it can be triggered again (this is in case a non-enemy unit waits at the throne)
In the Label 2 you can set any event you want (conversations, tile changes, etc.) and the last thing is the GameOver (or you can remove that and set any other event as you like)
Finally, the enemy AI.
Byte 2 in the enemy AI controls the movement, and conveniently there’s a byte to make the enemies move towards the Throne/Gate.
[AI1,0x0D,AI3,AI4]
0x0D is the required byte. I haven’t tested all the AI combinations, but so far the Attack/Don’t attack bytes work fine, as well as all recovery bytes.
And that’s it. Now you can make surprise reinforcements that will ruin the player’s strategy because they forgot to put someone in the throne.
Side notes:
If you want this for an specific point of the map and not a throne/gate, set 0x10 for the AI2 byte, that makes units to move to the point [15,17] by default, just change the values at 0x5A90C0 and 0x5A90C1 for the coordinates you want. I haven’t tried this, but it should work.
I hope this might be helpful for someone.