# Thread: Guide: The Complete EDB Guide (WIP)

1. ## Guide: The Complete EDB Guide (WIP)

Title: The Complete EDB Guide for RTW (inc. BI)
Posted by: Dol Guldur
Modding area: Buildings (construction, bonuses) / Units (recruitment)
Required programmes: Notepad (or other text editor)
Optional tools: Hadrian building editor, Excel macro for recruit lines
Related links: Complex conditionals for recruiting and building, A quick question from a modding newbie..., Additional capabilities and requirements for buildings
Summary: An in-depth explanation of the export_descr_buildings file, which is the primary base for modding buildings and determining which units can be recruited from them.

The Complete EDB Guide for Rome:Total War:

Understanding & Coding the Export_Descr_Buildings.Txt (EDB) file

by Dol Guldur

LAST UPDATE: 10th June 2009 (recent changes: conditionals for upgrades).

CONTENTS
• Introduction
• Hidden Resources
• Building Trees
• Building Blocks: Requirements
• Building Blocks: Capability
• Building Blocks: Faction Capability
• Building Blocks: End
• Note on Barbarian Trees
• Note on Building Names and Descriptions
• Note on Multiple Temples & Indestructability of Buildings
• Note on Associated Files
• Tools & Other Resources
Introduction

I put this file together for my own reference, but have decided to open it up to all. I only ask your aid in improving and adding to it. If you are not at all familiar with the basics of the EDB file then you should become so before reading this. The file works alongside a good few other files and may not have the desired effect if these associated files are not modded. I hope this file is of some use in aiding modders to create better coding for the mods they are working on.

Hidden resources

The file begins proper with a declaration of the hidden resources. You may have up to 64 of these. They should all be listed here. The file seems to accept both space- and comma-separated lists. Do not use a hidden_resource in the EDB file and forget to declare it as this will result in a crash to desktop (CTD). It is reported that the rome hidden resource must be kept as the game uses it when checking victory conditions. These hidden resources can be assigned to regions in the descr_regions.txt file.

Building Trees

You will then find listed in the EDB file the building tree for each building type complete with a block of code for each building. You may have up to 64 such trees with a maximum of 9 levels (buildings) each though spread over a maximum of 5 settlement levels (though buildings attached to villages will not show up on the building browser). You can read more about this in the thread initiated by Black Crow at https://forums.totalwar.org/vb/showthread.php?t=56549

The tree initiates with a declaration of the building type. Here's the beginning of the tree that lists buildings which provide archers and other missile units...

Code:
building missiles
{
levels practice_field archery_range catapult_range siege_engineer
{
the first line is the building type. After the opening curly bracket the levels of that building type are listed (space-delimited and with "levels" preceeding).

You can designate your own names for the building type should you wish to not make them universally available to all factions/cultures. However, core_buildings (aka government buildings), walls and hinterland buildings (roads, mines, and farms) cannot be factionally or culturally designated (though some of their levels may be excluded from certain cultures/factions).

For example, you could have:

Code:
building missiles_roman
{
levels practice_field archery_range catapult_range siege_engineer
{
Which of course could be used to specify a purely roman tree of such buildings. Remember not to change the names of the levels (though you may choose to not use some or allow only certain roman factions their use).

Building Blocks - Requirements

The tree then lists a block of code for each building (i.e. each of the levels declared). Continuing from our example above we will look at the first level of the "building missiles" tree, the practice_field:

practice_field requires factions { barbarian, ct_carthage, eastern, parthia, egyptian, greek, roman, }
{
The first line states the requirements necessary to be satisfied in order for the building to be available for construction. All factions reside within the 6 hard-coded cultures, and so this particular building can be built by all factions. Any combination of factions/cultures can be listed. Both visible and hidden resources can be used as requirements as may "building_present_min_level x y" where x is the building type and y the level of that building type. This latter simply requires a certain minimum level of building of a building type to be present in that settlement before the practice_field can become available for construction. The connector "and" can be used to compound requirements, for example:

practice_field requires factions { barbarian, roman, } and resource iron and hidden_resource woodland and building_present_min_level market trader
{
Full List of Requirements

resource
hidden_resource
building_present (as building_present_min_level except that it tests for the buidling type only - e.g. building_present barracks)
building_present_min_level
marian_reforms
factions { x, }
port - Squid, in the Discussion Thread, has discovered that this returns true in coastal areas with ports assigned (i.e. in map_regions.tga). It can be used as a condition for buildings and capabilities, including units (it will not cause a CTD on right-clicking the unit to bring up the unit info scroll).

The connectors "or" and "not" can also be used in addition to "and". X represents a faction, culture, a list of the same - or all ("all,"). To find out more about how to use requirements and connectors take look at this thread: https://forums.totalwar.org/vb/showt...?postid=642173

Note 1: Not conditionals (even if true) and positive conditionals that result false seem to break the culture/faction for the slave faction if those buildings are placed at game start - see this thread: https://forums.totalwar.org/vb/showthread.php?t=81322

Note 2: All of the above can be used as capability requirements too though the building_present/building_present_min_level should not be used for recruitment lines as it will cause a CTD when the player uses the right-click feature added in later versions of RTW.

Building Blocks - Capability

Example:

capability
{
recruit "carthaginian peltast" 0 requires factions { spain, }
recruit "barb peltast gaul" 0 requires factions { gauls, }
recruit "barb peltast german" 0 requires factions { germans, }
recruit "barb slinger briton" 0 requires factions { britons, }
recruit "barb archer dacian" 0 requires factions { dacia, }
recruit "barb archer scythian" 0 requires factions { scythia, }
recruit "carthaginian peltast" 0 requires factions { carthage, }
recruit "carthaginian archer" 0 requires factions { numidia, }
recruit "east peltast" 0 requires factions { armenia, pontus, }
recruit "east slinger" 0 requires factions { parthia, }
recruit "egyptian peltast" 0 requires factions { egyptian, }
recruit "egyptian slingers" 0 requires factions { egyptian, }
recruit "greek peltast" 0 requires factions { greek, }
recruit "roman velite" 0 requires factions { roman, }
recruit "roman light infantry auxillia" 0 requires factions { roman, } and hidden_resource gondor
recruits_morale_bonus bonus 1 requires factions { dacia, }
}
The Capability section lists the capabilities (i.e. the recruitment capability and building effects) of any given settlement which contains this building. The pool of potential requirements that can be attached to both recruitment and effect lines are basically the same as those used for the building's construction requirement (see above).

Note that if you use the marian_reform requirement then it has been reported that it needs to go at the end.

The "0" listed with recruits refers to the level of Experience the unit begins with when first recruited. It can of course be any number between 0 and 9.

Capability requirements

Much the same as the building requirements listed above. The following one, however, can only be used in the capability lines though it does not seem to work properly anyway:

building_factions { x, } (does not seem to work but is supposed to test if the building was originally built by faction/s x - read more about the testing in the EDB discussion thread)

I here list all known capability effects (which I sort by approx. category for your convenience):

Full List of Building Effects

happiness_bonus (public order due to happiness) 1-x (5-x%)
population_growth_bonus (pop. growth) 1-25 (0.5-12.5%)
law_bonus (public order bonus due to law) 1-x (5-x%)
population_health_bonus (public health) 1-x (5-x%)
farming_level (farms) (plus 0.5% pop. growth and plus 80 income (average harvest) per point;equivalent to base farm level in descr_regions.txt) 1-5 (1-5) [5]
population_fire_risk_bonus (reduces risk of fire) * (might function as "fire_risk", if it works at all)
taxable_income_bonus (tax income bonus) boosts tax income by stated percentage;1-100 (1%-100%)
population_loyalty_bonus (public order) - does not appear to work

recruits_morale_bonus (increases morale of units recruited) 1-4 (1-4) (does not seem to work though)
recruits_exp_bonus (upgrades XP of units recruited) 1-5 (1-5)

weapon_simple (upgrades melee (light) weapons) 1 (1)
weapon_missile (upgrades missile weapons) 1-5 (1-5)
weapons_other (?) *
upgrade_bodyguard (improves general's bodyguard) ? * (comes into effect only after Marian Reforms)

mine_resource (income from mining) 1-4 (1-4) [5] - values above 4 also work and create greater income

wall_level (walls) 0-4 (palisade, wooden, stone, large stone, epic stone) [4]

stage_games (allows gladiatorial games) 1-3 (1-3) [5]
stage_races (allows races) 1-2 (1-2) [5]

religious_belief [pagan/zoroastrian/christianity] 1-x (5-x%)

construction_cost_bonus_military (percentile cost reduction for recruitment buildings but does not seem to work) 1-100 (1-100%)
construction_cost_bonus_religious (percentile cost reduction for temples) 1-100 (1-100%)
construction_cost_bonus_defensive (percentile cost reduction for walls) 1-100 (1-100%)
construction_cost_bonus_other (percentile cost reduction for civil buildings but seems to apply to all buildings except religious ones) 1-100 (1-100%)
construction_time_bonus_military (percentile time reduction for constructing recruitment buildings but does not seem to work) 1-100 (1-100%)
construction_time_bonus_religious (percentile time reduction for constructing temples) 1-100 (1-100%)
construction_time_bonus_defensive (percentile time reduction for constructing walls) 1-100 (1-100%)
construction_time_bonus_other (percentile time reduction for constructing civil buildings but also seems to apply to all buildings except religious ones) 1-100 (1-100%)

Notes on above list...

[1] wooden are default though not explicitly stated
[2] does not appear to work; stone walls of any kind come with scorched sand/boiling oil
[3] default towers are watchtowers though not explicitly stated
[4] defensive capabilities seems to come with the wall_level regardless of what value they are given! See note below.
[5] see Quietus's A Comprehensive Rome: Total War Guide (Tools & Other Resources) at the end of this Guide.

* untested or unknown use

Notes on format...

Effects containing the "_bonus" element in their name should be coded with a stand-alone "bonus" added before the integer even when there is a "bonus" in the effect's name itself. E.G. population_growth_bonus bonus 1. However, population_growth_bonus bonus +1 also works. Sometimes omitting the "bonus" does work but can cause problems - for example, the building scroll may not display the actual bonus (even though it works), and no negative number can be introduced because the engine looks for either an integer (not a number with a "+" or "-" before it in this case) or the word "bonus".

In the original file farming_level, armour and the various weapon effects sometimes carry the stand-alone "bonus" and sometimes do not. It would seem that the cumulative and desired effect would necessitate "bonus" in each usage, but I do not know why this is not the case in the original file. "Armour 1" (for example) seems to ensure the armour attribute of the unit is 1 above the EDU-stated armour but is not cumulative (however, it does not seem to reduce higher armour so it is not setting the armour variable to "1"). So it also seems sensible to always use the "bonus" before integers for this grouping of effects.

Trade_fleet, mine_resource, road_level, and the games, races and the four defensive effects carry no stand-alone "bonus" in the EDB file.

Negative effects...

population_growth_bonus bonus -5 displayed the expected -2.5 in the building scroll but seemed not to affect the settlement population growth indicator on the settlement scroll. The same seems true for law_bonus and happiness_bonus. Religious_belief , however, does seem to work in the negative (this needs more testing). The general principle in actual terms is that a negative will only deduct from a positive; so a settlement with 15% law will drop to 0% law when a negative bonus of -20% is applied and not -5%.

Interestingly, giving negative bonuses to upgrades (in the format weapon_bladed bonus -1 for example) removes the unit with that weapon technology from being able to be recruited but is still listed as available in the relevant building scroll. A building that negates the negative bonus will restore the unit's availability for recruitment. Clued-up modders will see the potential for this feature :)

Notes on (hardcoded?) defensive effects...

The following defensive buildings (walls) seem to entail the following effects:

Palisade - wooden gate - arrow towers

Wooden wall - reinforced gate - arrow towers

Stone wall - reinforced gate - arrow towers (incendiary ability) - boiling oil

Large stone wall - iron gates - arrow towers (incendiary ability) - boiling oil

Epic stone wall - iron gates - ballista towers (incendiary ability) - boiling oil

Building Blocks - Faction_Capability

These are similar to capabilties except they are applied faction-wide rather than just in one settlement (regional). For example, inserting:

faction_capability
{
construction_time_bonus_defensive bonus 50 requires factions { parthia, }
}
after the Capabilty block of a building (and before the construction line) will, when such a building is built by Parthia, reduce building times of defensive structures (i.e. walls) by half in all Parthian settlements.

Building Blocks - End

The end of each building block comprises the construction time (in turns), the cost, the minimum level of settlement necessary for the building in question to be built, and upgrades (if any). Note that the latter is quite correct to be in the plural - you can list more than one upgrade (top-level buildings should of course have no upgrade listed).

Upgrades, it would seem, can also take conditionals. For more discussion and examples of this please see lim lucky's posts on page 6 of the EDB discussion thread here: https://forums.totalwar.org/vb/showt...t=50039&page=6

Code:
construction 3
cost 1200
settlement_min large_town
{
archery_range
}
}
You will find "plugins" at the very end of the building trees - to learn more about these, see Squid's Complete Guide to Plugins here: https://forums.totalwar.org/vb/showthread.php?t=101525

Note on Barbarian Building Trees

Although factions in the barbarian culture apparently can be designated 4th and 5th level settlements at game start there seems no mechanism for triggering upgrading past a third level settlement in the game itself. In other words the Barbarian culture is limited in its upgrades to (from a village) town - large town - city. It cannot upgrade to large or huge cities. You can read more about this in this thread: https://forums.totalwar.org/vb/showthread.php?t=49691 Of course, in BI this has all changed and all cultures may upgrade through all five government buildings.

Note on Building Names & Descriptions

The names and textual descriptions of all buildings (inc. the universal ones such as core_buildings) can all be specified per faction (as can building requirements, capabilities and faction capabilities of course). I have written a tutorial on this at https://forums.totalwar.org/vb/showp...2&postcount=56

Note on Multiple Temples & Indestructability of Buildings

Although some modders have reported that it is the initial prefix of the temple buildings (levels) that allows these buildings to be built in the same settlement as temples, my own research shows that removing the prefix in just the tree name will bring the same result (but without having to change all the other files associated with advice, traits, ancillaries, sound etc.)

Following this same logic we can now add the "hinterland_" prefix to building tree names to make previously destructible buildings indestructible - that is, it will disable the hammer button in the building scroll.

Note on Associated Files

data\export_buildings.txt

This file lists the in-game textual description of the building name, the building description, and a short version of the building description. It should match the code name in the EDB.

This file also contains the "_name" elements which provide the text for the building thread summaries (i.e. the text for each building type in the in-game Building Browser).

data\text\export_descr_buildings_enums.txt

This file enumerates the tags for the textual descriptions of the building names and descriptions (long and short). It seems to be an obsolete file.

data\descr_ui_buildings.txt

From discussion thread (thanks to Nikolai1962):

bunch of lines in this file of the form

temple_of_battle_shrine shrine
temple_of_battle_temple temple
temple_of_battle_large_temple large_temple
temple_of_battle_awesome_temple awesome_temple
temple_of_battle_pantheon pantheon
temple_of_farming_shrine shrine

what these all do is give the game an alternative name to look for when loading a building graphic. so in vanilla in tells the game for all the different temple buildings all the shrine level ones load the shrine graphic etc.

This can save on the number of graphics you have to keep track of, rename etc. For example if you had modded the game to have seperate barracks for each of the barb factions called brit_barracks, gaul_barracks etc, instead of having a separate graphic for each one you could write

brit_barracks barracks
gaul_barracks barracks
etc.

in this file and the game will look for the graphic called "#barbarian_barracks" in the UI folder/pak file.
Nero666 reports that deleting either of the lines referencing carthaginian near the start of the list in the DUB file will overcome the problem of not being able to add that culture to new buildings without causing an error. For more information please see link below:

Tools & Other Resources

EDB Recruit Lines Excel Macro by Godless Graham

Quietus's A Comprehensive Rome: Total War Guide (visit Economic section to read how buildings affect trade)

Also in the Complete Guide Series:

Dol Guldur is a researcher & developer for the Fourth Age:Total War mod.

2. ## Re: The Complete EDB Guide (WIP)

deleted - post transferred to discussion area.

sorry

3. ## Re: Guide: The Complete EDB Guide (WIP)

Is there any way to add new buildings all together?
or at least make buildings available for different factions, like, say i want to build an archery range as britons.
Could i just write in the faction name for that building?

4. ## Re: Guide: The Complete EDB Guide (WIP)

This is a tutorial (which contains the answer to your question btw), and all discussion relating to it should be posted here: https://forums.totalwar.org/vb/showt...635#post828635 (as it also says in the tutorial).

Do not post in this thread. Thank you.

5. ## Re: Guide: The Complete EDB Guide (WIP)

It is also possible to provide a choice of buildings.
The original code from above allows the contruction of the archery range

Code:
construction 3
cost 1200
settlement_min large_town
{
archery_range
}
}
In the example below, you will get two buildings offered to you and you must chose which one to construct. All the other rules regarding dscriptions apply.
Code:
construction 3
cost 1200
settlement_min large_town
{
archery_range1
archery_range2
}
}
This is an example codeline from the upcoming FOE project You can also add requirements based on faction or hidden resources

Code:
roman_govt_2 requires factions { rome_republic, } and hidden_resource italy
}
construction 8
cost 1200
settlement_min town
{
roman_govt_4
}

6. ## Re: Guide: The Complete EDB Guide (WIP)

This is already known and in the Guide...and used in many mods.

Please also note that posts (including research and findings) should be placed in the discussion thread, not this one.

7. ## Re: Guide: The Complete EDB Guide (WIP)

population_fire_risk works as 'fire_risk' only.

I think it refers to flamability in dbb.txt. I am using ALEX.exe.

I do not know the hex editor to look at CA files,so can only go by examples discussed here.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
Single Sign On provided by vBSSO