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

The University

Hop to:    
loginhomeregisterhelprules
Bottom
Topic Subject: How to Train Units in Groups (Approved)
posted 01-13-12 03:21 PM CT (US)   
This article has been approved and can also be read at the University. - Leif Ericson

Training in Groups

Being able to train units in groups has been something that players of AoK have been wanting for quite a while. For most of the game's existence, no one has known how, but with BF_Tanks' research into annex units, it is now possible. This guide will teach you how to train any unit in a group of 4, as well as give pointers on other variations of this method.

Before you do anything, back up your data files. Then open up AGE 2 and load the data files. Here's the basic setup we'll be creating: The normal unit immediately dies, creating a building with 4 annexes, which also immediately die. Each of the annexes has a copy of the original unit as its Dead Unit, which creates a copy unit for each annex.

Step 1: Creating the new unit

In order to train units in groups, you will need to make a copy of the unit you want to group-train. We'll use the Archer for this example. Find the Archer unit, and then create a duplicate of it (Copy, Add, Paste). You should now have an identical copy of the Archer. Briefly scroll down to the “Train Location” and put -1 in the box to prevent any problems.

Step 2: Creating the Spawner

Find the Outpost (ID 598) and make a duplicate unit (Copy, Add, Paste). Rename this new unit something like “Spawner.” (Also, change all three of the Language Dll boxes to 0.) In the duplicate unit, erase all the graphics (Construction, Snow, Standing, Dying, and all the Damage Graphics) and change the HP to -1000. Any unit with negative HP will die immediately. It's important that you use a large negative number because some technologies and civ bonuses give extra HP. Now, change the Line of Sight to 0. Scroll down to the “Hide in Editor” box and check it, then go to the Dead Unit box and enter -1. Next, go to the “Terrain” box and change it to -1 (None). Go down to the Size Radius, Editor Radius, and Selection Radius and change them all to 0. Now, change the “Selection Mask” to 2 (Which removes any outline on the building or any outlines on units behind it.) Change the “Train Location” to -1 and “Train Time” to 0. Finally, Scroll down to the sounds section and remove them all (It should only have Construction and Selection Sound.) We have now effectively made it impossible to tell this unit exists ingame.

Step 3: Creating the Spawn Annexes

Now, copy the Spawner you just created and make a duplicate and rename it “Spawn Annex.”

Step 4: Changing the old unit

Now, go up to the original Archer. Remove all the graphics (Attack, Standing, Walking, and Dying). Now, scroll down to the “Hit Points” box. Enter “-100.” Any unit with negative HP will die immediately. It's important that you use a large negative number because some technologies and civ bonuses give extra HP (Bloodlines comes to mind). Next, change the “Line Of Sight” to 0. You can also clear the speed, attack, and armor for good measure. Scroll down to the “Hide in Editor” box and check it. Next, change the Train Time to 0 and then scroll to the “Resource Storage” section. Change the third column (Type 19 – Military Room) to -1. This is just a cosmetic adjustment to make the end-game statistics accurate. Next, right above this, change the third column (Population Headroom) to -1 (None). Scroll down to the Sounds section and clear them all (Train, Selection, Move, and Stop). Finally, scroll down to “Commands” and clear them all.

Step 5: Linking them together

Still on the original Archer, scroll to the “Dead Unit” box and enter the ID for the “Spawner” (if this is the only editing you've done, it will probably be ID 867.) Next, go to the Spawner and scroll down to the Annex section. In each of the four “Annex Units” boxes, put the ID of the Spawn Annex (probably 868). Next, you'll need to spread the annex units apart a little. I'd recommend about a .3 distance, so go to the Annex Units Misplacement boxes*. In the first pair, enter .3 and .3; in the second, -.3 and .3; in the third, .3 and -.3; and in the fourth, -.3 and -.3. The order is important here, so make sure you get it right. Next, go to the Spawn Annex, scroll down to the Dead Unit box, and then enter the ID of your duplicate Archer.

*NOTE: the pairing layout of the annex unit misplacement boxes is:
A B C D
A B C D

Step 6: Enjoy

Now, save the dat file, open up Age of Kings, and test out your changes.

Possible Variations

Let's say you want to train units in groups, but you only want to train them in pairs or groups of three. The fix is simple: remove one of the annexes. Then just experiment with the misplacement until you get the units spaced out properly.

If you want to train units and have different units spawn (ie, 2 archers and 2 skirmishers), you need to create a different Spawn Annex for each different unit. Then just make two of the annexes the archer-producing Spawn Annex and make the other two the Skirmisher-producing Spawn Annex.

You can even train larger groups, but it is a larger, more complicated process. It involves creating a third outpost spawner called "Spawner Misplacement." The Dead Unit of the Spawner should be the Spawner Misplacement, which will have an annex approximately .5 distance away, which has a duplicate of the spawner (can't use the same one) as it's dead unit.

NOTE: This method has a few shortcomings. First, units created in groups will not go to a gather point like normal. Second, in order to make this effective for computer players, you will need to edit the AI file. Otherwise, the standard AI will not function properly (I will address this more later.) Finally, When the group is created, there will be two texts that show up on the left of the screen: “---Archer Created---” and “--- Built---”.

For the first problem, there's nothing we can do, for the second, it's essentially understanding that the unit that the AI needs to create and the unit it needs to measure are two different unit Ids: for example, you'd need to structure your AI like: AI has less than 10 of unit A (Duplicate unit), create Unit B (original unit). Finally, for the last problem, I've asked around and experimented and haven't been able to fix it.

"The Dreaming God thinks that Carol should treat his impotence with viagra so that he will be more enthusiastic about the game." - Ash

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

Replies:
posted 01-14-12 03:59 AM CT (US)     1 / 5  
Nice guide, Sarn. I unfortunately have a bit of a backlog currently, but I plan to solve that tomorrow.

~`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 01-14-12 03:24 PM CT (US)     2 / 5  
I relayouted that misplacement grid into what you wanted it to be. Check blacksmith.

Advanced Genie Editor
Follow coding here and here.
posted 01-14-12 06:11 PM CT (US)     3 / 5  
Thanks. Changed it to fit.

"The Dreaming God thinks that Carol should treat his impotence with viagra so that he will be more enthusiastic about the game." - Ash
posted 07-30-14 06:11 AM CT (US)     4 / 5  
Hey Leif! I've also saved this more than useful tutorial for modding, by Sarn. Don't forget it too once you have time.

BTW, if you need help for approving articles or even co-managing the University, I'm available

"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 04-23-20 08:50 PM CT (US)     5 / 5  
This is a very intresting add-on for the game, thank you very much Sarn! <3

Also, about Annex Units,in these days I'm currently working on an old project, so, could I ask you kindly an hand in solving a doubt?!?!

I wish to create an hybrid units that is essentially a double-in-one unit class, but also, spending time in experimenting with annex units, I discovered that annex units works only on building class units and not to military units, so, essentially my target is to make a fighting healer on the base of an infanty unit that has an invisible monk (with the converting ability removed) in order to fight enemies with sword, and once the fight is over the invisible monk will automatically heals "his own infantryman" and all the nearby allies, so, what I'm asking can be done?!?

Thanks in advance

__________________________________________________________________________________________________________________________________________
MY GAME VERSION:

Age of Empires II The Conquerors 1.0 without any patches, just the ES release in August 24th 2000, proud to playing this game version!

[This message has been edited by AFFA the Cleric (edited 04-23-2020 @ 08:54 PM).]

Age of Kings Heaven » Forums » The University » How to Train Units in Groups (Approved)
Top
You must be logged in to post messages.
Please login or register
Hop to:    
Age of Kings Heaven | HeavenGames