export_descr_unit.txt explained

Introductions

Greetings one and all, this guide will cover the export_descr_unit.txt file, which can be found by unpacking the game files, or naturally found within mods. This file is the starting point for where all units begin, and this guide will cover many of the intricacies of the various stats.

A unit table has been provided below for example purposes.

typeAdvanced DragoonsdictionaryAdvanced_Dragoons ; Reformation Dragoonscategorycavalryclassmissilevoice_typeHeavyaccentDutchbanner factionmain_missilebanner unitdragon_standardbanner holycrusadesoldierAdv_Dragoon, 48, 0, 1officerAdv_OfficerofficerCavalry_Trumpteermountheavy horsemount_effect+2 vs horses, -4 vs camels, -4 vs elephantsattributessea_faring, hide_forest, can withdrawmove_speed_mod1.2formation2, 4.4, 3, 6, 2, square, wedgestat_health1, 2stat_pri15, 6, carbine_bullet, 210, 15, missile, missile_mechanical, piercing, none, musket_shot_set, 0, 1stat_pri_attrapstat_sec8, 6, no, 0, 0, melee, melee_blade, piercing, sword, 25, 0.6stat_sec_attrnostat_pri_armour8, 6, 0, metalstat_sec_armour0, 0, fleshstat_heat4stat_ground2, -2, -2, 4stat_mental15, disciplined, highly_trained, locked_moralestat_charge_dist15stat_fire_delay0stat_food60, 300stat_cost2, 1050, 300, 75, 75, 1050, 4, 200armour_ug_levels2, 3, 4armour_ug_modelsAdv_Dragoons, Adv_Dragoons, Adv_Dragoons_upgownershipgallia, slaveera 0galliaera 1galliaera 2galliarecruit_prioirity_offset25

Type

typeAdvanced Dragoons

type - Refers to the unit's internal name, this is used by other files to find the unit.

The files that utilize this include:

export_building_descr   - used for recruiting the unit

descr_mercenaries         - used to hire the unit as a mercenary

campaign_script             - used to spawn the unit via event

descr_strat                      - used to spawn the unit at game start

descr_rebel_factions      - spawns unit when a rebel army appears

descr_battle                    - used to spawn a unit for a historical battle

Dictionary

dictionaryAdvanced_Dragoon ; Reformation Dragoon

dictionary - the unit's dictionary name, this is used to reference the unit within the export_units file, as well as for the unit's ui picture in the unit and unit_info folders

Any words past the semi-colon ( ; ) is ignored by the game engine, and is purely for searching purposes for developers. Often the unit's description name is put there.

Category

categorycavalry

category - Used by the game's engine to determine what category of unit this is. This category further determines what unit voicelines to assign the unit, as well as where in the default starting formation the unit will be placed.

The game engine also uses this to determine what unit type this is for AI factions for recruitment purposes.

Possible tags include:

infantry

cavalry

siege

shipThe handler and non_combatant tags are unusable, and a remnant of code from Rome Total War.

Class

classmissile

class - Used to help the game engine in determining what class of unit this is. This class is further used to determine what voicelines to give this unit, as well as where in the default starting formation this unit will be placed.

The game engine also uses this to determine what unit type this is for AI factions for recruitment purposes.

Possible tags include:

light - used with infantry, cavalry, siege, and ship

heavy - used with infantry, cavalry, and ship

missile - used with infantry, cavalry, and siege

spearmen - used with infantry

Voice_type

voice_typeHeavy

voice_type - Used to reference what voice type is assigned to the unit.

Valid code includes:

Heavy

Light

General

Accent

accentDutch

accent - an optional line, normally units are assigned an accent based on what faction is being played. This line overrides that to assign a specific accent to a unit instead, giving it a single uniform sound no matter what faction it is part of.

Accents are referenced from the descr_sounds_accents.txt file.

Banner Faction

banner factionmain_missile

banner faction - used to refer to what type of banner this unit should use in battle. This line references the descr_banners_new.xml file.

The default banners include:

main_infantry

main_spear

main_cavalry

main_missileThis line is not included for ships due to a lack of playable naval battles.

Banner Unit

banner unitdragon_standard

banner unit - used to refer to an extra banner this unit should use in battle. This line references the descr_banners_new.xml file.

The default banners include:

Hospitaller

Teutonic

Templars

Santiago

dragon_standardThis line is not included for ships due to a lack of playable naval battles.

I've never actually seen this one work except for once in a historical battle, where Harold had a special dragon banner. Might have to do some more testing with this one.

Banner Holy

banner holycrusade

banner holy - used to refer to what type of banner this unit should use in battle if it is involved in a holy war. This line references the descr_banners_new.xml file.

The default banners include:

crusade

crusade_cavalryThis line is not included for ships due to a lack of playable naval battles.

Soldier

soldierAdv_Line_Infantry, 48, 0, 1

soldier - details the stats of the unit's model and mass, determined as is:

unit_model, number of soldiers, extras, mass, radius, height

unit_model - refers to what model a unit will use in battle. This is referenced in the descr_model_battle.txt file. Due to how the models work, unit effectiveness will be affected by the unit's skeleton and animation.

As noted in The Complete EDU Guide[www.twcenter.net]

Originally posted by Aradan:the unit model's scale improves combat effectiveness as it gets bigger. A way to balance this (though not perfectly safe) is through the hidden parametre 'height' that lies in the soldier line.

the unit skeleton attack animations also improve unit effectiveness as they get faster. The way to counter this effect is the min_delay_between_attacks stat, which lies in the stat_pri line.

the unit skeleton animations also help combat effectiveness, when they have big(ger) impact deltas. The way to counter this is through lethality [see related information]

number of soldiers - self-explanatory, this number can be anywhere between 6 to 60 (100 in Kingdoms) men, and will determine the amount of soldiers in a unit in medium unit size settings. Small size will have x1/2 the number, large size will have x2, and huge will have x2.5.

Generals can have extra soldiers in their bodyguard depending on their Private Security stat, which is affected by their traits and ancillaries, while Faction Leaders and Heirs have an increased number of soldiers as well.

extras - refers to the number of elephants or siege engines within this unit.

mass - refers to the individual soldier's mass. Mass determines how effective a unit is at holding and pushing the enemy. Mounted units do not rely on mass, as they instead use their mount's mass.

radius - an optional piece of code, radius determines according to the game engine how much space a single soldier will occupy. The default value is 0.4, and the lower this number, the tighter the formation of the unit will be.

height - an optional piece of code, height determines how high a unit is according to the game engine. No one really knows how it works, but apparently making it higher makes a unit weaker. The default value is 0.7.

Officer

officerAdv_OfficerofficerCavalry_Trumpteer

officer - adds an extra unit to this unit. These are referenced from the descr_model_battle.txt file. Up to 3 officers can be added. Elephant and chariots (do chariots even work in Medieval II?) cannot utilize officers.

Engine

An alternative example will be used here:

engine6_lb_rifled_gun

engine - refers to the type of siege engine a unit will utilize in battle. The model for this engine is referenced in the descr_engines.txt file.

Units utilizing a siege engineer are capable of commandeering a siege engine from other units utilizing the same siege engine, and in doing so will inherit the ammunition count for any siege engine they have commandeered. However, any commandeered siege engines must be the same model, otherwise the crew will instead attack the siege engine, rather than commandeering it.

For example, if faction A uses a siege crew that mans a catapult_north, while faction B uses a siege crew that also mans a catapult_north, while faction C uses a siege crew that mans a catapult_south; than A will be able to man B's catapults, and vice versa; meanwhile A and B will not be able to man C's catapults, due to C's catapults being considered a different type of siege engine from A and B's catapults, even if they share the exact same model.

For examples of this occurring, please see the test conclusions posted here:

Can you steal siege equipment?

Ship

An alternative example will be used here:

shiplight warship

ship - refers to the type of ship this unit uses. Referenced from the descr_ship.txt file. The stats defined within descr_ship.txt doesn't seem entirely important however, due to the lack of naval battles.

The default ship values include:

light warship

heavy warship

flagship

Mount

mountheavy horse

mount - refers to the mount all soldiers within this unit will use. This is referenced from the descr_mount.txt file. The mount file itself contains code for the unit's radius, height, and mass.

Mount_effect

mount_effect+2 vs horses, -4 vs camels, -4 vs elephants

mount_effect - unit attack bonuses against the various mounts. These bonuses only apply to melee weapons, and only upwards to 3 mounts can be assigned, with extras being ignored.

mount_effect can be applied for an entire class of mounts, such as horses or camels; or against specific mount types listed in descr_mount.txt. Mount classes themselves are assigned to mounts in descr_mount.txt.

Attributes

attributessea_faring, hide_forest, can withdraw

attributes - special attributes assigned to a unit. Can range from ai-specific-coding, to powerful buffs to a unit.

List here:

can_run_amokInstead of routing, this unit may go berserk and ignore orders, running around the battlefield in a panic.can_formed_chargeNo one actually knows what this does.can_withdrawThis unit is allowed to withdraw from battle.cannot_skirmishThis unit is not allowed to skirmishcantabrian_circleThis unit can utilize the Cantabrian Circle formation, and receives a +3 buff to its missile attack.commandThis unit inspires nearby units in a 75-meter radius, apply a +4 buff to morale.

It does not buff itself, and this attribute does not stack.druidThis unit begins chanting, applying effects in a 75 meter-radius; a +6 buff to morale is applied to friendly units, and a -5 debuff to morale is applied to enemy units.

It does not buff itself, and this attribute does not stackfire_by_rankThis unit rotates the line forward after the first line fires a volley, with the first moving to the back to reload and the second line moving forward to become the first.free_upkeep_unitThis unit can be supported for free in a settlement, as long as a free upkeep slot is available, and the unit can either be recruited or retrained at that settlement.frighten_footThis unit frightens all infantry units in a 100-meter radius, applying a -4 debuff to morale.

This stacks upwards to -6 morale with 2 units, and -8 morale at 3 units or more.frighten_mountedThis unit frightens all cavalry units in a 100-meter radius, applying a -4 debuff to morale.

This stacks upwards to -6 morale with 2 units, and -8 morale at 3 units or more.general_unitThis unit is used for as a general's bodyguard.

If assigned to be recruitable in the campaign, a general will be assigned to this unit.

The first unit closest to the top of the EDU with this attribute will be assigned to a valid faction's family member.general_unit_upgradeUnit is assigned as the upgraded version for family members; however, it does not work due to relying upon the Marian Reforms event, which is disabled in Medieval 2.gunpowder_unitThis unit uses a gunpowder weapon.hardyThis unit has improved stamina, thus depleting it slower, and recovering fasterhide_anywhereThis unit can hide anywhere on the battlefield; if no hide attribute is assigned, this unit cannot hide.hide_forestThis unit can hide in forests; if no hide attribute is assigned, this unit cannot hide.hide_forest_improvedThis unit has improved hiding in forests; this also affects their ability to hide on the campaign map. If no hide attribute is assigned, this unit cannot hide.hide_long_grassThis unit can hide in the long grass; if no hide attribute is assigned, this unit cannot hide.is_peasantThis unit's ability to maintain public order is cut in halfknightThis unit receives extra experience from buildings with the heavy_cavalry_bonus modifierlegionary_nameThis unit is assigned an extra name based off the region they are recruited from, alongside a roman numeral dependent on how many legionary_name units have already been recruited there.mercenary_unitThis unit no longer utilizes a faction-specific skin for its model, and instead utilizes a generic mercenary skin if available. It can also now be referenced in the descr_mercenaries.txt file.no_customThis unit is not available in custompower_chargedecreases the rate at which a unit's charge stat decays, thus allowing for a more powerful charge attacksea_faringThis unit is allowed to board shipsstakesThis unit can lay stakes before battle.

Interestingly enough, it is inputted twice, perhaps the second stakes refers to a stake model?start_not_skirmishingThis unit begins battle with skirmish mode turned offvery_hardyThis unit has even more improved stamina, thus depleting it much slower, and recovering much faster

Various extra attributes are also attached to units to help the AI in determining what type of unit this is. These include:

artillery

cannon

crossbow

explode

guncavalry

gunmen

incendiary

mortar

peasant

pike

rocket

standard

wagon_fort (unused due to the devs never finishing the wagon fort unit)

Move_speed_mod

move_speed_mod1.2

move_speed_mod - an optional kingdoms-only line of code. Speeds up a unit by a specified amount. The default value of speed for all units is 1.0.

Formation

formation2, 4.4, 3, 6, 2, square, wedge

formation - used to determine the unit's formation and how tight the formation is, determined as is:

horizontal spacing, vertical spacing, horizontal loose spacing, vertical loose spacing, default ranks, formation, special formation

horizontal spacing refers to how close each soldier is side-to-side.

vertical spacing refers to how close each soldier is from front-to-back.

horizontal loose spacing and vertical loose spacing are utilized for when the unit is ordered into loose formation. Loose formation will cause a -2 debuff to morale, unless elephants are nearby, in which case the unit gains a +2 buff to morale.

default ranks determines how many ranks the unit will be in at the battle's start.

formation refers to what formation the unit utilizes in battle. Valid formations include:

square

horde (puts the unit into a loose circular formation)special formation refers to a formation ability that a unit is capable of forming during battle. Valid formations include:

wedge (+10 unit attack, -5 unit defense)

phalanx (-4 to being hit by enemy missile attacks, +2 unit morale)

schiltrom (-1 to being hit by enemy missile attacks, +3 unit morale)

shield_wall (+10 unit defense (probably gets added to unit skill?))

Stat_health

stat_health1, 2

stat_health - determines the hitpoints of a unit and any animals it handles. The higher the number, the more hitpoints a unit has. Hitpoints are deducted anytime a unit suffers a fatal blow.

The second value is used only for elephant units, who ignore the first value.

Stat_pri/stat_sec/stat_ter

stat_pri15, 6, carbine_bullet, 210, 15, missile, missile_mechanical, piercing, none, musket_shot_set, 0, 1stat_sec8, 6, no, 0, 0, melee, melee_blade, piercing, sword, 25, 0.6

stat_pri - used for the unit's main weapon. For units that do not rely on a single melee weapon, stat_pri is used for the pike of a pike unit, the lance of a cavalry unit, or the missile weapon of a ranged unit (siege missiles are instead moved to stat_sec and stat_tri, with siege crews utilizing a primary melee weapon).

stat_sec - used for the unit's secondary weapon. Often only used for melee weapons, particularly for ranged units; also used as the weapon a pike or lance-armed unit uses when stuck in a prolonged melee. Siege engine missile weapon values are also placed here.

stat_ter - used for a siege engine's tertiary weapon. I've only seen this used to give trebuchets the ability to fire cow bodies.

The line of code as is determined for these stats include:

attack, charge modifier, missile type, range, ammunition, weapon type, weapon tech, damage type, weapon sound, musket_shot_set code, delay, lethality

attack is the unit's attack stat and how likely a blow will make it through an enemy's defensive stats. The max value this can be is 63.

charge modifier is a bonus modifier that is applied to the attack value when the unit is charging at the enemy, and rapidly decays afterwards. The max this value can be is 63. This modifier does not apply to a missile weapons.

missile type is used only for missile units, and determines the missile that the unit will fire at the enemy. This is referenced from descr_projectile.txt. For melee weapons, this piece of coding is only written as no.

range is the weapon's range in meters. This range can be reduced or expanded depending on the weapon's missile type, and the velocity, min_angle, and max_angle it has in descr_projectile.txt.

ammunition is the weapon's ammunition count. Units cannot resupply ammunition, though siege engine crews can replenish their ammo by commandeering abandoned siege engines that still has ample ammo to fire with.

weapon type is self-explanatory. Valid code includes:

melee

thrown

missile

siege_missileweapon tech affects how the unit's attack stat can be upgraded. Valid code includes:

artillery_gunpowder

artillery_mechanical

melee_blade

melee_simple

missile_gunpowder

missile_mechanicaldamage type determines what type of damage this weapon deals. It's probably defunct coding, but is required. Valid code includes:

slashing

blunt

piercingweapon sound triggers when the weaponi hits, and is normally used for melee weapons. Valid code includes:

none

spear

sword

axe

mace

knifeThe musket_shot_set code is utilized only by gunpowder units. It enables sound for the musket when it fires. It is optional for other weapons.

delay is the minimum amount of delay between melee attacks. It is measured in 1/10th of a second.

lethality is the measure of how lethal the weapon is in melee combat. The lower this number, the lower the lethalness of the number, causing a potentially lethal blow from this unit to instead stagger the enemy unit.

Stat_pri_attr/stat_sec_attr/stat_ter_attr

stat_pri_attrapstat_sec_attrno

stat_pri_attr - determines what attributes is to be applied to a unit's weapon, providing extra buffs or debuffs.

Valid code includes:

apPierces armor, halving enemy armor rounded up.areaAttacks from this weapon affects an entire areabpPierces through enemy units, missiles pass through units and affects multiple targets.nono Used alone, tells game engine that weapon has no attributes launchingAttacks from this weapon can launch unitslight_spearBuffs unit defense against cavalry by +8, but debuffs unit defense against infantry by -4.

If charged by cavalry while unit is bracing, this unit receives half the cavalry unit's charge modifier.long_pikeThis unit's weapon is lengthened. Can only be used for phalanx-capable units.precUnit throws missiles before charging into melee. Fire-at-will is turned off at battle start.spearBuffs unit attack against cavalry by +8, but debuffs unit attack against infantry by -4.

If charged by cavalry while unit is bracing, this unit receives the cavalry unit's full charge modifier.spear_bonus_xUnit receives an attack bonus against cavalry units, only even numbers are allowed, upwards to a max of 12.

Requires the spear or light_spear attribute to work, and stacks alongside these attributes.thrownUnit's missile weapon receives a massive buff against elephant units dependent on elephant unit's hitpoints. The minimum delay to volleys are reduced by 20%.[/tr][/table]

Stat_pri_armour/stat_sec_armour

stat_pri_armour8, 6, 0, metalstat_sec_armour0, 0, flesh

stat_pri_armour - determines what the unit's defense stat is. This is separated into three differing sub-stats.

stat_sec_armour - similar in function to stat_pri_armour, but only applies to elephants. As such, it only has two sub-stats. stat_sec_armour takes over from stat_pri_armour if the unit is an elephant, and stat_pri_armour values are ignored.

The code for these are determined as is:

armor, skill, shield, sound

armor protects from all attacks, but can have half the value negated from weapons with the ap attribute. It can be upgraded if the unit has any upgradable armor levels. it has a max value of 63.

skill is a stat only protects the unit when it is in melee combat, and is ignored by ranged combat. This skill can be enhanced via the unit's experience. It has a max value of 63.

shield is innate to a unit, and cannot be upgraded. It also only covers a unit's left and front sides, meaning any units attacked from the right or behind will not have the shield stat applied to their defense. It has a max value of 31, but has double the protection against missile fire. The shield stat does not exist for stat_sec_armour and is thus always 0.

sound is applied when the unit is attacked. Valid code includes:

flesh

leather

metal

Stat_heat

stat_heat4

stat_heat - Determines what stamina penalties the unit suffers in heat. The higher the number, the higher the penalty when the unit fights in hotter climates; in milder climates, this stat can be ignored.

Heat is calculated from the campaign's map_climates.tga file.

Stat_ground

stat_ground2, -2, -2, 4

stat_ground - Determines the unit's attack buffs or debuffs when fighting in certain types of terrain. The values can range from -8 to 8.

From left to right, the terrain types are:

Scrub

Sand

Forest

Snow

Stat_mental

stat_mental15, disciplined, highly_trained, locked_morale

stat_mental - The unit's morale and mental effectiveness in battle is determined from this stat.

The first value (15) determines how much morale the unit has. The higher the number, the longer this unit will be willing to stay in battle.

The second piece of code (disciplined) refers to how morale a unit will low when it suffers morale shocks, such as suffering a flanking attack, a massive loss, or the death of the army's commanding general. Valid code are as follows:

low

normal

disciplined

impetuous**Impetuous units may potentially charge at the enemy without orders.

The third piece of code (highly_trained) refers to how orderly the unit's formation with. Valid code are as follows:

untrained

trained

highly_trainedThe fourth piece of code (locked_morale) is optional, and locks the unit's morale from dropping any further, preventing them from suffering any type of morale shock and from being routed.

Stat_charge_dist

stat_charge_dist15

stat_charge_dist - Determines how far away a unit is before it begins its charge animation. The higher the number, the farther away the charge animation will begin.

Stat_fire_delay

stat_fire_delay0

stat_fire_delay - Used only by missile-capable units. This stat creates an additional amount of delay for units before they are allowed to begin the next volley. The default value is 0.

Stat_food

stat_food60, 300

stat_food - A defunct piece of code that can be ignored, not having this will crash the game though.

Stat_cost

stat_cost2, 1050, 300, 75, 75, 1050, 4, 200

stat_cost - The cost of the unit in regards to time, campaign cost, and custom battle cost. The code as is determined as:

recruitment time, campaign cost, campaign upkeep, weapon upgrade cost, armor upgrade cost, custom battle cost, custom battle limit, custom battle cost increase

recruitment time is how many turns it takes to recruit this unit in campaign.

campaign cost is self-explanatory. This cost can be affected by discounts from a building or a governor's traits.

campaign upkeep is how much money the unit will take each turn. Upkeep can be reduced if the unit suffers losses, or negated if the unit have the free_upkeep_unit attribute and is in a settlement that can recruit or retrain the unit.

weapon upgrade cost is how much it costs to upgrade/retrain the unit's attack.

armor upgrade cost is how much it costs to upgrade/retrain the unit's armor.

custom battle cost is self-explanatory.

custom battle limit is the limit to how many units of this unit you may have for an army in custom battle before it suffers a cost increase.

custom battle cost increase is how much more expensive the unit will be once the custom battle limit has been reached.

Armour_ug_levels

armour_ug_levels2, 3, 4

armour_ug_levels[/u] refers to the unit's armor upgrades, and what smithy level is required to upgrade them. The first value is the unit's default armor, meaning our example unit has armor upgrades when a lv 3 or lv 4 smithy is built, upwards to +2 to our example unit's armor.

Armour_ug_models

armour_ug_modelsAdv_Dragoons, Adv_Dragoons, Adv_Dragoons_upg

armour_ug_models - The unit's models when it is upgraded, the amount of models must match how many levels are specified in armour_ug_levels. At least 1 model must be placed here, with upwards to 4 models existing within this line of code.

Following from armour_ug_levels, if this unit upgrades to level 3 armor, it switches models over to Adv_Dragoons, which just so happens to be the same exact model as level 2; the unit also gains +1 to its base armor stat. It will be tagged with bronze armor symbol on its unit card.

Once the unit upgrades to level 4 armor, it switches over to a new model, Adv_Dragoons_upg, and gains +2 to its base armor stat. It will be tagged with silver armor symbol on its unit card.

This unit cannot upgrade anymore, even though it is at silver armor.

Ownership

ownershipgallia, slave

ownership - Determines which factions owns this unit. This enables the unit for a faction in custom battle (except if the unit has the no_custom attribute), and further enables the unit for recruitment for a faction, once the relevant lines of code have been inserted into export_descr_buildings.txt.

Mercenary units do not follow regular ownership rules, and can be tagged under slave, unless the player intends on making them playable in custom battles. Mercenary units must have the mercenary_unit attribute in order to properly function.

Era 0/1/2

era 0galliaera 1galliaera 2gallia

era 0 - Allows this unit to be recruited by the faction when custom battle is set to Early era.

era 1 - Allows this unit to be recruited by the faction when custom battle is set to High era.

era 2 - Allows this unit to be recruited by the faction when custom battle is set to Late era.

Recruit_prioirity_offset

recruit_prioirity_offset25

recruit_prioirity_offset - A kingdoms-only line of code. This gives priority to an AI in what it wants to recruit. A higher number means the AI is more likely to recruit this unit.

Credits

Guides and Forum threads used for information:

The Complete EDU Guide[www.twcenter.net] by Aradan

A guide to the export_descr_units.txt file[medieval2.heavengames.com] by Mythic Commodore

Much thanks to this question for inspiring me to test out how siege crews commandeering siege engines works:

Can you steal siege equipment?

Source: https://steamcommunity.com/sharedfiles/filedetails/?id=3136670088					

More Total War: MEDIEVAL II - Definitive Edition guilds