CASTLE DEMOLITION (CD)
RECEIVER

Used to set up the parameters for town demolitions initiated by a player.

!!CD:XXXX; Used to set up the parameters for town demolitions initiated by a player.

OPTIONS

A$1/$2/$3; Lets you set up a Hero's army minimum HP to break a particular building type in particular town.
   $1=town type (see Format T)
   $2=building type (see Format U)
   $3=HP of all Hero's army
B0/#1/#2/$; Enable/disable building
    #1 - town type (Format T)
    #2 - structure index (Format U)
    $ - flag, 0=disabled, 1=enabled
Tests indicate that this receiver doesn't work at all, or syntax is wrong. No idea wht to do with that.
B1/#1/#2/$1/$2; Set/check/get building dependences
    #1 - town type (Format T)
    #2 - structure index (Format U)
    $1 - dword 0 representing dependencies
    $2 - dword 1 representing dependencies
Every set bit in $1 (dword 0) or in $2 (dword 1) means that this structure may be build only when a structure represented by this bit is built.
Example: $1=0x00000024 means that this structure may be build only when Magic Guild Lvl 3 and Tavern both built.
Tests indicate that this receiver doesn't work at all, or syntax is wrong. No idea wht to do with that.
B2/#1/#2/#3/#4...; Set building dependences
    #1 - town type (Format T)
    #2 - structure index (Format U)
    #3 - structure index that #2 is depended of
    #4 - structure index that #2 is depended of
You may add up to 14 dependencies. You cannot check or get it with this command, use B1 for it.

Tests indicate that this receiver doesn't work at all, or syntax is wrong. No idea wht to do with that.
B3/#1/#2/$1/$2; Set/check/get exclusive buildings
    #1 - town type (Format T)
    #2 - structure index (Format U)
    $1 - dword 0 exclusive buildings
    $2 - dword 1 exclusive buildings
If this structure is built all exclusive structures will be removed from the town screen. Syntax same with B1.
Tests indicate that this receiver doesn't work at all, or syntax is wrong. No idea wht to do with that.
B4/#1/#2/#3/#4...; Set exclusive buildings
    #1 - town type (Format T)
    #2 - structure index (Format U)
    #3 - number of exclusive structure
    #4 - number of exclusive structure
You may add up to 14 dependencies. If this structure is built all exclusive structures will be removed from the town screen. Syntax same with B2.
Tests indicate that this receiver doesn't work at all, or syntax is wrong. No idea wht to do with that.
D$;    $=number of demolitions allowed per day
E$1/$2/$3; Lets you set up a Hero's minimum experience level required to break a particular building type in particular town.
   $1=town type (see Format T)
   $2=structure index (see Format U)
   $3=experience
M$;    $=Hero's movement to lose per demolished building.
N$1/$2;    $1=number of demolition in one day
   $2=cost to break next building on the same day
P$1/$2/$3/$4/$5;  Used to set up a square on the map where the battle with these monsters will take place (as though it were really there) when you break their dwelling. This may be used for adjusting a terrain type and terrain bonus during the battle. Nothing more.
   $1=monster number inside town (0...7 basic, 8...13 upgraded)
   $2=x
   $3=y
   $4=l
   $5=relative(1)/absolute(0) coordinates

What's happen when you destroy completely your town and there are two heroes inside it?
External (visiting) hero has no choice just to go away for 6 days.
Internal Hero will be lost for owner :-) He become a nobody's hero.
He always stays inside and protect the town from everyone. If he wins,
he will gain experience :-)

Can the AI destroy towns?
AI cannot destroy a town at this time. The problem is that it's hard to formulate rules for this (though it is possible). If you want AI to break towns, you should use ERM script (take control when AI visits a town, decide for him what to do and break it yourself).
But AI will rebuild town including changing it to a native hero's town type.