Skip to content

Translate this page to: German French Portuguese Spanish

Creating a New Unit

- by Argalius
Created: 2nd September 2006
Last Edited: 2nd September 2006

This tutorial is written for AoE3H's Modding Contest, it will give you a brief explanation on how to create a new unit.

First we'll need some proto code so the game can find the new unit, no proto code, no unit; you can see the proto code as the skeleton of your unit, linking to everything else. You can find the proto file in ..\Data. With proto code it's the easiest to just copy the code of an already existing unit that has many similarties with your new unit and then change it so it totally fits your unit. The proto file has a structure similar to this:

<proto version="#">
<unit id="#" name="X">
<unit id="#" name="X">

Note that I've only placed the tags that are vital for your unit. The <proto version="#"> opens the file and should be on top, where </proto> closes the file at the bottom. Every unit has its own <unit> tag with its own ID it's important that your unit has a unique ID otherwise the unit will not work properly. Note that name="X" is the so-called protoname, which is easy when searching in the proto file itself. If you want to change the name you see in the game or editor, change <displaynameid> and <editornameid>, the 5 digits are directing towards stringtable.xml.xmb. <animfile> points to the animfiles which are located in ..\Art\(here comes X\Y\Z.xml), more on the animfile below. The tags <unittype> and <flag> give your unit unique specifications, there are dozens of these tags which I won't discuss here, they mostly speak for themselves.
After you've added your unit in the proto and made the necessary edits it's time to create an animfile. Also here it's the best to copy an existing animfile and edit accordingly. You can find the animfiles in This is how an animfile looks like:

<assetreference type="GrannyModel">
<attach a="X" frombone="X" tobone="X" syncanims="1"/>

Also an animfile is opened and closed with a tag, but now the tag is <animfile>. <definebone> is for bones where you can add attachments to, <attachment> are these attachments, include is optional. Component is the main area of your model <file> points to the .gr2 file that's used as a model, <replacetexture> lets you replace the texture of your unit to your own texture so you don't have to overwrite it. <decal> is for the shadows and selection circles/squares/etc. beneath your unit and <attach> attaches your attachment to a certain bone.

After you've made both the proto code and the animfile you should be able to see your unit in-game, however you're still far from finished you'll need to create a new texture too and you probably want to thoroughly edit the proto code and animfile to make your unit totally unique. Unique units are far more appreciated than just "copies" so making your unit stand out will give you a better chance of winning AoE3H's Modding Contest!