You must be logged in to post messages.
Please login or register

The University

Hop to:    
loginhomeregisterhelprules
Bottom
Topic Subject: Creating a limited building/unit (Approved)
posted 05-23-13 06:42 AM CT (US)   
This article has been approved and can also be read at the University. - Leif Ericson

Creating a limited building/unit



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!

1.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).

2.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.

3.Objective



Preventing the British civilization from building more than 5 barracks.

4.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:


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:

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:

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:

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:

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:

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

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...

5.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:


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

"Vous vous rendez compte, la France est le seul pays au monde où l'on recycle toujours les mêmes hommes politiques, même lorsqu'ils ont échoué !" Nicolas Dupont-Aignan

AGE OF VOIVODS
Still looking for DANISH, UKRAINIAN, LITHUANIAN and HUNGARIAN voices.

[This message has been edited by Leif Ericson (edited 07-06-2016 @ 01:26 PM).]

Replies:
posted 05-23-13 10:26 AM CT (US)     1 / 13  
Yhea! Thanks fr steve for the complete guide!
I've used this to creating a limit of 5 mayan general called Nacom, with special ability like morale, that improves the infantry HP by +5 for each Nacom trained,for a total of +25 HP, then, when a Nacom die, the infantry lose the +5 HP bonus, but if a infantry with bonus is injuried, and have less than 5 HP, and if a Nacom die, the infantry unit lose only 1 HP!
Also, for every Nacom trained, the cost of the next Nacom increase by +10%, for a total of +50% at the 5th Nacom trained, and when a Nacom die, the cost decrease by -9%, for a total of -45%, so every Nacom have an increasing cost like Rise of Nations Units!

[This message has been edited by AFFA the cleric (edited 05-24-2013 @ 12:41 PM).]

posted 05-24-13 10:16 AM CT (US)     2 / 13  
Nice work! I'll give this a proper in-depth look soon, but in the meantime consider this approved.
posted 05-24-13 04:08 PM CT (US)     3 / 13  
Thx Felix! That's very nice from you

"Vous vous rendez compte, la France est le seul pays au monde où l'on recycle toujours les mêmes hommes politiques, même lorsqu'ils ont échoué !" Nicolas Dupont-Aignan

AGE OF VOIVODS
Still looking for DANISH, UKRAINIAN, LITHUANIAN and HUNGARIAN voices.
posted 05-24-13 07:13 PM CT (US)     4 / 13  
posted 05-24-13 08:21 PM CT (US)     5 / 13  
I've tried to make it, but it just doesn't work. Maybe you can give me a list of unused resources?
I've tried to put a hidden resource to advance to the 3º age, a resource unlockable by many researches linked to one technology (I want to force to choose between factions to advance to Castle Age in my mod; every civ has at least two). Every choice ultimately unlocks a tech ("faction choosed") that gives the necesary resource to advance to Castle age (resource 51: 1), but I can advance without need that resource at all (the only way to have it must be the faction election).
posted 05-27-13 08:00 AM CT (US)     6 / 13  
Steve, how come you still use 1.6?
1) I used it from the beginning of the creation of AOV, so I prefer using familiar tools for familiar drills;
2) AGE 2 & 3 have too many features and changes compared to 1.6, which makes me lost a bit;
3) 1.8 doesn't work properly
But don't worry, once AOV is ended, I'll surely try to use AGE 3 more deeply I'm even using it to try to fix the tech tree ingame, but that's not a piece of cake... (I can't manage to make a new building appear)
I've tried to make it, but it just doesn't work.
Well, what you tell me you did isn't the same thing, so you cannot say it doesn't work. Anyway, here's the list for resources (that you may also find in the Genie's help files):
http://www.mediafire.com/?7v67i6ap14ajyc0

So, let's try to understand your problem:

you need to research techs (your 'choices') that unlock two techs, a faction choice. These faction researches give you a 'resource 51', that should be required to advance the Castle age. Problem is, you can research the Castle age without this resource. So:
-did you check that the Castle age Research costed 1 resource 51 (which is indeed unused)?
-are you sure no Techage gives you some 'Resource 51' somehow? Try to use another unused resource, 2003 for example should be a sure choice;
-in the Castle age Research, didn't you forget to check the box that activates a 3rd cost (since the Castle age initially already costs food and gold)?

If it doesn't work, well, I can only advise you to restart your research from the beginning. But the only issue must have something to do with the Castle age research. But anyway, you're not forced to do this, you can use the same method that Age of Chivalry uses for Policy decisions, id est, making the factions tech to disable the other one, while enabling the Castle age.

"Vous vous rendez compte, la France est le seul pays au monde où l'on recycle toujours les mêmes hommes politiques, même lorsqu'ils ont échoué !" Nicolas Dupont-Aignan

AGE OF VOIVODS
Still looking for DANISH, UKRAINIAN, LITHUANIAN and HUNGARIAN voices.
posted 05-27-13 07:00 PM CT (US)     7 / 13  
Well, I've tried and now it's working. Thank you, now I'm making it work for a series of "limited" units: Knights of the Royal Guard, the White Swords of Westeros for my mod. It's very useful.

Well, thanks!
posted 07-07-13 11:33 AM CT (US)     8 / 13  
Uhm, I'm a little buggy but, it's any way of linking a resource to a string DLL?
posted 07-24-13 02:13 PM CT (US)     9 / 13  
Sorry for the delay Erechel, didn't notice your answer.

Unfortunately, it's impossible right now to do anything with the resources, apart from changing the names of the 4 existing ones (food, wood, gold & stone). But don't despair, perhaps the Userpatch or Keisari and its AGE will soon find a way to edit resources Yet, the Userpatch made possible to enable a 5th resource on the interface, the Ore, although I don't know if it had strings in the .dll...

"Vous vous rendez compte, la France est le seul pays au monde où l'on recycle toujours les mêmes hommes politiques, même lorsqu'ils ont échoué !" Nicolas Dupont-Aignan

AGE OF VOIVODS
Still looking for DANISH, UKRAINIAN, LITHUANIAN and HUNGARIAN voices.
posted 07-29-14 09:25 AM CT (US)     10 / 13  
Could a moderator finish approving my tutorial? :3 That would be much appreciated, I wouldn't want it to fall into the doom!

"Vous vous rendez compte, la France est le seul pays au monde où l'on recycle toujours les mêmes hommes politiques, même lorsqu'ils ont échoué !" Nicolas Dupont-Aignan

AGE OF VOIVODS
Still looking for DANISH, UKRAINIAN, LITHUANIAN and HUNGARIAN voices.
posted 07-29-14 02:06 PM CT (US)     11 / 13  
Yep, I'll get on it as soon as I can. I do have a bit of backlog (see the queue), so please be patient.

~`o´~|\  Join the fresh and exciting AI Ladder for its fourth season!
´ `  |_\
       |    Learn the joy of AI scripting in my guide: The World of AI Scripting
______|______
 \        /
   .....Hinga Dinga Durgen! - SpongeBob
  `-=<.__.>=-´
posted 07-30-14 04:30 AM CT (US)     12 / 13  
No problem Leif Thanks! Take your time.

"Vous vous rendez compte, la France est le seul pays au monde où l'on recycle toujours les mêmes hommes politiques, même lorsqu'ils ont échoué !" Nicolas Dupont-Aignan

AGE OF VOIVODS
Still looking for DANISH, UKRAINIAN, LITHUANIAN and HUNGARIAN voices.
posted 01-02-18 02:23 AM CT (US)     13 / 13  
Just to note, you could also add the resource directly through the civilizations tab.

Simple change the value of the resource you wish to use, copy to all civs. All civs will then start with x amount of this specific resource.

I haven't tested your method on games with starting AGES of say, Castle Age...would the resource still be received on later game starts if your only adding the resource to dark age?

Anyway, the civilizations tab is an alternative method.

[This message has been edited by Sebastien (edited 01-02-2018 @ 02:32 AM).]

Age of Kings Heaven » Forums » The University » Creating a limited building/unit (Approved)
Top
You must be logged in to post messages.
Please login or register
Hop to:    
Age of Kings Heaven | HeavenGames