This routine is super important for AI execution.
Writes command data to 0203A97C
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
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.
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.