Buildings are fairly simple to mod.
Building definitions are located in common\buildings\ folder.
Structure
Name | Type | Description | Example |
---|---|---|---|
potential | conditions (province scope) | Decides if the building shows up on the buildings list of a holding. FROM is the settlement holder (a character), FROMFROM is the holding (a barony title). | potential = { religion = catholic } |
desc | Key | Localization key for building description, used in the tooltip of the building. Follows <building_name>_desc convention. | desc = shipyard_desc |
add_number_to_name | bool | Makes the game use 1st level building name, and add number after it to name higher level buildings. | add_number_to_name = no |
replaces | building | The replaced building will not be constructible, even if its potential would match. Warning: don't replace a vanilla building that is part of a building chain ! prerequisites don't allow for the replaced building to be checked.
|
ca_steppe_barracks_1 = { replaces = ca_barracks_1 } |
trigger | conditions (province scope) | Requirements to be able to build the building. | trigger = { TECH_CASTLE_CONSTRUCTION = 0 } |
is_active_trigger | conditions (province scope) | The building will not apply its modifiers to the holding, unless the trigger conditions are satisfied. | is_active_trigger = { location = { OR = { port = yes borders_major_river = yes borders_lake = yes } } } |
port | bool | Can only be built on coastal province. Warning: This check fails if the county has no ruler, so beware if your mod relies on letting the game auto create rulers upon starting a new game. | port = yes |
prerequisites | List<building> | Other buildings requirements | ca_steppe_barracks_2 = { prerequisites = { ca_wall_1 } } |
not_if_x_exists | List<building> | Cannot build this building if another is (or others are) built. | not_if_x_exists = { ca_walls_1 ca_walls_2 } |
upgrades_from | building | The building replaces the one it upgrades from, but the modifiers are cumulated. | upgrades_from = tb_training_grounds_1 |
gold_cost | int | Gold cost to build the building. Mutually exclusive with prestige and piety cost. | gold_cost = 150 |
prestige_cost | int | Prestige cost to build the building. Mutually exclusive with gold and piety cost. | prestige_cost = 300 |
piety_cost | int | Piety cost to build the building. Mutually exclusive with gold and prestige cost. | piety_cost = 100 |
build_time | int | Time to build, in days | build_time = 365 |
ai_creation_factor | int | Chances for the AI to chose constructing this building. | ai_creation_factor = 95 |
ai_feudal_modifier | int | Modifies the ai creation weight if the ai is feudal, or is tribal but strive to become feudal. | ai_feudal_modifier = -10 |
ai_republic_modifier | int | Modifies the ai creation weight if the ai is a republic, or is tribal but strive to become a republic. | ai_republic_modifier = 5 |
extra_tech_building_start | double | When starting a new game, a building will be pre-built if the province has higher technology than the trigger requirement(s) + the value of extra_building_start + a random number 0-1 | extra_tech_building_start = 0.4 |
scouting | bool | Determines if the building gives vision of the province where it was built, like a Merchant Republic trade post. | scouting = yes |
convert_to_city | building | If the holding is converted to another type, the building gets converted to the equivalent building | convert_to_city = ct_wall_1 |
convert_to_castle | convert_to_castle = ca_keep_2 | ||
convert_to_temple | convert_to_temple = tp_town_1 | ||
convert_to_tribal | convert_to_tribal = tb_shipyard_1 | ||
<modifier_name> | Building modifiers | Modifiers provided by the building, in case is_active_trigger is valid. Modifiers are cumulative for upgraded building, see upgrades_from .
Notes:
|
fort_level = 0.5 light_cavalry = 35 horse_archers = 20 knights = 10 |
Example
Here is an example from common\buildings\00_Castle.txt:
ca_keep_6 = { desc = ca_keep_1_desc trigger = { TECH_FORTIFICATIONS_CONSTRUCTION = 8 } upgrades_from = ca_keep_5 gold_cost = 500 build_time = 2190 #6y levy_size = 0.3 garrison_size = 0.2 ai_creation_factor = 97 extra_tech_building_start = 0.2 }
Localization
- <building_name>: name of the building
- <building_name>_desc: description of the building
- <building_name>_<religion_group>: overridden name by religion group (at least for temple building)
Adding a new building
So lets assume you want to add a new building to the game. This guide will give basic instruction on how to create a basic working building. There are more polished and professional ways to attack this task, but they will all build upon the basic file structure and placement included below.
There are several decisions that you have to make in order to create a building that will work correctly. In what type of settlement will the building be located, castle, city, or temple? What type of restrictions will be placed on where the building can be created? What will be the bonuses or traits that this building grants?
First locate the "buildings" folder inside the CK2 file structure. Usually it is something like: C:\Program Files\Steam\SteamApps\common\buildings. Once you have located the "buildings" folder you will need to add an entry to the one of these files that corresponds with the type of building you wish to add. For this example I am going to add a simple statue to my castle that will provide some nice bonuses, so I will choose the 00_castle.txt file.
It is highly recommended that you use Notepad++ to edit the file and make a backup of this file before you make any changes.
Under the "castle = {" heading I am just going to copy the formatting of the first entry making minor changes to create my own building. My favorite starting location is Moray in Scotland, so I will restrict the building to only working in that province. I want the building to always be available for me to build, with modest costs, and some nice bonuses for my troops and income. It will look something like this:
castle = { ca_statue = { desc = ca_statue_desc potential = { OR = { province_id = 40 #Moray } } trigger = { always = yes } build_cost = 150 build_time = 91 knights = 50 levy_size = 0.5 tax_income = 5 } }
There are tons of different triggers and traits that can be added to buildings to make them unique and powerful! It may be worthwhile just looking at the other entries to learn how to personalize your building. This building will give my lord 50 heavy infantry, a 50% larger levy, and 5 as income!
Once these lines have been added to the 00_castle.txt file, the description tags need to be created in the localisation directory, it should be in the same folder where you found the "common" folder.
Using Notepad++ copy one of the .csv files and rename it for your own building. Open the file and delete all lines except for the top line (which only serves as a template and is not actually necessary). Follow the format that it explicitly outlines in the template on the top line, making sure not to miss any punctuation marks! If desired you can add these translations, just type the French description you wish to appear in place of the "FRENCH" on the appropriate line. I don't play the game in other languages, so I didn't add any translations. Mine looks something like this:
#CODE;ENGLISH;FRENCH;GERMAN;;SPANISH;;;;;;;;;x ca_statue;Heroic Statue;FRENCH;GERMAN;;SPANISH;;;;;;;;;x ca_statue_desc;This heroic statue stands as a testament for the deeds of the great men who came before and that all men can achieve greatness.;FRENCH;GERMAN;;SPANISH;;;;;;;;;x
After completing these steps you should have a Statue you can build in Moray.
Changing restrictions on holdings
It is not possible to add new Holding types, but you can define the conditions for being allowed to build each holding type. Definitions for those restrictions are located in the common\holding_types\
folder. The only thing supported within a holding is trigger
, which defines when it can be built. ROOT is the province, FROM is the builder. Some hardcoded restrictions also apply and cannot be overriden. For example, if you wanted to restrict building temples only to theocratic characters:
temple = { trigger = { FROM = { is_theocracy = yes } } }
历史 | 角色 • 家族 • 省份 • 头衔 • 剧本 |
脚本 | 指令 • 条件 • 作用域 • 修正 • 事件 • 决议 |
常规 | 定义 • 游戏规则 • 另类开局 • 宗教 • 文化 • 政体 • 特质 • 血脉 • 科技 • 法律 • 建筑 • 宣战理由 • 朝贡国 • 单位 • 目标 • 疾病 • 死亡 • 荣誉头衔 • 社团 • 宝物 • 地图外政权 • 内阁成员 • 贸易路线 • 继承 • 奇观 • 称号 |
图像/音效/本地化 | 地图 • 图形 • 盾徽 • 肖像 • 界面 • 小地图 • 音乐 • 本地化 |
其他 | 故障排除 • 验证器 • 控制台指令 • 编辑游戏存档 • Steam创意工坊 • EU4转档器模组制作 |