Make Your Units and Buildings Buildable

Article written by Felix
Published on 12-29-2011; updated on 07-10-2016
Tags: ,

Many of us have had a brilliant idea for a unit or building to add to the game. So, we find out how to use AGE and figure out how to make the unit and the building, only to figure out that the icon to train or build it is missing. Why oh why is this happening? In this article, I will show you how to fix this frustrating problem.

Section 1 — Preparation

To follow this guide you will need a reasonable amount of experience with AGE, preferably AGE2 as that is what is used in this guide. If you do not have the mentioned experience, I would suggest starting by reading Sarn’s article on creating new units in AGE.

You will need:
AoK:TC with C-Patch
AGE2 (Available here)
Resource Hacker (Available here)
‘All 3 language files combined together’ by Keisari Tapsa (Available here) [Optional]

Section 2 — Concerning Units

For this guide I will be giving an example of creating a ‘Sniper’ which will use an Archer graphic, which is trained at the ‘Town Centre’

We will not be making any graphics changes so set AGE2 to ‘Auto-Copy to All Civs (Excluding Graphics)’.

¡Make sure that you have made back-ups of your data files and DLL files before you continue!

First, open AGE2. It will look like this:

1.gif

If your Age of Empires II directory is in the default install location, simply pressing ‘TC defaults’ will fill all of the boxes on the ‘Open files…’ window to their correct locations. If you do not use the default install location, you will need to manually fill the boxes.

Got to the tab labelled ‘Units’. Next, create a unit in the manner explained in Sarn’s ‘Introduction to creating units with AGE2’ guide. In short, copy the archer in the right-hand panel (ID 4), create a new unit and paste the information into the new unit using the paste button.

It will look like this:

2.png

You may now change any stats you desire, but do not change the name in the way mentioned in Sarn’s article. We will do that differently in this guide.

Next, we will create new Language DLL names for the unit. This is required to make the text read correctly when the unit is being trained.

Now open ‘Resource Hacker’ and open your language.dll file. Before you begin this step, I would recommend that you download ‘All 3 language files combined together’ by Keisari Tapsa. This next step assumes that you have replaced your language files with those files but an experienced hex editor should have no problem working around those files.

We will be creating a new string in the language file to store the name ‘Sniper’ (Language DLL Name) and its ‘Creation Name’ (Language DLL Creation).

Open your language.dll file. We will need to find somewhere where there is two spare ‘slots’ in the DLL file. This is fairly easy and can be done with random trawling, but a good example that I will be using here is in the folder ‘334’ in the string table. Search for ‘Tuna’ using ‘Find Text…’ until you are on the page below:

3.gif

You will see here that there is plenty of spare numbers on this page. Next copy the first line (5330) and paste it in between 5331 and 5335. Do this twice. Your script will now look like this:

4.gif

Now rename your first 5330 to ‘5332’ and your second 5330 to ‘5333’. Next rename the quoted text at ‘5332’ to “Sniper” and the quoted text at ‘5333’ to ‘Create Sniper’ Your script will then look like this:

5.png

This is good. Compile the script and save the language.dll file. You can now close ‘Resource Hacker’.

Go back to AGE2, save your file and restart the program. Next change the ‘Language DLL Name’ of your new archer to ‘5332’ then change ‘Language DLL Creation’ to ‘5333’. The name of the unit should now change to ‘Sniper’.

If you want the unit to be trainable, we will next need to set a few things on the ‘Sniper”s page. Select the sniper and scroll down. You should see a box labelled ‘Train Location’ set this to 109 (Town Center). You should then set the box labelled ‘Button’ to 2. This box is the position of the of the icon on the bottom left corner panel. The icons are grouped into three rows of five. 2 would be next to the villager, to the right. 3 would be the next space to the right. 6 would be the space under the villager and 11, the space below that, where age researches would be. 15 would be in the bottom right corner. You will also need to set the ‘Command Attribute’ box to 3. This is gives the unit the function of an archer. If you were to give it a different ‘Command Attribute’, it would function as a different unit. For example, the functionality of a monk, or villager.

You should see this:

6.png

You can also change other settings at this point. For example, you may want to change the train time or the amount of gold the unit would cost. You may even want the unit to cost stone or food. These stats are changed simply with the drop-down menu and the ‘Cost Amount’ box.

You would think at this point that the unit would be trainable. It is not. Next, we must make a technology for the unit and with that, a research. Move AGE2 to the ‘Technologies’ tab. This next step is very simple. Click ‘Add’ beneath the right-hand panel. Make sure that the new technology is selected (it should be at the bottom and called ‘New Technology’) and select add in the central panel.

You should now see this:

7.png

Your technology will probably be numbered 514, however mine is numbered 516 as I have got two new technologies in my DATA file already.

Next change effect type to ‘2 — Enable / Disable Unit’. Next change the drop down menu to the ‘Sniper’. He will probably be at the bottom of the list. Next change the box labelled ‘Mode’ to 1.

8.png

Now would be a good time to save the file.

Next move to the tab labelled ‘Researches’ and add a new item just as before. I would recommend changing the box named ‘Name’ to ‘Sniper (Make Avail)’. You must then navigate the drop-down box labelled ‘Technology’ to your new technology which should be at the bottom of the list and should be called ‘New Technology’. If you would like this unit to only be available once you reach a specific age you can now change the first box under the heading: ‘Required Researches’ to the age at which you would like the unit to become available. If you want the unit to be available in any age, you can simply select ‘enabled’ with no required researches selected. I would recommend setting this to ‘Feudal Age’ (id: 101) just so everything runs smoothly.

In the end this will most probably look like this:

9.png

Bear in mind that you will not actually need to perform a research for this unit to become available, although this is very possible. This unit will become available as soon as the feudal age is reached.

Save the file. We will now test that everything is working correctly.

Launch the game and start a ‘Random Map’ game with a ‘Feudal Age’ start. Select your town center. You should see this:

10.png

11.png

12.png

If you are not seeing the above please check that you filled all the boxes in correctly and also make sure that you replaced your data files correctly, taking note of whether or not your AoK:TC is patched.

If everything has worked, congratulations! You have done well.

Section 3 — Concerning Buildings

If everything in the last section has been absorbed fully by your mind, then this section will be the pinnacle of simplicity. For this, we will take a slightly different approach. In this section we will changing an existing building (Trade Workshop) into ‘Sniper’s House’, a new building.

Firstly open up ‘Resource Hacker’ and use ‘Find Text…’ to find a ‘Trade Workshop’. It is numbered ‘5174’. Rename the quoted text to ‘Sniper’s House’. Compile the script, save and close.

Open AGE2 and find ‘Sniper’s House’ under ‘Units’. Change the build location to ‘118 — Builder’ and the ‘Command Attribute’ to 10 which is military buildings. Button should be changed to 5 which would put it just next to the ‘Siege Workshop’. You should see this:

13.png

In-game you should see this:

14.png

That market symbol is click-able and would build a ‘Sniper’s House’.

If you do not see any information when your pointer is moved over the symbol for ‘Sniper’s House’, you must change the ‘Language DLL Creation’ box to contain the same number as the ‘Language DLL Name’. That would have this effect:

15.png

You now have your very own new building.

I would recommend, just as Sarn did, that you do keep on playing around with AGE2. It was through doing this that I learned to do all of the above.

-Felix36


Do you want to comment on this article? Thank the author? Tribute resources for its improvement? Raze it to the ground?

Come by and visit its thread in the University Forum!