Preparations
- Make sure you have permissions to use the units if you intent to publish your mod
- Have a formatted modelDB file for your mod (data\unit_models\battle_models.modelDB)
- Determine how many free slots are left in your data\export_descr_units file (EDU). This is easiest via the search function of Notepad++. Open the EDU with Notepad++, press CTLR+F to get the search function and enter 'ownership' into the 'Find what:' slot, click 'Count'. The maximum number of entries is 500, if you have those detailed explanations at the top of your EDU then deduct one from the count.
Finding your unit files and entries
- If you can't remember the display name of your unit, simply use the custom battle of that mod by setting it to the faction where you know the unit is in the roster and using the 'Period\All' setting. Search for the unit in the roster and write down the correct spelling of the unit's name.
- Open data\text\export_units.txt and search for that name - it will look like the example underneath. Note that there are three entries for that unit, all of them need to be transferred to your mod's export_units file, simply copy it to the bottom of your mod's file. You can now change the entry outside the curly brackets if yo wish to change the name and\or description of the unit.
Code:
{Dismounted_Archers}Dismounted Archers
{Dismounted_Archers_descr}Despite preferring to fight on horseback...snip
{Dismounted_Archers_descr_short}These light mounted...snip
- If you intend to use the unit for a different faction then you will have to change the faction entry in the modeldb file, eg 7 mongols to 3 hre
- Open the mod's EDU and use the coded name to find your unit's entry. Copy the whole entry to the bottom of your EDU. You have to replace\amend the original faction names if you plan to use the unit for a different faction. The entry in the soldier line and armour_ug_models line are your battle models (see next step).
- Open the mod's modelDB file (use Notepad or Notepad++) and search for the battle model's entries, copy the whole entry to the end of your mod's modelDB file, preferably before the last entry. An entry starts at the line with the battle model's name and ends with the long line of numbers, example underneath. Do not forget to increase the model count number in the first line of the modelDB by the number of models you add.
Code:
22 serialization::archive 3 0 0 0 0 886 0 0
Code:
18 dismounted_archers
1 4
56 unit_models/_Units/AS_Light/dismounted_archers_lod0.mesh 121
56 unit_models/_Units/AS_Light/dismounted_archers_lod1.mesh 900
56 unit_models/_Units/AS_Light/dismounted_archers_lod2.mesh 2500
56 unit_models/_Units/AS_Light/dismounted_archers_lod3.mesh 6400
1
7 mongols
67 unit_models/_Units/AS_Light/textures/AS_Light_Fancy_mongols.texture
66 unit_models/_Units/AS_Light/textures/AS_Light_Fancy_normal.texture
51 unit_sprites/mongols_Mongol_Foot_Archers_sprite.spr
1
7 mongols
59 unit_models/AttachmentSets/Final Asian_mongols_diff.texture
59 unit_models/AttachmentSets/Final Asian_mongols_norm.texture 0
1
4 None
16 MTW2_Fast_Bowman
20 MTW2_Non_Shield_Fast 1
19 MTW2_Bowman_Primary 1
18 MTW2_Sword_Primary
16 -0.090000004 0 0 -0.34999999 0.80000001 0.60000002
- Now trace all the listed files (MESH, TEXTURE and SPR) and transfer them to your mod into the correct folders. Create those folders if necessary. Note that the sprite file (SPR) is actually a set of three files - two TEXTURE files and one SPR file with nearly identical names.
- The last files to transfer are the two unit pictures, you will find them here: ui\units\[faction name]\#coded name and ui\unit_info\[faction name]\coded name_info. Tip: if your unit hasn't got the mercenary_unit ability and all the pictures are the same you may wish to make your life easier (and reduce the size of your mod) by using the unified directory method for unit pictures. Simply add the two marked lines in the example underneath to your EDU entry and create those folders (unified) in the units and unit_info folders and place your pic in there.
Code:
ownership england, slave, france
era 0 england, france
era 1 england, france
era 2 england, france
;unit_info 13, 0, 1
info_pic_dir unified
card_pic_dir unified
recruit_priority_offset -12
- All that is left are the recruitment entries in the export_descr_buildings (EDB) file which is an easy copy\paste operation. You will find those entries by searching for the type entry of your EDU entry, not the coded name entry (dictionary).
A note about animations and mounts
You may find that your battle model uses custom animations (see the the bottom part of the modelDB entry) and are left with two options:
If your mod has no custom animations then simply copy the descr_skeleton file plus the mod's data\animation folder into your mod.
Else replace the custom animation line with a suitable, already exiting line from your modelDB.
If you transfer mounts and encounter a custom animation you will have to identify that entry in descr_mounts and copy it, if you do not have a descr_mounts file simply copy the whole file.