A Guide to the export_descr_buildings.txt file
This guide assumes that you have unpacked the data files using the method found here: http://medieval2.heavengames.com/m2t...er/index.shtml
Once you have successfully created your own units, you may be wondering how to get them into the campaign. Or perhaps you want to edit a particular building to fit your exact needs – maybe make it stronger, weaker, or more unique. This is the guide for you. First, a word on the way that the game handles buildings. Buildings are in “lines” such as the “Cannons” line. Each line is a group of buildings that have similar functions and are upgradeable from one to the next. For example, the “Cannons” line consists of the Gunsmith, Cannon Maker, Cannon Foundry, and Royal Arsenal. Once you have built a Gunsmith in one of your cities, then you can upgrade it into a Cannon Maker, then a Cannon Foundry, and so on. When you convert a city to a castle or vice versa, some lines have a corresponding line in the castle which they switch to. If there is no corresponding line, then they are destroyed. For example, the Cannons line corresponds to another Cannons line created specifically for castles, referred to as castle_cannon in the game files, as opposed to cannon. Definitions in the export_descr_buildings, or EDB are broken into these “lines” like so:
building cannon
{
convert_to castle_cannon
levels gunsmith cannon_maker cannon_foundry royal_arsenal
{
gunsmith city requires factions { northern_european, middle_eastern, eastern_european, greek, southern_european, } and event_counter gunpowder_discovered 1
{
convert_to 0
capability
{
recruit_pool "NE Bombard" 1 0.4 3 0 requires factions { england, scotland, france, hre, denmark, spain, portugal, milan, venice, papal_states, sicily, }
recruit_pool "EE Bombard" 1 0.4 3 0 requires factions { poland, russia, hungary, }
recruit_pool "GR Bombard" 1 0.4 3 0 requires factions { byzantium, }
recruit_pool "ME Bombard" 1 0.4 3 0 requires factions { moors, egypt, turks, }
recruit_pool "AS Rocket Launcher" 1 0.4 3 0 requires factions { mongols, }
recruit_pool "AS Bombard" 1 0.4 3 0 requires factions { timurids, }
}
material wooden
construction 3
cost 800
settlement_min city
upgrades
{
cannon_maker
}
}
cannon_maker city requires factions { northern_european, timurids, egypt, moors, turks, eastern_european, southern_european, } and event_counter gunpowder_discovered 1
{
convert_to 1
capability
{
recruit_pool "NE Mortar" 1 0.4 3 0 requires factions { england, scotland, venice, papal_states, sicily, }
recruit_pool "NE Grand Bombard" 1 0.4 3 0 requires factions { france, hre, spain, portugal, milan, }
recruit_pool "NE Ribault" 1 0.4 3 0 requires factions { denmark, }
recruit_pool "EE Ribault" 1 0.4 3 0 requires factions { poland, hungary, }
recruit_pool "EE Grand Bombard" 1 0.4 3 0 requires factions { russia, }
recruit_pool "ME Grand Bombard" 1 0.4 3 0 requires factions { moors, egypt, turks, }
recruit_pool "AS Grand Bombard" 1 0.4 3 0 requires factions { timurids, }
recruit_pool "NE Ribault" 1 0.4 3 0 requires factions { england, scotland, spain, portugal, milan, venice, papal_states, sicily, }
recruit_pool "NE Bombard" 1 0.4 3 0 requires factions { england, scotland, france, hre, denmark, spain, portugal, milan, venice, papal_states, sicily, }
recruit_pool "EE Bombard" 1 0.4 3 0 requires factions { poland, russia, hungary, }
recruit_pool "GR Bombard" 1 0.4 3 0 requires factions { byzantium, }
recruit_pool "ME Bombard" 1 0.4 3 0 requires factions { moors, egypt, turks, }
recruit_pool "AS Rocket Launcher" 1 0.4 3 0 requires factions { mongols, }
recruit_pool "AS Bombard" 1 0.4 3 0 requires factions { timurids, }
weapon_naval_gunpowder 1
}
material wooden
construction 4
cost 1600
settlement_min large_city
upgrades
{
cannon_foundry
}
}
cannon_foundry city requires factions { northern_european, egypt, timurids, moors, turks, eastern_european, southern_european, } and event_counter gunpowder_discovered 1
{
convert_to 2
capability
{
recruit_pool "NE Culverin" 1 0.4 3 0 requires factions { england, scotland, france, spain, portugal, milan, venice, papal_states, }
recruit_pool "NE Cannon" 1 0.4 3 0 requires factions { hre, sicily, }
recruit_pool "NE Serpentine" 1 0.4 3 0 requires factions { denmark, }
recruit_pool "EE Serpentine" 1 0.4 3 0 requires factions { poland, hungary, }
recruit_pool "EE Cannon" 1 0.4 3 0 requires factions { russia, }
recruit_pool "ME Cannon" 1 0.4 3 0 requires factions { moors, egypt, turks, }
recruit_pool "AS Cannon" 1 0.4 3 0 requires factions { timurids, }
recruit_pool "NE Serpentine" 1 0.4 3 0 requires factions { france, hre, }
recruit_pool "NE Cannon" 1 0.4 3 0 requires factions { denmark, }
recruit_pool "EE Cannon" 1 0.4 3 0 requires factions { poland, }
recruit_pool "NE Mortar" 1 0.4 3 0 requires factions { england, scotland, venice, papal_states, sicily, }
recruit_pool "NE Grand Bombard" 1 0.4 3 0 requires factions { france, hre, spain, portugal, milan, }
recruit_pool "NE Ribault" 1 0.4 3 0 requires factions { denmark, }
recruit_pool "EE Ribault" 1 0.4 3 0 requires factions { poland, hungary, }
recruit_pool "EE Grand Bombard" 1 0.4 3 0 requires factions { russia, }
recruit_pool "ME Grand Bombard" 1 0.4 3 0 requires factions { moors, egypt, turks, }
recruit_pool "AS Grand Bombard" 1 0.4 3 0 requires factions { timurids, }
recruit_pool "NE Ribault" 1 0.4 3 0 requires factions { england, scotland, spain, portugal, milan, venice, papal_states, sicily, }
recruit_pool "NE Bombard" 1 0.4 3 0 requires factions { england, scotland, france, hre, denmark, spain, portugal, milan, venice, papal_states, sicily, }
recruit_pool "EE Bombard" 1 0.4 3 0 requires factions { poland, russia, hungary, }
recruit_pool "GR Bombard" 1 0.4 3 0 requires factions { byzantium, }
recruit_pool "ME Bombard" 1 0.4 3 0 requires factions { moors, egypt, turks, }
recruit_pool "AS Rocket Launcher" 1 0.4 3 0 requires factions { mongols, }
recruit_pool "AS Bombard" 1 0.4 3 0 requires factions { timurids, }
weapon_naval_gunpowder 1
}
material wooden
construction 5
cost 3200
settlement_min huge_city
upgrades
{
royal_arsenal
}
}
royal_arsenal city requires factions { hre, france, turks, hungary, russia, venice, milan, portugal, spain, } and event_counter gunpowder_discovered 1
{
convert_to 3
capability
{
recruit_pool "NE Basilisk" 1 0.4 3 0 requires factions { france, hre, spain, portugal, }
recruit_pool "NE Monster Ribault" 1 0.4 3 0 requires factions { milan, venice, }
recruit_pool "EE Basilisk" 1 0.4 3 0 requires factions { russia, hungary, }
recruit_pool "ME Monster Bombard" 1 0.4 3 0 requires factions { turks, }
recruit_pool "NE Culverin" 1 0.4 3 0 requires factions { england, scotland, france, spain, portugal, milan, venice, papal_states, }
recruit_pool "NE Cannon" 1 0.4 3 0 requires factions { hre, sicily, }
recruit_pool "NE Serpentine" 1 0.4 3 0 requires factions { denmark, }
recruit_pool "EE Serpentine" 1 0.4 3 0 requires factions { poland, hungary, }
recruit_pool "EE Cannon" 1 0.4 3 0 requires factions { russia, }
recruit_pool "ME Cannon" 1 0.4 3 0 requires factions { moors, egypt, turks, }
recruit_pool "AS Cannon" 1 0.4 3 0 requires factions { timurids, }
recruit_pool "NE Serpentine" 1 0.4 3 0 requires factions { france, hre, }
recruit_pool "NE Cannon" 1 0.4 3 0 requires factions { denmark, }
recruit_pool "EE Cannon" 1 0.4 3 0 requires factions { poland, }
recruit_pool "NE Mortar" 1 0.4 3 0 requires factions { england, scotland, venice, papal_states, sicily, }
recruit_pool "NE Grand Bombard" 1 0.4 3 0 requires factions { france, hre, spain, portugal, milan, }
recruit_pool "NE Ribault" 1 0.4 3 0 requires factions { denmark, }
recruit_pool "EE Ribault" 1 0.4 3 0 requires factions { poland, hungary, }
recruit_pool "EE Grand Bombard" 1 0.4 3 0 requires factions { russia, }
recruit_pool "ME Grand Bombard" 1 0.4 3 0 requires factions { moors, egypt, turks, }
recruit_pool "AS Grand Bombard" 1 0.4 3 0 requires factions { timurids, }
recruit_pool "NE Ribault" 1 0.4 3 0 requires factions { england, scotland, spain, portugal, milan, venice, papal_states, sicily, }
recruit_pool "NE Bombard" 1 0.4 3 0 requires factions { england, scotland, france, hre, denmark, spain, portugal, milan, venice, papal_states, sicily, }
recruit_pool "EE Bombard" 1 0.4 3 0 requires factions { poland, russia, hungary, }
recruit_pool "GR Bombard" 1 0.4 3 0 requires factions { byzantium, }
recruit_pool "ME Bombard" 1 0.4 3 0 requires factions { moors, egypt, turks, }
recruit_pool "AS Rocket Launcher" 1 0.4 3 0 requires factions { mongols, }
recruit_pool "AS Bombard" 1 0.4 3 0 requires factions { timurids, }
weapon_naval_gunpowder 1
}
material wooden
construction 6
cost 6400
settlement_min huge_city
upgrades
{
}
}
}
plugins
{
}
}
This text defines the entire cannon line of buildings. This part:
building cannon
{
convert_to castle_cannon
levels gunsmith cannon_maker cannon_foundry royal_arsenal
defines things that affect the entire building line. The first line:
building cannon
is formatted as building insert name of building line here. What we learn from this line is that this is the definition for the cannon line of buildings. The next line:
{
is a curly brace. This file uses curly braces to organize the building definitions.
The next line:
convert_to castle_cannon
Tells the game which line to convert the building line into if the entire settlement is converted to a castle (or city). If a building line does not have this parameter, then it will be destroyed in the conversion process, like a Bowyer.
The next line:
levels gunsmith cannon_maker cannon_foundry royal_arsenal
is all of the different buildings in the line, in ascending order – the first is the Gunsmith, then the Cannon Maker, and so on. In addition, there is sometimes a line that goes after the convert_to line that ties the building to a specific religion. It goes as follows:
religion orthodox
Available religions are:
catholic
orthodox
islam
pagan
heretic
After the line definition comes the individual building definitions in order, like the gunsmith definition:
{
gunsmith city requires factions { northern_european, middle_eastern, eastern_european, greek, southern_european, } and event_counter gunpowder_discovered 1
{
convert_to 0
capability
{
recruit_pool "NE Bombard" 1 0.4 3 0 requires factions { england, scotland, france, hre, denmark, spain, portugal, milan, venice, papal_states, sicily, }
recruit_pool "EE Bombard" 1 0.4 3 0 requires factions { poland, russia, hungary, }
recruit_pool "GR Bombard" 1 0.4 3 0 requires factions { byzantium, }
recruit_pool "ME Bombard" 1 0.4 3 0 requires factions { moors, egypt, turks, }
recruit_pool "AS Rocket Launcher" 1 0.4 3 0 requires factions { mongols, }
recruit_pool "AS Bombard" 1 0.4 3 0 requires factions { timurids, }
}
material wooden
construction 3
cost 800
settlement_min city
upgrades
{
cannon_maker
}
}
The first part is the building overview:
gunsmith city requires factions { northern_european, middle_eastern, eastern_european, greek, southern_european, } and event_counter gunpowder_discovered 1
This part determines whether the building is a castle or city building, as well as the name and requirements to build. You can have multiple requirements separated by an “and” or an “or”. My examples of code in this section should be added on if that is the only requirement for the building - if you want to add snippets of code on to existing buildings (if, for example, you want this requirement to be in addition to needing to play as a specific faction), replace the "requires" in my examples with an "and" or an "or". (Thanks EarendilElenthol for pointing this out!) A list of requirements:
Factions – requires factions { hre, }
You can make the construction of the building be restricted by faction or culture. Note that the list is enclosed in curly braces and has spaces before/after each curly brace. There is also a comma after each faction or culture. A list of faction names as they are in the files, separated by culture:
northern_european – england, france, denmark, scotland, hre (Holy Roman Empire), normans, saxons
southern_european – spain, portugal, milan, venice, papal_states, sicily, slave (The Rebels, but it doesn’t really matter since they “adapt” to the local culture)
eastern_european – poland, hungary, russia
greek – byzantium
middle_eastern – egypt, turks, moors, mongols, timurids
mesoamerican – aztecs
Events – requires event_counter first_piano 1
You can tie it in to any of the events in the game. If you put a 1 after event_counter, then the building may only be built after the event. If you put a 0, it can only be built before. Events are listed in the descr_events.txt in the campaign folder and include:
first_windmill
earthquake_in_aleppo
science_alchemy_book
first_european_paper
first_magnetic_compass
science_maths_zero_europe
mongols_invasion_warn
earthquake_in_silicia
first_mechanical_clock
gunpowder_discovered
first_eyeglasses
earthquake_in_alexandria
earthquake_in_alexandria_2
football_banned
first_sawmill
first_public_clock
science_weather_forecast
black_death_hits
black_death_1
black_death_2
black_death_3
black_death_4
first_blast_furnace
grote_mandenke
timurids_invasion_warn
first_piano
world_is_round
first_oil_painting
science_de_docta_ignorantia
first_printing_press
earthquake_in_naples
malleus_maleficarum
science_da_vinci_ornithopter
first_watch
Hidden Resource – requires hidden_resource arguin
Hidden resources are defined at the top of the EDB file. More on how to give them out and edit them in a later article. For now, here is a list of hidden resources:
sparta
rome
italy
america
atlantic
explorers_guild
swordsmiths_guild
woodsmens_guild
teutonic_knights_chapter_house
knights_of_santiago_chapter_house
crusade
jihad
arguin
horde_target
no_pirates
no_brigands
For example, the america hidden resource is used to ensure that the Spanish and Portuguese can only train Conquistadores in the New World.
Buildings – requires building_present_min_level urban_equestrian sultans_racing_track
This allows you to require that there is a certain level of building in the settlement. After the building_present_min_level, you put the building line, in this case Horse Racing, and then the level which it requires, in this case the Sultan’s Racing Track.
Religions – requires region_religion catholic 90
This Kingdoms-only line allows you to tie the requirement to a certain amount of religion. In the example, the building can only be built after 90% of the people in the region are Catholic.
The next part is more building-specific stuff.
{
convert_to 0
capability
The “convert_to 0” tells the game which building in the opposite line that this building converts to. The number always has 1 subtracted from it. In this example, the gunsmith converts to the first building in the castle_cannon line, the c_gunsmith. There is sometimes a line that comes right after this that ties the building to a specific religion, allowing it to spread that religion. The capability line is necessary, as it introduces the next part of the definition. This is the capabilities part:
{
recruit_pool "NE Bombard" 1 0.4 3 0 requires factions { england, scotland, france, hre, denmark, spain, portugal, milan, venice, papal_states, sicily, }
recruit_pool "EE Bombard" 1 0.4 3 0 requires factions { poland, russia, hungary, }
recruit_pool "GR Bombard" 1 0.4 3 0 requires factions { byzantium, }
recruit_pool "ME Bombard" 1 0.4 3 0 requires factions { moors, egypt, turks, }
recruit_pool "AS Rocket Launcher" 1 0.4 3 0 requires factions { mongols, }
recruit_pool "AS Bombard" 1 0.4 3 0 requires factions { timurids, }
}
In this example, the building only has one capability type – recruit pool. This allows the building to have a recruit pool for a particular type of unit. An example -
recruit_pool "NE Bombard" 1 0.4 3 0 requires factions { england, scotland, france, hre, denmark, spain, portugal, milan, venice, papal_states, sicily, }
The first part, recruit_pool, defines the type of capability. Then comes a unit’s type name (the name in the “type” line of the export_descr_unit.txt”) in quotes. Next comes the four numbers that define the recruit pool. The way that a recruit pool works is that there are points. The building starts with a certain amount of points, and gains more every turn. You spend one point every time that you want to recruit a unit. There is a limit to how many points that the building can have. The first number is the starting number of points. The second number is the number of points that the building gains each turn. The third number is the maximum number of points. The last number, which must be between 0 and 9, is the starting experience of the units trained there. In addition, you can tie the capability (and this goes for all capabilities) to a requirement, using any combination of the four defined earlier. In this example, the Gunsmith has a recruit pool for Bombards when you are playing as England, Scotland, France, The Holy Roman Empire, Denmark, Spain, Portugal, Milan, Venice, The Papal States, and Sicily. It starts with 1 point, and gains 0.4 points per turn. There are a maximum of three points in the pool. The Bombards will start with 0 experience.
However, there are other capability types. Here is a comprehensive list.
wall_level – wall_level 0
This sets the walls of the settlement to be at a particular level.
0 = Wooden Palisade
1 = Wooden Wall
2 = Stone Wall
3 = Large Stone Wall
4 = Huge Stone Wall
tower_level – tower_level 1
This sets the towers of the settlement to be at a particular level.
1 = Arrow Towers
2 = Ballista Towers
3 = Cannon Towers
free_upkeep – free_upkeep bonus 2
This allows the building to support the specified number of militia units free of charge.
happiness_bonus – happiness_bonus bonus 1
This makes the building contribute to public order through happiness by 5 times the number specified – in this example, a 5% public order bonus.
recruitment_slots – recruitment_slots 1
This allows the settlement to have the specified number of recruitment slots.
gate_strength – gate_strength 1
This allows the settlement to have gates of the specified strength.
1 = Reinforced Gates
2 = Iron Gates
law_bonus – law_bonus bonus 1
This makes the building contribute to public order through law by 5 times the number specified – in this example, a 5% public order bonus.
stage_races – stage_races 1
This allows the settlement to have horse races. Note that in the Americas campaign, this is used to allow the settlement to stage sacrifices instead.
armour – armour 1
This lets the building act like a Blacksmith and upgrade armor. The number denotes what it can upgrade to:
1 = Padded/ Leather
2 = Light Mail/ Light Lamellar
3 = Heavy Mail/ Lamellar
4 = Partial Plate/ Heavy Lamellar/ Splint Mail
5 = Full Plate/ Kataphract/ Heavy Splint
6 = Advanced Plate
trade_base_income_bonus – trade_base_income_bonus bonus 2
This gives you a bonus on tradable goods, presumably 5 times the stated amount.
trade_fleet – trade_fleet 1
Lets you have the specified number of trade fleets.
recruitment_cost_bonus_naval – recruitment_cost_bonus_naval bonus 1
This reduces the cost of training boats in the settlement by 10% times the number specified – in the example, boats would be 10% cheaper in that settlement.
navy_bonus – navy_bonus 1
This allows you to give an experience bonus to all ships trained in the settlement that have cannon. In this case, it is a +1 experience bonus.
agent – agent merchant 0
This allows the building to train an agent of the type specified. After you say agent, you then specify what type of agent. Agent types include:
named character (Note that if you actually want to make generals trainable, you have to make general’s bodyguards trainable; they automatically come with a general. Don’t use the agent line.)
general (This is really a captain, although, again, I don’t think making them trainable would work out.)
spy
assassin
diplomat
admiral
princess
merchant
priest (includes Catholic and Orthodox priests, as well as Imams)
heretic
witch
inquisitor
The number afterwards is the level. You can use this to determine what level the priests are when they start (additional coding would be required for other character types).
0 = ordinary
1 = bishop
2 = cardinal/patriarch (note that the patriarch is an Orthodox model unused in the game)
agent_limit – agent_limit merchant 1
This adds to the limit of the agent specified by the number specified.
road_level – road_level 1
This sets a new road level in the province it is in. Road levels are as follows:
0 = Dirt Roads
1 = Paved Roads
2 = Highways
farming_level – farming_level 1
This increases the level of farms in the province by the number specified.
mine_resource – mine_resource 7
This increases your mining income by the number specified. Note that by default mines are 4 and mining networks are 7.
population_health_bonus – population_health_bonus bonus 2
This increases health in the settlement by 5 times the number specified.
population_growth_bonus – population_growth_bonus bonus 1
This increases population growth in the settlement by one half times the number specified.
retrain_cost_bonus – retrain_cost_bonus bonus 1
This reduces the cost to retrain units in the settlement by 10% times the number specified.
weapon_missile_gunpowder – weapon_missile_gunpowder 1
This upgrades the weapons of all gun-armed troops.
weapon_artillery_gunpowder – weapon_artillery_gunpowder 1
This upgrades the weapons of all gunpowder artillery.
weapon_projectile – weapon_projectile 1
This upgrades the weapons of all gun-armed troops and gunpowder artillery.
religion_level – religion_level bonus 1
This adds a conversion bonus of the religion that the building is tied to. The conversion bonus is 5% times the number specified.
pope_disapproval – pope_disapproval 1
This makes the Pope happy with your faction.
pope_approval – pope_approval 1
This sends a message to you when the building is completed, telling of the Pope’s approval for your cause.
amplify_religion_level – amplify_religion_level 1.5
This increases the effectiveness of religious buildings in converting the populace by 33 and 1/3 times the number specified.
heavy_cavalry_bonus – heavy_cavalry_bonus bonus 1
This increases the experience of knights trained here by the amount specified.
construction_cost_bonus_stone – construction_cost_bonus_stone bonus 30
This decreases the cost of stone structures by 1% times the amount specified.
gun_bonus – gun_bonus 1
Increases experience of all gunpowder-armed troops by the amount specified.
weapon_melee_blade – weapon_melee_blade 1
Upgrades the weapons of all melee troops.
archer_bonus – archer_bonus 1
Increases the experience of all archers trained by the amount specified.
cavalry_bonus – cavalry_bonus 1
Increases the experience of all cavalry trained in the settlement by the amount specified.
stage_games – stage_games 1
This is used in the Americas campaign to allow you to hold ceremonial dances.