Emergent Factions - M2TW
General Information
In the vanilla Medieval II - Total War game, two factions (the Mongols and the Timurids) emerge after the start of the game. There are some similarities between the mechanism used to do this and the way the Slavs emerge in Barbarian Invasion - see here for description of that, however there are a number of important differences.
The most important and useful difference is that in M2TW a faction can be made to emerge in a region which is in the middle of the map, simply use it's internal region name in the emergence trigger. (In BI only regions that bordered the edge of the map could be used)
When and where the Mongols and Timurids enter the game is controlled within the campaign_script.txt file and the descr_events.txt file.
A randomly timed warning event is included in the descr_events.txt file
; ------------ CORE GAME EVENT -------------- event historic mongols_invasion_warn date 128 144
that event triggers a new event in the campaign script
;-- Mongols invasions -- monitor_event EventCounter EventCounterType mongols_invasion_warn and EventCounter > 0 ; ADD SCOUTING INVASION add_events event counter mongols_invasion date 4 8 end_add_events if I_EventCounter mongols_invasion_warn == 2 terminate_monitor end_if end_monitor
the counter related to that then triggers the emergence in the next piece of script.
Making Other Factions Emerge
Factions other than the Mongols and Timurids can be made to emerge in M2TW, to do so they must be included in descr_strat.txt without settlements, armies or family trees; all that is required there is similar entry to Mongols eg:
faction mongols, balanced henry ai_label default dead_until_resurrected denari 10000 denari_kings_purse 3000
Note they must have the 'dead_until_resurrected' line in their faction section. Their faction name should be placed in the non-playable section at the top of the descr_strat file.
They must also have similar entry to Mongols in descr_sm_factions.txt
faction mongols, spawned_on_event culture middle_eastern religion islam ........ custom_battle_availability yes horde_min_units 10 horde_max_units 20 horde_max_units_reduction_every_horde 10 horde_unit_per_settlement_population 250 horde_min_named_characters 2 horde_max_percent_army_stack 80 horde_disband_percent_on_settlement_capture 0 horde_unit Mongol Infantry horde_unit Mongol Foot Archers horde_unit Mongol Heavy Archers horde_unit Mongol Heavy Lancers can_sap yes prefers_naval_invasions no can_have_princess no has_family_tree yes
the relevant sections needed are marked in bold. Unlike BI the units used, Mongol Infantry etc, do not have to be separately defined as 'horde_units', any units the faction has ownership of can be used.
The time and place of emergence has to be triggered either by descr_events.txt or the campaign_script.txt.
Triggering Emergence from descr_events.txt only
The easiest way to trigger emergence of a new faction is to use descr_events.txt directly to trigger the emergence. This does not provide as many options for applying randomisation and conditions as triggering from the campaign_script would, but is nice and easy to do.
Make sure faction is dead_until_resurrected in descr_strat.txt and has the hording entries in descr_sm_factions.txt. Then simply add to the descr_events.txt in your campaign folder:
event emergent_faction scotland date 2 5 region London_Province
or similar - that example makes Scotland emerge at random date between years 2 & 5 in the London_Province
(where London_Province is the region name for the area you want them to emerge in).
You also need to alter the historic_events.txt.strings.bin file in data/text to include an event message for their emergence - if you miss this stage game will CTD when the emergence event is triggered.
Use Alpaca's .strings.bin converter to generate text file and add appropriate TITLE and BODY lines for your faction, e.g.:
{THE_SCOTLAND_EMERGE_BODY} Blah, blah...... {THE_SCOTLAND_EMERGE_TITLE} Scotland Invade!
to historic_events.txt delete the old historic.events.txt.strings.bin and a new version will be generated when you run the game containing the added lines.