How to Make New Buildings


By Mythic Commodore

This guide assumes that you have unpacked the data files using the method found here.

Also, it is assumed that you have an understanding of the export_descr_buildings.txt file. For information on that file, see my export_descr_buildings.txt guide. I will guide you through the process of making new buildings - in that process I will make two buildings myself, the Royal Palace and the Lampwright's Guild. Here is the code for those buildings:

    building city_hall { levels town_hall council_chambers city_hall mayors_palace royal_palace { town_hall city requires factions { northern_european, middle_eastern, eastern_european, greek, southern_european, } { capability { agent diplomat 0 requires factions { northern_european, } agent diplomat 0 requires factions { middle_eastern, } agent diplomat 0 requires factions { eastern_european, } agent diplomat 0 requires factions { greek, } agent diplomat 0 requires factions { southern_european, } law_bonus bonus 1 population_health_bonus bonus 1 } material wooden construction 2 cost 600 settlement_min large_town upgrades { council_chambers } } council_chambers city requires factions { northern_european, middle_eastern, eastern_european, greek, southern_european, } { capability { agent diplomat 0 requires factions { northern_european, } agent diplomat 0 requires factions { middle_eastern, } agent diplomat 0 requires factions { eastern_european, } agent diplomat 0 requires factions { greek, } agent diplomat 0 requires factions { southern_european, } recruit_pool "Carroccio Standard M" 1 0.2 2 0 requires factions { milan, } recruit_pool "Carroccio Standard V" 1 0.2 2 0 requires factions { venice, } law_bonus bonus 2 population_health_bonus bonus 2 } material wooden construction 3 cost 1200 settlement_min city upgrades { city_hall } } city_hall city requires factions { northern_european, middle_eastern, eastern_european, greek, southern_european, } { capability { agent diplomat 0 requires factions { northern_european, } agent diplomat 0 requires factions { middle_eastern, } agent diplomat 0 requires factions { eastern_european, } agent diplomat 0 requires factions { greek, } agent diplomat 0 requires factions { southern_european, } recruit_pool "Carroccio Standard M" 1 0.2 2 0 requires factions { milan, } recruit_pool "Carroccio Standard V" 1 0.2 2 0 requires factions { venice, } recruit_pool "Janissary Heavy Inf" 1 0.4 3 0 requires factions { turks, } law_bonus bonus 3 population_health_bonus bonus 4 } material wooden construction 4 cost 2400 settlement_min large_city upgrades { mayors_palace } } mayors_palace city requires factions { northern_european, middle_eastern, eastern_european, greek, southern_european, } { capability { agent diplomat 0 requires factions { northern_european, } agent diplomat 0 requires factions { middle_eastern, } agent diplomat 0 requires factions { eastern_european, } agent diplomat 0 requires factions { greek, } agent diplomat 0 requires factions { southern_european, } recruit_pool "Forlorn Hope" 1 0.4 3 0 requires factions { hre, } recruit_pool "Carroccio Standard M" 1 0.4 3 0 requires factions { milan, } recruit_pool "Carroccio Standard V" 1 0.4 3 0 requires factions { venice, } recruit_pool "Famiglia Ducale" 1 0.5 4 0 requires factions { milan, } recruit_pool "Janissary Heavy Inf" 1 0.5 4 0 requires factions { turks, } law_bonus bonus 4 population_health_bonus bonus 5 } material wooden construction 5 cost 4800 settlement_min huge_city upgrades { royal_palace } } royal_palace city requires factions { england, france, } { capability { agent diplomat 0 requires factions { northern_european, } agent diplomat 0 requires factions { middle_eastern, } agent diplomat 0 requires factions { eastern_european, } agent diplomat 0 requires factions { greek, } agent diplomat 0 requires factions { southern_european, } recruit_pool "Forlorn Hope" 1 0.4 3 0 requires factions { hre, } recruit_pool "Carroccio Standard M" 1 0.4 3 0 requires factions { milan, } recruit_pool "Carroccio Standard V" 1 0.4 3 0 requires factions { venice, } recruit_pool "Famiglia Ducale" 1 0.5 4 0 requires factions { milan, } recruit_pool "Janissary Heavy Inf" 1 0.5 4 0 requires factions { turks, } law_bonus bonus 6 population_health_bonus bonus 10 } material wooden construction 5 cost 4800 settlement_min huge_city upgrades { } } } plugins { } }

As you can see, the Royal Palace is simply the latest in the line of administrative structures. I will also be making an all-new set of buildings, the Lampwright's Guild.

    building guild_lampwrights_guild { levels lampwrights_guild m_lampwrights_guild gm_lampwrights_guild { lampwrights_guild city requires factions { northern_european, middle_eastern, eastern_european, greek, southern_european, } { capability { law_bonus bonus 6 } material wooden construction 1 cost 1000 settlement_min city upgrades { m_lampwrights_guild } } m_lampwrights_guild city requires factions { northern_european, middle_eastern, eastern_european, greek, southern_european, } { capability { law_bonus bonus 10 } material wooden construction 1 cost 2000 settlement_min large_city upgrades { gm_lampwrights_guild } } gm_lampwrights_guild city requires factions { northern_european, middle_eastern, eastern_european, greek, southern_european, } { capability { law_bonus bonus 16 } material wooden construction 1 cost 3000 settlement_min huge_city upgrades { } } } plugins { } }

As you can see, the guild provides huge law bonuses, which are caused by soldiers having access to better lamps to fight crime in the streets at night. Once the code is added into the export_descr_buildings file, the next step is to ensure that proper names appear in the game. To do this, you need to go to the text folder inside the main data folder. Look for a file called export_buildings.txt.strings.bin. Note that all of the files in that particular folder are in the .strings.bin file format. This cannot be modified, but a number of good converters exist. I suggest this one. The only problem is that you need to have the Python scripting language installed on your computer. Once you have used the converter, you can open up the newly-generated export_buildings.txt file and will be presented with a number of text lines. Here's what you need to add in for the Royal Palace:

    {royal_palace}Royal Palace

This is the official name of the building.

    {royal_palace_desc}The Royal Palace represents the final frontier in terms of ensuring that the people of a great city don't forget just who is in charge. This palace was commissioned and built under the watchful eye of the King himself, and will serve as home and office to whoever is appointed to govern the city.

This is the long description of the building, used when you open up the building information scroll.

    {royal_palace_desc_short}A Royal Palace does wonders to help maintain law and order, and also reduces squalor considerably.

This is the short description of the building, used for the condensed version of the construction report scroll.

Keep in mind that you can make faction or culture specific names for buildings by using the culture and faction names. For example:

    {royal_palace_england}Tower of London
    {royal_palace_england_desc}The Tower of London represents the final frontier in terms of ensuring that the people of a great city don't forget just who is in charge. This tower was commissioned and built under the watchful eye of the King himself and will serve as home and office to whoever is appointed to govern the city.
    {royal_palace_england_desc_short}The Tower of London does wonders to help maintain law and order, and also reduces squalor considerably.

Once you have made your edits to the text file you can start working on the UI elements - the pictures of the building that show up in general. Navigate to your data/ui/southern_european/buildings folder. This is where the default images for all of the different types of building are stored. Basically, there are six cultures in Medieval II: Total War. If I am playing as, say, England and I bring up the Building Information scroll for the Abbey, the game looks for the picture of the Abbey in the data/ui/northern_european/buildings folder because England belongs to the northern_european culture group. However, if the game cannot find a picture of an Abbey in the northern_european folder, it will look in the southern_european folder because the southern_european folder is the default folder for building images. The same holds true for all of the "UI elements" or pictures, with the exception of unit cards. So from a modder's perspective, all you have to do is put your image in the southern_european folder and it will all work. If you want to have, say, a different look for the northern_european buildings, then you can put a different image there. So anyway, navigate to your data/ui/southern_european/buildings folder. For the Royal Palace, put images in the folder and rename them to these names:

    #southern_european_royal_palace.tga

This image will be the little icon that shows up at the bottom of the screen whenever you have a city selected.

    #southern_european_royal_palace_constructed.tga

This image will be the large picture that shows up in the building information scroll.

Next navigate to the construction subfolder and put in an image with this name:

    #southern_european_royal_palace.tga

This image will be the little icon that shows up in the construction scroll.

Congratulations! Your building is now fully functional! However, if it is a guild, then you will never get the offer to get it. Why? You didn't modify the export_descr_guilds.txt file. Before we do that, though, a short explanation on how guilds work. Each guild requires a certain number of guild points, specific to that guild (for example, the Templars require Templar points). These points are never seen in the game and are a hidden value. You gain or lose points by doing certain actions. Once you have a certain number of points for a particular settlement, then you will get the offer to build a certain level of guild in that settlement. So, on to the export_descr_guilds.txt file. This file is divided into two halves. The first half defines the different types of guild and the second half defines how you gain and lose points for specific guilds. To get my Lampwrights' Guild working, I will need to add this to the first half of the file:

    ;------------------------------------------
    Guild lampwrights_guild
        building guild_lampwrights_guild
        levels  100 250 500

This tells the game that I need 100 points to get the Lampwrights' Guild, 250 points for the Master Lampwrights' Guild, and 500 points for the Lampwrights' Guild Headquarters. The second half is the triggers. These are a set of conditions and effects. To get the conditions, download the Ultimate Docudemons. If you have trouble opening the file, I suggest downloading one of two free programs - OpenOffice (recommended) or the Microsoft Excel file viewer. Go to the conditions page of the file for a list of conditions - note that not all will work. There is only one valid effect - the guild effect, used to add or subtract guild points. This is how it works:

Guild always goes first. Then you must specify a guild. Either type in the name of a guild after, or type "all" to have this add or subtract points to or from all guilds. In addition, you can type "this" if the condition mentioned a specific guild but that may not work. Then you can choose whether to add or subtract points from the settlement mentioned in the condition, if there is one, by typing the letter "s" afterwards, to add or subtract points from all settlements other than the one mentioned in the trigger, by typing the letter "o", or to add and subtract points from all settlements with the letter "a". Finally, you specify how many points to add or subtract. For example, "-10" will subtract 10 points. If this is all confusing, than this example may help.

    ;------------------------------------------
    Trigger 0282_Mission_Fail_Lampwrights_Min
        WhenToTest LeaderMissionFailed
    
        Condition PaybackID guild_lampwrights_min
    
        Guild lampwrights_guild a -10

This trigger will subtract 10 from the settlement mentioned in the trigger's points for all guilds.

Congratulations, you now know how to create and edit buildings! This knowledge, along with the knowledge of how to make new units will allow you to make basic, fully fledged modes of your own. Until next time.

Good Luck and please leave any feedback in this thread.
Mythic_Commodore