BATTLEGROUND ACTIONS (BG)
RECEIVER

During combat, you may check/set/get parameters on actions taken by a monster stack. These receivers may be used/called only in the !?BG trigger section.

Note: Now a usage of !!BG, !!BM, !!BH, !!BU, !!BF in complete AI battle is controlled in the ERM interpreter and you will get the corresponding error message.

!!BG:XXXX; During combat, you may check/set/get parameters on taken action

OPTIONS

A$; Type of an action:
   0 = Cancel Action (the stack can do a different action now but it may still be impossible to force it to do most actions through ERM).
   1 = Hero cast a spell
   2 = Walk
   3 = Defend
   4 = Retreat from the battle
   5 = Surrender
   6 = Walk and Attack
   7 = Shoot 
   8 = Wait
   9 = Catapult
 10 = Monster casts a spell (i.e. Faerie Dragons)
i.e !!BG:A10; will make current stack cast a spell set with !!BG:S$;
D$; Destination position (magic to monster, walk or attack to)
E$; Get a destination monster stack (destination position is used). 
-1 if no monster stack at that position
H$; Number of a hero owner (-1=no hero)
N$; Number of a stack (0...41)
Q?$;  Current attacking side (0=left or 1=right)
Check only!
S$; Number of a Spell to Cast (See Format SP)
Comments:
If a monster casts a spell before an action (enchanter magic or Troll resurrection), it goes before trigger.