Okay, i'll try to explain in a few words (from what is possible) and with my poor english, what i have found out so far, in many hours of testing until now, about the ai-invasion mode behavior of hordes. The following text is not about the basics of invasions and nearly useless for beginners. But advanced users must admit that such post like this, containing all fundamental know-how about invasions and important answers to never answered questions, has never been written in this complexity.
When we're talking about the invasions in modding terms, so the invasion begins here:
After emerging a "spawned_on_event" marked faction (in descr_sm_factions.txt), with the "faction_emerge" command (in campaign_script.txt), they begin to act in horde-mode. They remain in this solely horde-mode, until they conquered at least one settlement. After successfully conquering their first horde target settlement (horde_target in descr_regions.txt), they are leaving their horde mode and become a normal faction. Only from this point we can finally influence them by the assigned Ai-script-section (in descr_campaign_ai_db.xml) and by their faction standings (in descr_strat.txt).
Optimal horde-mode behavior sequence:
1. Horde leader spawned after "faction_emerge" command...
2. ... in outer east coord. for the east map border regions-outer north for north map border regions etc...
2b. or at random coord. in the other middle map regions
3. immediately decides for a valid horde-target settlement and move towards this
4. horde reinforcement spawning
5. horde reinforcement and Horde leader move on to meet each other
6. together they move towards the previous selected horde target
7. they change route and move towards each army in sight they want to attack. Then returning to point #5
8. they attack and sack settlements (no conquer) on their way (sometimes even not on their straight route)
9. finally, after many of those above distractions (when they are still alive), they arrive at the horde-target and give their best (...and rest) to occupy this settlement
10. after successfully conquerring this settlement, they settle down and begin to act as a normal faction
Influences points for the AI-Horde-mode behavior in order of relevance:
1a. Valid horde target in therms of distance and accessibility.
1b. Right Ai pathfinding calculation to the targed due to mapping.
1c. When using the vanilla-invasion-structure in campaign_script.txt, what i suggest you to do, then spawn points (for Horde leader & reinforcements), reposition_character command and I_CharacterTypeNearTile condition distance must be adapted to your map
2. horde settings in descr_campaign_db is fundamental, too.
3. horde settings in descr_sm_factions = horde strenght must be adapted to the goals and to the enemy strenght present in campaign.
4. spotting range of generals and horde-leader
Horde-mode side notes:
A. The distance between a horde-target-settlement to the first horde spawn point, from where the horde leader spawn, must (very important) be within around maximal 75 tiles to be valid. (tiles = pixel in map_regions.tga)
B. new spawned horde reinforcements and faction leader will be moved immediately to meet each other
C. new spawned horde faction leader, never considers to attack the settlement in the spawning region in the first rounds!? = (edit: depends definitely on horde settings in descr_campaign_db)
D. ATM it seems that ai-horde selects the nearest horde target from their spawning point!? = (edit: this also depends on horde settings indescr_campaign_db)
E. new spawned horde faction leader, who is not moving in his first rounds, seems to had encountered issues which remain (not valid horde target) more or less for the rest of their campaign (or horde-mode existence) and for their later reinforcements, too!
F. once a horde target settlement has been conquered and the horde settled down to become a normal faction, the other horde targets has no more relevancy for them, because they're no more a horde.
G. inital faction standings seems not to influence horde
H. victory conditions seems not to influence horde
The secret key of the Ai-horde-mode-behavior is for sure the right mix-up of all this components adapted to every single given strategy map.
I've found out that there was a scripted possibilty to let spawn our self made named-character within the 'faction_emerge' command as horde-leader! So we can make use of him in scripts, as we would like do with the other named characters.
I've worked and tweaked a bit the descr_campaign_db, too. Some entries are not, what their names are supposed to be, and some are not, what comments suggested in some other threads.
The Mongols invasion is working perfectly now. In about more than 200 testing games, only 1 time i've observed the horde doing nothing, but this one seems to be caused by the famous normal Ai issue.
Sample of good working horde settings in my descr_campaign_db.xml:
<hordes>
<end_target_faction_bonus int="-300"/>
<start_target_faction_bonus int="-500"/>
<farming_level_bonus int="-50"/>
<shared_target_bonus int="-1000"/>
<disbanding_horde_bonus int="-500"/>
<starting_region_bonus int="300"/>
<horde_target_resource_bonus int="1000"/>
</hordes>
At this point i've successfully reached my mission goal to make the horde working nearly perfect and sharing my knowledge about it with you, because i'm a good guy ... who wanna earn some reps.
BASICS added:
To mark a region as horde target you must add the line horde_target under the hidden resource line in the >descr_regions.txt<
.....................................................................................................................................................