Creating a Limited Building or Unit

Article written by fr steve
Published on 07-06-2016; updated on 07-06-2016
Tags: Advanced Genie Editor, Building Modding, Data Modding, Unit Modding

Introduction

Salut everyone! In this article, I will teach you a thing that might be useful for your mods: how to make a building or unit that is limited? This can be useful if you wish to prevent a civilization from building too many of your new building(s), or if you wish to completely change the gameplay by limiting the number of barracks, stables, castles, TCs, etc. or for a unit, if you wish to not create too many of a specific unit. There are tons of things you can do with this! The question is how. The answer is here!

Required

  • Age of Empires II, of course
  • Advanced Genie Editor (AGE)
  • A bit of knowledge of data editing with AGE

On this tutorial, I'll use AGE 1.6 (the 2.0 version can be downloaded here but you may also download AGE 2 or 3 at the Blacksmith too, it will work).

Editor Note: At this time (2016), AGE 3 is considered far superior to AGE 1.6. It has many features that AGE 1.6 does not have.

Explanation

What we're going to do is simple: in order to get something limited in Age of Empires II, you need to lack of 'something', so that when you don't have enough 'something', you cannot build/train your building/unit anymore. That's why this 'something' will be an unused resource, like wood or gold, but a resource that is not used by the game, so that only this unit/building costs it.

Objective

Preventing the British civilization from building more than 5 barracks.

Process

A) Opening

To begin, open the Advanced Genie Editor, set its folders and options if it's the 1st time you open it, and let's go!

B) Adding the resource

The goal of this step is to give you 5 of this unused resource from the beginning of the game. We will take the resource 15, completely not used by the game (thus, there is no risk of a research costing such resource or adding an amount of it unintentionally).

Select the Main Data slot and then go the the Techage slot, just above:

/images/university/limited-1.png

Now, find the Dark Age techage and click on it. You see that being at the Dark Age already sets some resources from the beginning. No matter, we need to add another one, this famous 'resource 15'. Add a new effect type: click Add, select Resource modifier (Set/+/-), and fill the boxes like this:

/images/university/limited-2.png

As you may see, the Resource type box indicates the resource (15 here), the 2nd one the boolean mode of the Resource modifier, in order to determine how you will set the amount of resource (0 means Set, 1 means + or -), and the last box indicates the amount of this resource 15.

Thus, we just made the Dark Age tech (researched once the game starts) give you 5 'Resource 15'. So in-game, if next to the resource screen at the top of your screen you could see a box for the 'Resource 15', you would see you have 5 of it from the beginning of the game. Now, we need to spend them...

C) Using the 'resource 15'

Now, go to the Units slot, thus leaving the Techage slot. Type Barracks in order to find them. You will see four units with this name, which is normal: almost all buildings upgrade like a unit when you reach a new age, because their graphics and hit points evolve at the same time. You'll then have to repeat what we're going to do for the 4 units called Barracks, but to make the things easier, we'll just make the Dark age barracks for now. Select it (it's the highest on the search screen), select the British civ on the civ slot, above the searching boxes, and then find the three Cost resource boxes, which must be far below. Then fill the 2nd line just as I did:

/images/university/limited-3.png

The 1st line indicates the wood cost of the barracks (indeed, Resource 1 = Wood), ignore it but don't replace it, or your barracks will become free! Once you filled the 2nd line, making your barracks costing 175 wood AND 1 'Resource 15', don't forget to click Update (below).

Now, if you test the game now, you'll see that you won't be able to build more than 5 barracks, which is normal since you only have 5 'Resource 15'. But since you have no way to gather more of it, you won't be able to build again more barracks if you lose one of them, which we do not want here. Thus, you need to follow the next step in order to gather back some 'Resource 15', and rebuild your barracks.

D) Gathering back the 'resource 15'

It is thanks to the Rubbles the barracks spawn that we will gather back this precious 'resource 15' we now need to build a barracks. Find the Rubbles 3x3 in the searching boxes, Copy them, Add a new unit and Paste over it. Don't forget to paste it for the British BUT ALSO for Gaïa, or else, the unit may not appear in game. The goal of creating a new unit is to avoid changing the original rubbles, since they are also used by archery ranges, stables, etc. while we only want to change them for the barracks.

Now select again the British, click on this new Rubbles unit, and find the three Storage resource boxes. They indicate what a unit provides. Then, fill the 2nd line like this:

/images/university/limited-4.png

As I typed it, this means these rubbles will provide now 1 'Resource 15'. You know now that you may gain some resources thanks to a unit, like gold! The 1st line has no interest, since it indicates the time before the rubbles disappear (60 seconds). Update again and now remember the number of the unit, which is the one written just before the name of the unit, in the searching screen, on the left. For me, you see it's 921, but it's likely to be another for you. Next step, you'll have to use it.

E) Linking

What we're just going to do is simply making the barracks give you back the 'Resource 15' it costed once it is destroyed, so that you may build a another one once it's destroyed, and only once it's destroyed.

To do that, go back to the Dark age barracks, always as the British civ, and find the Dead Unit ID box. Fill it with the new rubbles ID you had to remember previous step and update:

/images/university/limited-5.png

Now save your .dat file with the Save Unz+Dat button, above. And let's go for a test.

F) Testing

The goal is to see if your villagers are indeed unable to build a 6th barracks once you ordered the construction of 5 barracks, playing of course the British AND being at the Dark age. Let's see this:

/images/university/limited-6.png

Good, so the limit works well. Now, can we still build a 5 th barracks if I lose of the one I already have?

/images/university/limited-7.png

Very good! So I can build barracks all along the game, as long as I don't intend to build more than 5 barracks. These rubbles indeed give me back the 'Resources 15' I spent to build those barracks: it's actually an infinite spiral.

So you know now how to make a limited building. You can try this on other buildings now, if you wish to make the game more difficult. But it's not only limited to buildings...

Other uses

You may also use this method for units, that you'd wish to limit too, such as I did with my mercenaries in Age of Voivods: just follow the same steps, but instead of creating new rubbles, create a new corpse for the unit, since a unit, when it dies, doesn't spawn rubbles (you imagine!) but a bloody (or wooden for a siege weapon) corpse. So for instance, if you want to have limited cavalry archers, it's the corpse called CVRCH_D that you'll have to find, but not necessarily to copy and paste on a new unit, since only the cavalry archer uses it. Fill it the same way you would have done for the rubbles:

/images/university/limited-8.png

Hopefully you understood well this method and above all, managed to use it. If ever it didn't work, check again all steps: verify the civilization you were modifying, if you indeed played it during the test, if you were at the Dark age, if you selected the good barracks, or if you didn't forget to click Update after your changes.

Thanks for reading this article, and forgive my potential mispellings.

Bye!
Steve


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!