COMMANDER (CO)
RECEIVER

Commanders ERM support
(!?CO# trigger occurs when open|close commander dialog, buy or revive commander.)

!!CO#:XXXX;
!#CO
#:XXXX;
   #=-4 - Apply to all Commanders at defending side
   #=-3 - Apply to all Commanders at attacking side
   #=-2 - Apply to all Commanders
   #=-1 - Apply to current Commander (for current hero)
   #>=0 - Apply to specific Commander

Every Commander has the same number as its hero-owner

A1/#1/#2; Add a Commander artifact by type
  #1 - artifact type (from 146...155)
  #2 - number of won battles
Results:
   v1=0 - artifact added
   v1=1 - not a Commander artifact
   v1=3 - Commander has this artifact already
   v1=4 - no free slot
A2/#1; Remove a Commander artifact by type
  #1 - artifact type (from 146...155)
Results:
   v1=0 - artifact is removed
   v1=1 - Commander does not have this artifact
A3/#1/$1/$2; Control a Commander artifact in a slot
  #1 - artifact slot (0...5)
  $1 - artifact type (from 146...155)
  $2 - number of won battles
Results:
You may get/check or set artifact and/or number of won battles.
No additional checks is made for artifact type so be careful to avoid incorrect types or duplication.
A4; A4/$1/$2/$3/$4/$5/$6/$7/$8/$9/$10/$11/$12;
- Control Commander artifacts in all slots
  $1 - artifact type (from 146...155) in slot 0
    $2 - number of won battles for art in slot 0
  $3 - artifact type (from 146...155) in slot 1
    $4 - number of won battles for art in slot 1
  $5 - artifact type (from 146...155) in slot 2
    $6 - number of won battles for art in slot 2
  $7 - artifact type (from 146...155) in slot 3
    $8 - number of won battles for art in slot 3
  $9 - artifact type (from 146...155) in slot 4
    $10 - number of won battles for art in slot 4
  $11 - artifact type (from 146...155) in slot 5
    $12 - number of won battles for art in slot 5
Results:
You may get/check or set artifacts and/or number of won battles.
No additional checks are made for artifact type so be careful to avoid incorrect types or duplication.
Comments:
May not be applied to all Commanders (-2).
B#/$1/$2; Special Bonus
   # - Type of set
         0 - All spec bonuses at once
         1 - One specific special bonus
         2 - All spec bonuses disabling at once
         3 - One specific spec bonus disabling

You can see which extra abilities the Commander will receive below
B0/$; Special Bonus : all spec bonuses at once
   $ - mask as a sum of (bit dependent):
         0 - AT+DF bonus bit value is 1
         1 - AT+HP bonus bit value is 2
         2 - AT+DM bonus bit value is 4
         3 - AT+MP bonus bit value is 8
         4 - AT+SP bonus bit value is 16
         5 - DF+HP bonus bit value is 32
         6 - DF+DM bonus bit value is 64
         7 - DF+MP bonus bit value is 128
         8 - DF+SP bonus bit value is 256
         9 - HP+DM bonus bit value is 512
         10 - HP+MP bonus bit value is 1024
         11 - HP+SP bonus bit value is 2048
         12 - DM+MP bonus bit value is 4096
         13 - DM+SP bonus bit value is 8192
         14 - MP+SP bonus bit value is 16384
   bit=1 if has and 0 if not

You can see which extra abilities the Commander will receive below
B1/$1/$2; Special Bonus : One specific special bonus
   $1 - number of bonus (0...14)
   $2 - has(1) or not(0)

You can see which extra abilities the Commander will receive below
B2/$; Special Bonus : All specific bonuses disabling at once
   $ - mask as a sum of (bit dependent):
bit=1 if may have and 0 if not
B3/$1/$2; Special Bonus : One specific spec bonus disabling
   $1 - number of bonus (0...14)
   $2 - may have(1) or not(0)
Comments.
You may apply any command to all Commanders but only to set values.
For every specific Commander you can set/check/get as usual.
D$; Dead/Alive Commanders
   1 - Dead
   0 - Alive
E$; Enable/disable Commander(s)
   -1 - Disabled
   0 - Can be hired
   1 - Exists
< /td>
H$; Owner Hero's type
see Format HC
N$; Set/get the name of Commander
You can set or get the name of Commander.
   $ - Number of z vars (1...1000,-1...-10)
You can change z vars after the usage (the name is copied inside Commander structure).
You cannot use this command for all Commanders.
P#/$; Commander statistics
   # - type of statistics
         0 - Attack
         1 - Defense
         2 - Hit Points
         3 - Damage
         4 - Magic Power
         5 - Speed
         6 - Magic Resistance
   $ - value
P$;

Set/check/get the "Custom Primary Skill Control".
   $ = 0 - Disabled
   $ = 1 - Custom control enabled
If you set it to 1 (yes), the primary skill will not change with Commander improvement, they will stay as you set them. It applied only to the basic values, so if you have one of the basic skill improved, it will add the value to the primary skill you set. 
If it is 0, the HP and DM primary value will grow automatically with Commander levels.

S#/$; Commander basic skills level
   # - Type of the basic skill
         0 - Attack
         1 - Defense
         2 - Hit Points
         3 - Damage
         4 - Magic Power
         5 - Speed
         6 - Magic Resistance
   $ - Value
(Magic Resistance normally advances simultaneously when a Commander gains Magic Power skill through experience, but you must set Resistance separately if you advance the skill through ERM.)
T$; Commander type (0...8) see Format CC
X#/$; Commander experience
   # - type of experience
         0 - Hero's Exp taken as a basic for the next level
         1 - Current Commander exp
         2 - Current Commander Level
   $ - Value (see Format HL)


USING COMMANDERS WITH ERM

  All Commanders that will be placed on a map with ERM will have the same primary and secondary skills and the same statistic (but ability depends on a type of them). Actually it is one Commander that may have many looks.
   If you do not set any parameters for such Commanders, they will have default game start up parameters. So if you want it more powerful, use the CO receiver. To apply all changes to only these additional Commanders use index -3 (all Commanders at attacking side) and -4 (all commanders at defending side).
   In order to make it into a "real" Commander you must set it to "alive" with the CO receiver and you should also set its type. You can give any Commander special abilities or set any Commander stats as you would for a normal Commander.
   If you DON'T set a Commander to alive with the CO receiver, it will instead be a "monster Commander" and will always have Fly and Shooting abilities. Stats and other abilities for these "monster" Commanders must then be set with other ERM commands and not the CO receiver.
   Note, that you can set all in the BA0/BA50 trigger section or later in the battle. All settings will be lost after a battle and will not be saved in the saved game.
   Also, to be sure that all goes fine, please place a corresponding set of Commanders at attacker's side (174...182) and defender's side (183...191).


Table of commander extra abilities

0 - Attack + Defense: Reduce Enemy Defense by 50%
1 - Attack + Hit Points: Fearsome
2 - Attack + Damage: Maximum Damage
3 - Attack + Magic Power: No Enemy Retaliation
4 - Attack + Speed: Shooting Ability
5 - Defense + Hit Points: Unlimited Retaliation
6 - Defense + Damage: Strike All Enemies Around
7 - Defense + Magic Power: Permanent Fire Shield
8 - Defense + Speed: Block Physical Damage
9 - Hit Points + Damage: Strike Twice
10 - Hit Points + Magic Power: Attack may Paralyze
11 - Hit Points + Speed Regenerate: 50 HP each round
12 - Damage + Magic Power: Deathstare
13 - Damage + Speed: Champion Distance Bonus
14 - Magic Power + Speed: Ignore Obstacles (Fly)