Adding New Buildings

From Europa Universalis 3 Wiki
Jump to navigation Jump to search

This article is accurate for the latest versions of EU3, Napoleon’s Ambition, In Nomine, Heir to the Throne and Divine Wind.

This is a description of all of the files you need to update to add buildings to the game. This requires changes to several files, including art assets. If you do it wrong it can cause CTDs. The example used is for a Stock & Commodities Exchange I am adding to Magna Mundi as part of the trade system I am working on.

buildings.txt

First you will need to add the new building to buildings.txt. Where you place it in the file is very important. You NEED to place it before the Manufactories section or you may experience CTDs when users access the Ledger. Make sure to place all additional buildings before the #Manufactories section (Fort upgrades are an exception to this rule).

Here is an example of a building. I placed this after the Marketplace in the buildings.txt file.

exchange = { prerequisites = { marketplace } cost = 2000 time = 60 trade_income = 10 manufactory = { } }

government.txt / land.txt / naval.txt / production.txt / trade.txt

The technology files flag if a building can be built or not. If you do not add the building to a technology file, it can never be built. Add a buildingname = yes tag to the technology level you want to be the prerequisite for the building.

technology = { id = 16 average_year = 1600 trade_efficiency = 0.56 merchant_placement_chance = 0.285 merchant_compete_chance = 0.285 exchange = yes }

Localisation

This data is usually in the text.csv and other localisation files. You need to add the correct information to the localization file for text to be displayed for the building.

exchange;Stock & Commodities Exchange;Stock & Commodities Exchange;Stock & Commodities Exchange;Stock & Commodities Exchange;Stock & Commodities Exchange;Stock & Commodities Exchange;;x exchange_short;Stock & Commodities Exchange;Stock & Commodities Exchange;Stock & Commodities Exchange;Stock & Commodities Exchange;Stock & Commodities Exchange;Stock & Commodities Exchange;;x

BUILDINGSLEDGER_BUILDINGS_EXCHANGE_S;Stock & Commodities Exchange;x BUILDINGSLEDGER_BUILDINGS_EXCHANGE_L;A Stock & Commodities Exchange is an organization which provides facilities for stock & commodities brokers and traders, to trade company stocks, commodities, and other securities.;x

buildings_languagegfx.tga

Ok, this is where the art assets need to be changed. Before you do anything else, you need to create a new directory in your Mod folder to hold new art assets. Create a folder called "images" in your mod folder. There are a total of 8 different building files that need to be altered to add a building, one for each regional grouping. These files are:

  • \gfx\interface\buildings_africangfx.dds
  • \gfx\interface\buildings_chinesegfx.dds
  • \gfx\interface\buildings_easterngfx.dds
  • \gfx\interface\buildings_indiangfx.dds
  • \gfx\interface\buildings_latingfx.dds
  • \gfx\interface\buildings_muslimgfx.dds
  • \gfx\interface\buildings_northamericagfx.dds
  • \gfx\interface\buildings_southamericagfx.dds

Use DDS Converter 2 or other DDS converter to convert these files to TGA format. TGA format can be natively read by EU3. Copy the TGA files to the "Images" folder you created. Open up all of these files in your favorite image editor such as Macromedia Fireworks, Adobe Photoshop, or Gimp.

The original files will have a dimension of 1104 pixels width by 48 pixels height. For each additional building you will need to add 48 pixels to the width. In my example I add one building, so I add 48 pixels to the canvas width for a total of 1152 pixel width. Once you have added the width then you need to alter the image to allow for the new building. The order of the buildings matter. They need to be in the same order they are in the buildings.txt file. In my example, I put the Exchange after the Market, so I need to add the Exchange building image after the Market image. You need to make this change to all 8 of the building files. If you are a skilled artist you may even want to make them look correct for each region.

ledger_buildings.tga

For the new building to appear correctly in the Ledger without causing CTDs, you need to alter the ledger_buildings.dds file. Once again, use DDS Converter 2 or other DDS converter to convert this file to TGA format. Then copy the file to the "images" folder you created.

Open the ledger_buildings.tga file in your favourite image editor. The original files will have a dimension of 176 pixels width by 16 pixels height. For each additional building you will need to add 16 pixels to the width. In my example I add one building, so I add 16 pixels to the canvas width for a total of 192 pixel width.

Once you have added the width then you need to alter the image to allow for the new building. The order of the buildings matter. They need to be in the same order they are in the buildings.txt file. In my example, I put the Exchange after the Market, so I need to add the Exchange building image after the Market image.

provincepanel.gfx

Now you need to edit the interface files to display the new art work as well as expand on the size of the window so it can display more buildings. We are going to start with changing the artwork. To change this you will first need to change provincepanel.gfx.

You need to replace all of the building pointers to the new location. This needs to be formatted like this "mod\\ModFolderName\\images\filename.tga". Also, you need to change the noOfFrames to the correct value. The default is 23, so if you add one more building you need to change it to 24.

Here is an example:

spriteType = { name = "GFX_building_latingfx" texturefile = "mod\\MagnaMundi\\images\\buildings_latingfx.tga" noOfFrames = 24 effectFile = "gfx\\FX\\buttonstate.fx" loadType = "INGAME" norefcount = yes }

spriteType = { name = "GFX_building_easterngfx" texturefile = "mod\\MagnaMundi\\images\\buildings_easterngfx.tga" noOfFrames = 24 effectFile = "gfx\\FX\\buttonstate.fx" loadType = "INGAME" }

spriteType = { name = "GFX_building_muslimgfx" texturefile = "mod\\MagnaMundi\\images\\buildings_muslimgfx.tga" noOfFrames = 24 effectFile = "gfx\\FX\\buttonstate.fx" loadType = "INGAME" }

spriteType = { name = "GFX_building_indiangfx" texturefile = "mod\\MagnaMundi\\images\\buildings_indiangfx.tga" noOfFrames = 24 effectFile = "gfx\\FX\\buttonstate.fx" loadType = "INGAME" }

spriteType = { name = "GFX_building_chinesegfx" texturefile = "mod\\MagnaMundi\\images\\buildings_chinesegfx.tga" noOfFrames = 24 effectFile = "gfx\\FX\\buttonstate.fx" loadType = "INGAME" }

spriteType = { name = "GFX_building_africangfx" texturefile = "mod\\MagnaMundi\\images\\buildings_africangfx.tga" noOfFrames = 24 effectFile = "gfx\\FX\\buttonstate.fx" loadType = "INGAME" }

spriteType = { name = "GFX_building_northamericagfx" texturefile = "mod\\MagnaMundi\\images\\buildings_northamericagfx .tga" noOfFrames = 24 effectFile = "gfx\\FX\\buttonstate.fx" loadType = "INGAME" }

spriteType = { name = "GFX_building_southamericagfx" texturefile = "mod\\MagnaMundi\\images\\buildings_southamericagfx .tga" noOfFrames = 24 effectFile = "gfx\\FX\\buttonstate.fx" loadType = "INGAME" }

ledger.gfx

Next you need to change ledger.gfx. This is very important, if you do not change it you will likely get CTDs in the ledger. Change the GFX_ledger_buildings pointer to "mod\\ModFolderName\\images\filename.tga". Also, you need to change the noOfFrames to the correct value. The default is 11, so if you add one more building you need to change it to 12.

Here is an example:

spriteType = { name = "GFX_ledger_buildings" texturefile = "mod\\MagnaMundi\\images\\ledger_buildings.tga" noOfFrames = 12 }

ledger.gui

You have to add a new iconType to this file and renumber the existing iconTypes. If you do not do this you will likely experience CTDs in the ledger. Near the end of the file there is a list of iconType for the various Buildings that are displayed in the ledger. You need to add a new iconType for your new building with the correctly formatted name (ledger_buildings_newbuildingname) in the correct order to match the ledger_buildings.tga file. Then you need to renumber the frame= value for the building iconTypes so they each have a unique number in the correct order.

In my example, the new iconType is frame 8. All buildings after this frame I added +1 to adjust for the new building.

iconType = { name ="ledger_buildings_exchange" spriteType = "GFX_ledger_buildings" frame = 8 position = { x= 0 y = 0 } Orientation = "UPPER_LEFT" }

provincepanel.gui

This change is made to allow you to put a few new buildings in the interface without having them bleed out of the province window. Go to the building_overlay section of the document (around line 2000). And change the "position = { x = 48" values from 48 t0 30 and change the horizontal_offset value from x = 56 to x = 50.

Here is an example of what it should be:

positionType = { name = "buildingbutton_row_1" position = { x = 30 y =25 } }

positionType = { name = "buildingbutton_row_2" position = { x = 30 y =81 } }

positionType = { name = "buildingbutton_row_3" position = { x = 30 y =168 } }

positionType = { name = "buildingbutton_horizontal_offset" position = { x = 50 y = 0 } }

A few notes

The only thing I have not explained is how to make the building appear in the 3d building window. You can do technically do this, but it adds a whole new level of complexity and potential CTDs. It should be noted that you do not need to do this, as it works perfectly fine if you don't have a 3d model for the building loading.

For smaller builidng buttons in province panel, you should

  • Get all culture gfxs smaller (original height: 48 pixel, 32pixel is good)
  • Get buildings_overlay.dds smaller (original height: 48 pixel, 32pixel is good)
  • Get suitable horizontal offset value (original value:56 - Must be slightly higher than height of buildings_overlay.dds )
  • Set a more left starting position to gain more space