AI
RECEIVER

The AI receiver gives you a measure of control over AI movement. You can use it to influence or even force AI heroes to move to certain map locations.

Depending on the value you set, the AI may deviate along the way to pick up treasures, attack weaker monsters or heroes, claim mines or even take over a castle. Even using a maximum importance value, the AI can't ALWAYS be controlled if circumstances weigh heavily against it moving in a certain direction (e.g., it has 500 phoenixes, has lost its last town and there is an undefended castle nearby), but usually it can be counted on.

One possible use of this receiver is to set up a sequence of way points so that an AI hero will patrol in a fixed pattern. Another more devious use is to reset the destination points each turn or each time a hero movement trigger is called, linking them to the position of a player's hero. This will cause an AI hero to pursue the player's hero relentlessly.

!!AI:XXXX; Set destination points for AI heroes to move to.

OPTIONS

S#1/#2/#3/$1/$2/$3/$4/$5;
 
Set up new destination point
   #1 = Number of the hero (See Format H). (-1=any)
   #2 = Owner of the hero (Format E1) (-1=any)
   #3 = Sequence Number (in the sequence of destination points)
   $1 = x position
   $2 = y position
   $3 = map level
   $4 = Value is an Importance value for the AI:
            5000000 - very important
            500000 - valuable
   $5 = Flags. Value means:
            0 - no flag set
            1 - start with this position first
            2 - do not delete the position after arriving
            3 - start with this position and do not delete the position after arriving
Comments : 
1. The sequence works this way.
If you set destination points with seqnums:
2,4,5,6,88,99
and set flag 1 for seqnum 6, the hero will run the next points:
6,88,99,2,4,5 
and then if some of them have "do not delete" flag (example 88,4,5),
the hero will run to:
88,4,5,88,4,5,88,4,5...
2. You can set any owner (-1) and this mean that the hero will run the destination point whoever owns the hero.
3. You can set any hero (-1) and this means that all heroes of the owner will run to destination points.
4. If the last position is also the first position and is set to not delete after arriving, a phantom clone of the hero may appear on the map. If you need to make a patrol circuit, you can avoid this by setting an extra position one square over from the start position as the end position instead.
5. If a specific hero isn't specified and there are multiple destination points, the first AI hero will move towards the first one. After that hero's movement is done, the second hero will continue where it left off, perhaps moving towards the next destination point. For this reason, it's often a good idea to specify a specific hero to avoid too much chaos.
D#1/#2/#3;
 
Delete a destination point
   #1 = Number of the hero. (Format H) (-1=any)
   #2 = Owner of the hero (Format E1) (-1=any)
   #3 = Number of a sequence of destination points
            #=-1, delete all points in sequence for this hero and owner