A Guide To Creating New Units

By SubRosa

So you want to create a new unit? This Tutorial will show you how.

Here is a list of the files we will be editing:

Mandatory

  • RTW\\Data\\Export_Descr_Unit.txt
  • RTW\\Data\\Descr_Model_Battle.txt
  • RTW\\Data\\Text\\Export_Units.txt
  • RTW\\Data\\Export_Descr_Buildings.txt

Optional

  • RTW\\Data\\Export_Descr_Unit_Enums.txt
  • RTW\\Data\\Models_Unit\\[model_flexi name].cas (multiple files)
  • RTW\\Data\\Models_Unit\\Textures\\[texture name].tga
  • RTW\\Data\\Sprites\\[model_sprite name].spr
  • Data\\UI\\Unit_Info\\[Faction]\\[dictionary name]_info.tga
  • Data\\UI\\Units\\[Faction]\\#[dictionary name].tga

Before you edit any file be sure you make a backup copy of it first. That way if you make a mistake you cannot fix you can always go back to the original.

Ready to go? Okay, first decide exactly what you want. Then find an existing unit that is similar to that. It is always easier to copy an existing unit and then tweak it to suit your needs rather than create it all from scratch. For the purposes of this tutorial I will be creating a unit of elite amazon foot archers, whom I will call Agema Amazon Archers.

Here is a flowchart showing the steps we will be taking:

Assign Name and Unit Stats

First we start in the RTW\\Data\\Export_Descr_Unit.txt file. For a full explanation of every line in Export_Descr_Unit.txt go here, I am just going to visit the high points in this article. Looking through here I find there is already an Amazon unit in the game – Rebel Amazon Chariots. So I will use their stats as a template. I copy their entry and paste it at the bottom of the file.

So you want to create a new unit? This Tutorial will show you how.

Here is a list of the files we will be editing:

Mandatory

  • RTW\\Data\\Export_Descr_Unit.txt
  • RTW\\Data\\Descr_Model_Battle.txt
  • RTW\\Data\\Text\\Export_Units.txt
  • RTW\\Data\\Export_Descr_Buildings.txt

Optional

  • RTW\\Data\\Export_Descr_Unit_Enums.txt
  • RTW\\Data\\Models_Unit\\[model_flexi name].cas (multiple files)
  • RTW\\Data\\Models_Unit\\Textures\\[texture name].tga
  • RTW\\Data\\Sprites\\[model_sprite name].spr
  • Data\\UI\\Unit_Info\\[Faction]\\[dictionary name]_info.tga
  • Data\\UI\\Units\\[Faction]\\#[dictionary name].tga

Before you edit any file be sure you make a backup copy of it first. That way if you make a mistake you cannot fix you can always go back to the original.

Ready to go? Okay, first decide exactly what you want. Then find an existing unit that is similar to that. It is always easier to copy an existing unit and then tweak it to suit your needs rather than create it all from scratch. For the purposes of this tutorial I will be creating a unit of elite amazon foot archers, whom I will call Agema Amazon Archers.

Here is a flowchart showing the steps we will be taking:

Assign Name and Unit Stats

First we start in the RTW\\Data\\Export_Descr_Unit.txt file. For a full explanation of every line in Export_Descr_Unit.txt go here, I am just going to visit the high points in this article. Looking through here I find there is already an Amazon unit in the game – Rebel Amazon Chariots. So I will use their stats as a template. I copy their entry and paste it at the bottom of the file.

typerebel amazon chariots
dictionaryrebel_amazon_chariots ; Amazon Chariots
categorycavalry
classmissile
voice_typeFemale_1
soldiergreek_amazons, 27, 9, 1
mountheavy chariot
mount_effectelephant -8, camel -4
attributessea_faring, hide_forest, frighten_foot, cantabrian_circle
formation8.5, 9, 15, 15, 2, square
stat_health1, 4
stat_pri10, 4, arrow, 120, 60, missile, archery, piercing, none, 25 ,1
stat_pri_attrno
stat_sec10, 6, no, 0, 0, melee, blade, slashing, none, 25 ,1
stat_sec_attrlaunching, ap
stat_pri_armour11, 1, 0, metal
stat_sec_armour0, 1, flesh
stat_heat2
stat_ground0, 0, -6, 0
stat_mental12, normal, untrained
stat_charge_dist40
stat_fire_delay0
stat_food60, 300
stat_cost1, 780, 140, 80, 120, 780
ownershipslave

Now I set about making some changes. First I will change the name under type and dictionary, as these must be unique for every unit. These names identify the unit in many of the other game’s text files, so they are important. Note that the first line does not have spaces between words, and the second does. Just so you know, the part after the semicolon in the dictionary line is ignored by the game, it only there for us humans to more easily identify the unit.

Next I will change the category from cavalry to infantry since my new unit will ground-pounders. Then I change the name in the soldier field, since this is best to be unique (it does not have to be if you are using the exact same models, texture, skeletons, and sprites as the original unit – see Descr_Model_Battle below). This line will identify the unit in the Descr_Model_Battle.txt file.

I remove the “Mount” and “Mount Effects” lines, and also change some of the unit’s Attributes to reflect that they are on foot rather than mounted. I also tweak the formation, weapon, armour, morale, and recruitment costs a bit. Note that with a missile unit the primary weapon is always their ranged weapon, and their melee sidearm always the secondary.

So here is what I come out with when I am finished tweaking:

typeamazon archers elite
dictionaryamazon_archers_elite ; Agema Amazon Archers
categoryinfantry
classmissile
voice_typeFemale_1
soldieramazon_archers_elite, 40, 0, 1
attributessea_faring, hide_forest, hide_long_grass, very_hardy, can_sap
formation1.2, 1.2, 2.4, 2.4, 4, square
stat_health1, 0
stat_pri12, 5, arrow, 170, 40, missile, archery, piercing, none, 25 ,1
stat_pri_attrno
stat_sec10, 5, no, 0, 0, melee, blade, piercing, sword, 25 ,1
stat_sec_attrno
stat_pri_armour8, 6, 0, metal
stat_sec_armour0, 0, flesh
stat_heat2
stat_ground2, 0, 2, 0
stat_mental10, disciplined, highly_trained
stat_charge_dist40
stat_fire_delay0
stat_food60, 300
stat_cost2, 1400, 500, 100, 150, 800
ownershipamazon

Assign Model & Skin – Descr_Model_Battle.txt

Now we go to the next file, RTW\\Data\\Descr_Model_Battle.txt, where we will give our unit a model and skin. For a full, line-by-line description of the contents of this file look here. I will just give it a quick run through.

I do a search on greek_amazons, since that is the soldier name of the unit I am copying from. I find this:

typegreek_amazons
skeletonfs_chariot_archer, fs_chariot_sword
indiv_range40
textureslave, data/models_unit/textures/greek_amazon_rebel.tga
model_flexidata/models_unit/unit_greek_amazon_high.cas, 15
model_flexidata/models_unit/unit_greek_amazon_med.cas, 30
model_flexidata/models_unit/unit_greek_amazon_low.cas, 40
model_flexidata/models_unit/unit_greek_amazon_lowest.cas, max
model_spriteslave, 60.0, data/sprites/slave_greek_amazons_sprite.spr
model_tri400, 0.5f, 0.5f, 0.5f

So once again I copy this and paste it at the bottom of the file. Now I set about to make some changes. First I change the type to amazon_archers_elite, since that is the new soldier name I have given it in Export_Descr_Unit.txt. Next I change the skeletons to those for a foot unit rather than a chariot.

For texture I change the ownership from slave to amazon, as they will be the new owners of this unit. I also change the name of the .tga file, .cas files, and .spr I will use to reflect the new unit name. Now I could take the easy route and still use the original skin, models, and sprites. But I like to be thorough, and I am going to change the texture file anyway. This does mean that I will have to make copies of all those files as well and rename them appropriately.

For those not familiar with the terms, the texture file is also known as a skin, as it is a 2-dimensional graphic that is wrapped around the 3-dimensional model the unit uses. While the texture file names you see in Descr_Model_Battle.txt end with the .tga extension, they are actually .dds files. Basically they start out as .tga files and are compressed to the .dds format to save space. It is possible to simply use .tga files if you really want to.

The model files have a .cas extension, and are basically a featureless 3-dimensional wire mesh.

The sprites are 2-dimensional graphics of low quality that are used at long distances in place of the skin and model. This reduces the load on the processor, and because it is done at long range does not cause a noticeable drop in visual quality.

typeamazon_archers_elite
skeletonfs_semi_fast_archer, fs_semi_fast_swordsman
indiv_range40
textureamazon, data/models_unit/textures/amazon_archers_elite.tga
model_flexidata/models_unit/amazon_archers_elite_high.cas, 15
model_flexidata/models_unit/amazon_archers_elite_med.cas, 30
model_flexidata/models_unit/amazon_archers_elite_low.cas, 40
model_flexidata/models_unit/amazon_archers_elite_lowest.cas, max
model_sprite60.0, data/sprites/amazon_archers_elite_sprite.spr
model_tri400, 0.5f, 0.5f, 0.5f

Create/Edit Skin

Remember how I just renamed the texture file above? We are going to make our own new texture file to use. We will start by going to the RTW/Data/Models_Unit/Textures folder and once again copying the original texture and renaming it to the new name we have in the texture line of Descr_Model_Battle.txt. Next we open the file and edit it. You can do this with graphic editors such as Photoshop, Paint Shop Pro, or The Gimp. Be sure to add the Nvidia .dds plugin to your editor or it will not be able to open or save the files. Look here for a list of links of graphic editors and the plugin.

The textures are stored in the game’s pack files, which are found in the RTW\\Data\\Packs folder. To get at them you will have to extract them first. You can get the Pak Extractor here, it is part of a group of editors in this download.

As I am not a great artist, I am not going to do anything grand. I will simply use the magic wand tool to select certain parts of the skin, then change their color to red and white (my new Amazon faction colors). I am not going to go into full details on how to use a graphic editor here as that would take up endless pages, and this is a gaming forum, not a photo-editing one.

I save the file and I am done. When saving a .dds file for RTW make sure you set it to the following: For Compression choose DXT5. Check “Generate mipmaps”, and make sure “Swap red and alpha” is not checked. Click ok, and exit.

Taking it Easy: If you want to take the easy route you can skip this part and use the original texture file, and keep the original name in the “texture” line.

Create/Edit Model

Next on the list is the model. Again, we could take the easy way and keep the same model the amazon rebel is using. However, in the interests of being thorough (and to show you everything), we will use new models. So it is off to the RTW/Data/Models_Unit folder, where we will find the four .cas files that comprise the model of the original. Again we will copy and paste them, then rename them as listed in Descr_Model_Battle.txt above.

I also take an extra step, which is not always necessary. I open each .cas file in a 3d Modeling program (3dx Max in my case), and assign the texture to it. This is how all the units in Barbarian Invasion are done. Note that doing this actually overrides the text I use to assign the texture. Watch for a tutorial on using 3ds Max in the near future, and look here for a list of links to modeling software.

If your game crashes when trying to use the unit and you receive an error message that it cannot find the original texture file it means that texture is assigned to the model in its .cas files. Your only options then are to change the name of your texture file back to the original, or directly edit the .cas files with a modeling application. Also, if you see a model in the game with no texture at all (it looks sort of like a featureless grey ghost), then you will have to assign the texture to the .cas files to get them to display properly.

Taking it Easy: If you do want to go the easy path, then again simply leave the original names in the “model_flexi” lines above and skip this part.

Create and assign Sprites

Now we are going to generate our own, brand new sprite for this unit. Rather than add another page to this article, I will now direct you to a complete article on generating and implementing sprites here.

Taking it Easy: Again you can take the easy road and simply use the original sprites that came with the unit. In this case you would not alter the original sprite line in Descr_Model_Battle.txt.

Create Description

Now things become easier. We will add the name and descriptions you see of the unit in the game. There are two files we will edit here:

  • RTW\\Data\\Export_Descr_Unit_Enums.txt
  • RTW\\Data\\Text\\Export_Units.txt

Export_Descr_Unit_Enums is optional. If you have RTW version 1.5 you do not need it. But if you have an earlier version of the game this file is required. So again, I will show it all here.

Go back to your unit’s entry in Export_Descr_Unit and find the dictionary name (it is the one with the underscores between words). Copy this, then open Export_Descr_Unit_Enums.txt, go to the bottom and paste it in three times, on separate lines, like so:

amazon_archers_elite
amazon_archers_elite
amazon_archers_elite

Now add “_descr” to the end of the second line, and “_descr_short” to the end of the last, with no spaces. Like so:

amazon_archers_elite
amazon_archers_elite_descr
amazon_archers_elite_descr_short

Okay, done there. Copy all three lines and proceed to RTW\\Data\\Text\\Export_Units.txt. Go to the bottom of the file and paste it in. Now we are going to add { } brackets around each line, and put spaces between the lines. Like so:

{amazon_archers_elite}

{amazon_archers_elite_descr}

{amazon_archers_elite_descr_short}

What you see in the brackets is a pointer. It tells the game that what follows is what it should display in the game. The first line is for the unit name. Use the Tab key to make a space after the last bracket and add in the name of the unit.

The second line is the long description you see when you open up the unit’s information scroll. The: “\” characters will add a manual line break, so use one to create a new line, and two to create a paragraph space.

The third line is the short description you see in the game. It should only be one sentence or two to give a brief idea of what the unit is. This is typically something cropped from the full description.

The following bit of text at the top and bottom of every unit’s entries is ignored by the computer:

—————–

It is there to serve as a visual reference for us humans reading the file, making it easier to tell which unit is which. It is a good idea to put one of these in between each new unit’s descriptions to reduce confusion.

So here is the finished product:

—————–

{amazon_archers_elite} Agema Archers

{amazon_archers_elite_descr} Can Fire Incendiary Missiles\Sapping Ability\\These women are elite foot archers of Amazonia, the long range killing power of their armies. They are armed with the most powerful compound bows of their people. However, they are also heavily armored and armed with the hoplite sword as a secondary weapon, and so can give a good account of themselves in melee combat if necessary.\\Where regular Amazon Archers are drawn from the lower classes, these women are all aristocrats, either from birth or from earning that higher status by distinguishing themselves in battle. The greatest of all the archers of Amazonia, these women have been known to win battles simply through their arrow-fire alone. They are the most fearsome archers in the world, and strike fear into the hearts of all who face them across the battlefield.

{amazon_archers_elite_descr_short} These women are elite foot archers of Amazonia, the long range killing power of their armies.

—————–

Make Unit Recruitable

Now we are going to make the unit recruitable in the Singleplayer game. Go to RTW\\Data\\Export_Descr_Buildings.txt and find the series of buildings you want the unit to be recruited from. Note that the level of each building is listed separately in this file, and you need to edit each level of building that the unit is to be recruited from.

Since this is an archer, I am going to the “building missiles” line. After this you will see the names of each level of missile building, from lowest to highest: “practice_field archery_range catapult_range siege_engineer”. Remember that in RTW the practice_field is a second tier building, not a first.

Since these are quite powerful units, I do not want them recruitable too soon. So I go down to the catapult_range (a 4th tier building) and find the end of the section. I copy the last line there (including the space at the beginning), paste it beneath, and then edit it. I change the name of the original unit within the quotation marks to the type name found in Export_Descr_Unit.txt (the name with the spaces between words). The number is how much experience the unit has when first recruited 0 for none, up to 9 for three gold chevrons. Finally the name in brackets at the end is the faction(s) or culture(s) that can recruit the unit. Note that there has to be a comma and space after the name and before the closing bracket. If you do not have them, the game will crash. So here is what I get when I am done:

        recruit “amazon archers elite” 0 requires factions { amazon, }

Now be sure you do this with every level of building you want to able to recruit the unit from. So in this case I will copy this line and go down to the end of the “siege_engineer” section and paste it in there as well.

You can add some special caveats to unit recruitment as well, by adding in special strings at the end of the line. Some of them are:

  • and not marian_reforms – (unit only recruitable before the Marian Reforms)
  • and marian_reforms – (unit only recruitable after the Marian Reforms)
  • and resource elephants – (unit only recruitable in a territory with the elephant resource)
  • and resource camels – (unit only recruitable in a territory with the camel resource)
  • and hidden_resource rome – (unit only recruitable in Rome)
  • and hidden_resource sparta – (unit only recruitable in Sparta)

Add Unit Cards

Okay, we are almost done. Time to add unit cards. This is an optional step, but if you skip it the game will automatically give you the unit cards for generic peasants, which are really not nice to look at when you have a really nifty unit.

For a full description on how to create new unit cards look here. I am going to give the basics here.

There are two unit cards you see in the game. One is the big picture you see in the units information scroll, the other one is the small one you see at the bottom center of the user interface when you on the battle and strat maps, as well as the unit selection screen in Custom and Multiplayer battles.

The big picture is a 160 x 210 pixel .tga file. It is found in the Data\\UI\\Unit_Info\\[Faction] folder, and is named [dictionary name]_info.tga. Note that the originals are in the game’s pack files, and these folders will probably not exist on your hard drive. If not, just go ahead and create them.

The small picture is a 48 x 64 pixel .tga file. It is found in the Data\\UI\\Units\\[Faction] folder. It is named #[dictionary name].tga

If your new unit is similar to an existing one you can simply copy its unit cards, rename them to the appropriate faction, and use them. In that case I would recommend using a graphic editor to at least alter the faction colors of the pictures, as it only takes patience not real artistic ability to do so.

If your new unit is a radical departure from the original, as in the case here where I have a new foot unit from a mounted one, you have to start from scratch. In that case you can either take a screen shot of the unit in the game, crop it down, and remove everything in the background. Or if you are an artist you can simply draw a new one. Last of all you can use a modeling program like Milkshape or 3ds Max to preview the unit, set it in a pose, then take a picture of it.

I elected to do the final option, and made my unit cards for my amazons from 3ds Max. I found that a way to make the process quicker was to first create the larger picture, then save it again and resize it to create the second unit card. However, this can make the smaller card quite small in detail, so it is best to crop out the lower half of the unit before resizing it down for the second pic.

I came out with these two files (note that I have replaced the faction of Pontus with that of Amzaonia in this game):

Data\\UI\\Unit_Info\\pontus\\amazon_archers_elite_info.tga
Data\\UI\\Units\\pontus\\#amazon_archers_elite.tga

Done!

That is it. All done. We have gone from this:

To this:

Hopefully the Gods of Wargaming will smile upon your own efforts and everything works when you test it out in a Custom Battle. If not, make sure you are using the -show_err Command Line Switch so you at least get an error message when the game crashes on the unit. Be patient, most people at least make one or two mistakes, usually in spelling, when modding a unit. I certainly make plenty.

For an example of creating a new unit and some of its pitfalls, look here