Empire Earth 2 – Unit Modding

by Mokon

Edited by One_Dead_Angel
July 15, 2005

Introduction

Recently there has been quite a few people asking about how to make a mod, well today I am going to go over how to edit the db files and how to make a simple mod. Sit back and enjoy, also thanks in particular to Steven Nadeau for his help, for he showed us much of this at the visit HG took to the MadDoc Offices.

Getting Started

To begin editing you must first go to the “C:\Program Files\Sierra\Empire Earth II” directory, which I will refer to from this point on as the “main dir”. Once there you should see a folder called Zips. This is what we will be editing the most so let us just make a backup of this. Copy and paste it onto your desktop and you are good to go. Now go into the zips folder and there you should see the db.zip file. Right click on this and push “extract all”, make sure, when it asks you were you want it, you put it into the main dir. If you have done everything right just go to “C:\Program Files\Sierra\Empire Earth II\db” and you should see 14 folders.

Let us start by going to the tech tree folder and than to the file called “upgrade_unittypes.csv”. When you open this, your computer will not know what program to use so make sure you open it in Excel. Ah, so you are now ready to start modding! Neat isn’t it?! Well first let us just do one thing to make it a lot easier for ourselves. Click on the A-2 square than go up to the windows tab and click freeze panes, this will lock that first row that tell us what each column means as we go down the file. Resize the A column and you will see a whole bunch of entries that look like this “LightInfantryUpgradeEpoch1”.

Diggin Into the Details!

Modding the Epoch a Unit is created

This particular entree is for the light infantry unit in epoch 1, or in other words the bowman. Scrolling over to the right you will see all the various statistics for that unit. So, let’s say I wanted to make Empire Earth II like Age of Kings, wherein military units were not made until the second age. To change what epoch the bowmen is made in I would edit D2, which is the epoch column, to two. This will change the epoch that the bowman can be made in from one to two.

Modding the Hitpoints

Ok, now I have another idea, lets say I want to make tanks more realistic and I want to give them 2000 hit points. I will count to 10 while you try to find how to edit this………………. Ok did you get it? This one might be a little hard because you have to find which unit is the tank. Since you get tanks in epoch 11, however, and since they are considered heavy mounted the 63 row, “HeavyMounted1UpgradeEpoch11” is what unit you want. Going over to the E column, which is where the hit points are stored, you can than edit it to 2000 and whala you have a uber tank. I will however, give a word of advice, for every statistic you edit; a ton more will also need to be edited to keep the game in balance. Therefore, since I made tanks so much stronger I might be smart to now make them cost a ton more. Try changing the cost yourself, I bet you can figure that one out!

Now if you looked over to the T-AH columns you probably have no idea what those do, for now we will skip those. I will get back to them once we move on to some of the more advanced topics. Also, don’t worry about the B and C columns, for with what you know right now you can do quite a lot, take a little time to explore this file, you really could rebalance the game just from this file if you wanted.

Modding Unit Properties

Anyways, now lets go back to the main dir and than on into the db/units folder. Here you will see all sorts of DDF files that have some really cool stuff in them. Open up the citizen.ddf file in WordPad so we can get started.

Now if you know C++ this will come like cake to you, but anyhow this is the first section you see:

UnitType Citizen

    {

      parent = Human

      icon = icon_unit_citizen_male_1

      properties {

        SizeX = 0.125

        SizeY = 0.125

        mass = 1

        displayName = tx_utn_citizen_name

        displayNamePlural = tx_utn_citizen_pname

        rps = Citizen

        stance = Cautious

        VerboseTooltip = vtt_unit_citizen

      }

      abilities [

        Move {speed = 1.15; angSpeed = 720; angAccel = 720}

        LOS { range = 5 }

        Build { repairRate = 12 }

      ]

    }

First you see the “parent = Human” line. What this will do is if you open up the “human.ddf” file all the attributes defined within this file will now be “inherited”, or in other words, they will be used by the citizen file. We will get back to this in a second so bare with me. The next line “icon = icon_unit_citizen_male_1” refers back to a icon which is defined elsewhere. If you wanted to edit this you could, but for now let’s just leave that alone. Under properties, you see SizeX and SizeY, these will edit how much of a tile the unit takes up, not that important right now, and than the same thing for the displayname entries, and these are all things that will be covered later. Now, you see the line that says “rps = Citizen” this is where RPS is defined for the unit. If for some reason you wanted to make a citizen a heavy infantry, just edit that line to be “rps = HeavyInfantry” and whala, you have changed the RPS. The stance line comes next; this is where the units default stance is put, for when it is created. It is usefully for some type of unit like a scout. The VerboseToolTip is another line, which we will go over later.

Modding Unit Abilities

Ah, now for my favorite area, the abilities section, some really cool stuff can be found here. See the “speed = 1.15” entry? This is converted to the speed of 12 that the citizen has in the game. Edit it to something like 2.0 and you will have uber fast citizens. Now lets say you want the ciitzen to shoot a shotgun that will damage a group of people in front of it. To do this add this line “Attack {areaDamageRadius = 2.0 }” just after the Build line. Now the citizen will damage units in a little area of effect around where it hits.

Ok, now this might confuse you a little, but the next section of lines is as follows:

UnitType FullCitizen
{
parent = Citizen
properties {
moveType = FootCitizen
}
abilities [
Attack { range = 0.0; reloadTime = 1;
applyDamageTime = 0.0; damage = 0 }
Move {speed = 1.15; angSpeed = 720; angAccel = 720}
LOS { range = 5 }
Build { repairRate = 12 }
GatherFarm {
// Nord edited 9/30 (Pre-Beta)
// - Doubled gather rate for forage and farming
// - Quadrupled gather rate for oil and uranium
treeCuttingRange = 0.9;
// at this range, the axe of the citizen contact tree trunk
otherRange = 0.8;
dropoffRange = 0.7;
foodRate = 0.95;
// this is the gather rate from forage patch
woodRate = 0.95;
stoneRate = 0.95;
goldRate = 0.95;
tinRate = 0.95;
ironRate = 0.95;
saltpeterRate = 0.95;
oilRate = 3.8;
uraniumRate = 3.8;
carryLimit = 15;
farmRate = 4.37;
// this is the gather rate from farms
farmCarryLimit = 15;
}
Garrisonable {
garrisonTypes = [
UniWarehouseOilDerrickCityCenter
Fortress
Tower
NavalTransport
SeigeTower
AirTransport
]
}
]
}

What this is actually doing is creating another unit, the “FullCitizen” within the same file. This takes the “UnitType Citizen” function that was created before and uses it as a “parent” from whom it inherits some basic components. The FullCitizen than goes further and adds more abilities, such as the ability to gather resources. With this new section you can edit things such as the resource gather rate. For instance take the “woodRate = 0.95;” line and edit it to “woodRate = 0.45;” and you will notice the gather rate is now about half the normal rate.

Anyhow, now I want to just go through a bunch of little code tidbits that you can add to property files I am now going to just list them and provide a brief explanation.

Garrisonable {

      garrisonTypes = [

        UniWarehouseOilDerrickCityCenter

        Fortress

        Tower

        NavalTransport

        SeigeTower

        AirTransport

      ]

    }

This of course allows units to be garrisoned in the respective buildings and units. So for instance if you want archers to be able to be garrisoned in a city center, you add the following in the Light Infantry DDF file:

Garrisonable {
garrisonTypes = [
UniWarehouseOilDerrickCityCenter
]
}

Now notice how it says UniWarehouseOilDerrickCityCenter. This is a garrison type defined in the buildings. So for instance in the city center there is this:

Garrisonable {
garrisonType = UniWarehouseOilDerrickCityCenter;
numOfSlots = 5;
resourceBonus = 0.02;
// 2 percent more resource dropoff for each garrisoned UnitType
rightClickToGarrison = 1;
healPoints = 4;
// 4 hit points heal every second for each UnitType
GarrisonFlagModelName = "GarrisonFlag"
}

You could change the UniWarehouseOilDerrickCityCenter to CC and than add it to all the units you wanted to be able to garrison within the city center.

Next notice the resourceBonus line. You know how houses and towncenters that are garrisoned provided an economic bonus? This will allow you to change the percentage that this bonus is.

Adding Abilities

Want someone to be able to convert a siege weapon like they do a building? Than add this code block:

Convertable {
convertTimeModifier = 300.0;
garrisonedUnitModifier = 0.0;
// %increase in capture time
garrisonedUnitDamage = 0.0;
// hitpoints subtracted from capturer per round per garrisoned unit
damageRate = 0.0;
// hitpoints subtracted from capture target hitpoints per round
capture = 1;
percentTransferred = 0.1;
// Percent to transfer to attacking player after capture.
resourcesTransferred = [ kResourceType_AllNaturalResource ];
}

Cool stuff isn’t it? Now I would have to say most of this is simple enough to figure out what it does yourself, just make sure you read the little comment lines they have. Anyhow, with percentTransferred you could make perhaps if someone captured a building than the player would get half of a players resources, perhaps useful for a scenario that uses a mod with it.

Modifying Resources

Well now one more thing before I move on. Open up the resources.ddf file. This one is has a lot of stuff that doesn’t matter that much, for now lets just use the search function of your text editor to find “// Resources Gold”. With this stuff lets just to start ignore all but the following:

    abilities [

      Resource { type = kResourceType_Gold;

      amount = 1000;

      maxNumOfWorkers = 6}

    ]

Most of that stuff just goes over graphical enhancements, which really are not needed. Notice how it says “maxNumOfWorkers”. Edit this to 10 and whala now 10 villagers can gather from a gold mine. Now let’s say we want that mine to not be infinite. Just add “alwaysExhaustible = 1;” just after the amount = 1000; and now your gold mine has 1000 gold in it that will expire after it has been harvested.

Ok, well that is the first part of this guide, I want you now to go out and experiment with what I have given you so far. Now you should be able to edit unit statistics and give some of your units cool abilities for instance take some of the villager properties listed above and give it to a Legion so I can mine gold. Next guide segment will be on editing the tech tree and a little bit more of units, and I will show you how to make entirely different units once you get all the basics down. Also, since this modding is very hard to explain in a comprehensive way if you have any questions email them to me and once I get a few I will throw together a FAQ. Good Luck in the meantime!