Modding - Crusader Kings II Wiki (2024)

Please help with verifying or updating older sections of this article.
At least some were last verified for version 3.2.

Modding, or creating mods, is the act of modifying the behavior of the base game (often referred as vanilla), either for personal use, or to release publicly to other players, for instance via the Steam Workshop.

Motivations of modders may vary widely: better translation to native language, more events or decisions, better map, major overhaul, etc.

Modding is not magic or heresy, anybody can learn to build a mod, and this guide is intended to lower the entry barriers to the world of CKII modding.

Yet, however good the documentation, there is still a learning curve to it, and it cannot replace the need to read some working vanilla code and do lots of trial and error!

Mods are located in folder ~\Paradox Interactive\Crusader Kings II\mod, which must contain:

The name of the .mod file must not contain any white-spaces, otherwise it will not auto-select when re-starting the launcher.

KeyRequired?EffectExamplenameYesDefines the name that shows up in the launchername = "My Mod"pathYesDefines which folder is the mod's folder. It is relative to ~\Documents\Paradox Interactive\Crusader Kings II\ folder.path = "mod/MyMod"user_dirNoTells the launcher to store saved games and temporary files in a specific folder. This can be useful for mods incompatible with vanilla saves (because of new titles, flags, religions, cultures, buildings, etc.), so that things don't get mixed up.

Warning: do not set user_dir for sub-mods of a main mod, as all user_dir of active mods are concatenated.

user_dir = "MyMod"archiveNoDefines a zip-file instead of a folder. Alternative to path. It is relative to ~\Documents\Paradox Interactive\Crusader Kings II\ folder. This is the format used for mods downloaded from the Steam Workshop, but when uploading a mod to the workshop, path structure must be used instead.archive = "mod/mymod.zip"replace_pathNoTells the launcher to override everything in a folder, and load ONLY from the specified paths inside the mod. This is the only way to effectively remove stuff from vanilla, and is most often used for total conversion mods.

Notes:

  • replace_path works with folders, not files. To overwrite a file, just create a file with the same name in the mod.
  • replace_path only affects files in the specified folder, not files in sub-folders within that folder. For instance, replacing "history" does not replace "history/characters" as well.
  • To reduce mod size and improve mod compatibility, it is usually best to minimize the amount of folders that are replace_path.
  • replace_path is ignored when installing mod in the old Crusader Kings II\mod folder, hence why user mod folder must be used.
  • Unless you are sure you do need replace_path, you almost certainly don't.
replace_path = "history"

replace_path = "history/characters"

dependenciesNoTells the launcher that another mod has to be loaded before this one. The other mod will be loaded first, allowing the 2nd mod to override some files (otherwise the 1st mod would win). A dependency is not a hard requirement; you do not need a dependency loaded if the mod has one set. This is simply a way for the mod file to tell the launcher which files should be loaded first.

When adding a dependency, refer to its name as specified in the relevant .mod file. Do not use path or file names. If the name of the dependency includes space, you have to enclose the name in quotation marks. "Mod with space in name" This is optional for dependency names that don't include spaces.

Additionally, uploading a mod to the Steam Workshop will break this formatting. To counter this, prior to uploading, any dependencies excluding spaces in their name must be enclosed in quotation marks "NameWithoutSpace", and any dependencies using spaces must be enclosed in escaped quotation marks. "\"Name With Space\""

dependencies = { "MyMod"

"Another Mod" }

dependencies = { "MyMod" "\"Another Mod\"" }

pictureNoImage under mod folder to serve as banner for Steam Workshop (will be displayed as 268px × 268px JPEG)picture = "MyMod.jpg"tagsNoList of tags for Steam Workshop. Warning: don't forget quotes for tags that contain spaces.tags = { "Tag1" "Tag 2" }supported_checksumsNoList of expected checksums for which scripting condition supported_checksums will evaluate to true. This can be used in event modding to display a warning to the player.supported_checksums = { ABCD EFGH }

Small mods are the most common, and should neither use user_dir nor replace_path in order to keep compatibility with other small mods.

Overhaul mods typically use user_dir as saves wouldn't be loadable outside of the mod anyway.For total conversion mods, replace_path can be used to completely ignore vanilla directories that don't make sense in the context of the mod (history, flags, ...)

Sub-mods of a main mod typically use dependencies to be able to override files from main mod.

The game data is composed of hierarchy of folders, containing game files.

A mod follows the same folder structure as the base game, so that when loading the game the engine will combine files from vanilla and mod(s).In most folders, the engine will load all the files within, which allows a mod to add new definitions (titles, religions, ...) without having to copy and modify vanilla files.To make use of this, it is important to understand how the scripts are loaded both at file level and definition level.

Below is a list of CKII game files and folders, with associated modding guide, and loading behavior.

For loading behavior, the cell colours highlight whether the behaviour is the expected one, strange or requiring some attention, or unexpected and to be avoided.

File/FolderWhat it containsHow to modLoading behavior.\common\
  • achievements.txt
  • defines.lua
  • defines.txt
  • hints.txt
  • region_colors.txt
  • static_modifiers.txt
  • technology.txt
General information
  • Defines Steam Achievements
  • POP, general, diplomatic, economic and military variables
  • Defines playable start- and end-date
  • Defines the displayed hints
  • RGB code for each region
  • All difficulty, rank and standard modifiers
  • Technology data

Defines

Static modifiers
Technology modding

N/A.\common\alternate_start\Alternate start modding[?] Merge.\common\artifact_spawns\Artifact moddingMerge..\common\artifacts\Definitions of artifactsArtifact moddingMerge..\common\bloodlines\Bloodline modding.\common\bookmarks\Bookmarks are configured here (scenarios/start dates)Bookmark moddingMerge. Bookmarks are listed chronologically in-game, whatever the order in files..\common\buildings\Buildings folder, all buildings are stored here.Building modding[?] Merge.\common\cb_types\Casus Belli folder, all Casus-belli are stored here.Casus Belli moddingMerge, but override of casus belli by re-using same name does not work (creates duplicate casus belli).\common\combat_tactics\Combat tactics definitions.Unit modding[?] Merge.\common\council_positions\Conditions for an A.I. councillor to adopt a certain category of voting behavior.Councillor modding[?].\common\council_voting\A.I. rules for how councillors from a behavior category will voteCouncillor modding[?].\common\cultures\Cultures folder, all cultures are stored here.Culture moddingMerge. Since patch 2.4 cultures are merged like religions, and a new culture may be added to a vanilla culture_group via a separate file..\common\death\Death definitionsDeath modding.\common\death_text\Flavor text for succession screenDeath modding.\common\defines\Defines.Defines[?] Merge. Entries in files override common/defines.lua values..\common\disease\Diseases definitions.Disease modding[?] Merge.\common\dynasties\Dynasties folder, all dynasties are stored here.Dynasty modding.Merge. Duplicate dynasties loaded before vanilla (i.e., 000_ prefix) will overwrite dynasty shields. Duplicates loaded after (i.e., z_ prefix) will overwrite dynasty names. To overwrite both, use duplicate files, one with a preceding prefix and one with a succeeding prefix..\common\event_modifiers\Event_modifiers folder, all event modifiers are stored hereModifiersMerge..\common\execution_methods\Execution methodsDeath modding[?].\common\game_rules\Game rules definitionsGame rules moddingMerge. The rules are displayed in UI based on order of files (alphanumerical on file name), then order of rules within the file..\common\government_flavor\Government naming definitionsGovernment modding[?].\common\governments\Government definitionsGovernment moddingMerge. It is possible to define governments of the same government group in different files..\common\graphicalculturetypes\Graphicalculturetypes folder, all graphical culture types are stored here[?] Merge.\common\heir_text\Flavor text for succession screenDeath modding.\common\holding_types\Conditions for being allowed to build each holding type.Government modding[?]. It is not possible to add new holding types..\common\job_actions\Defines councillors actionsCouncillor moddingMerge..\common\job_titles\Defines councillors titlesCouncillor modding[?].\common\landed_titles\Landed_titles folder, all landed titles are stored here.Title moddingMerge. Merging behaviour is "complicated and might not have been designed that way intentionally"[1].\common\laws\Law moddingMerge. A law with the same name as an existing law will append conditions to the allow section, but not the potential section..\common\mercenaries\Mercenaries folder, all mercenaries are stored here[?] Merge.\common\minor_titles\Minor titles, including honorary titlesMinor title moddingCannot be overridden, attempts to do so will result in multiple minor titles with the same tags, like traits.\common\modifier_definitions\Defines dynamically defined modifiers, in particular special units modifiers.Unit modding[?] Merge.\common\nicknames\Nicknames folder, all nicknames are stored hereNickname moddingMerge..\common\objectives\Objectives folder, all objectives (i.e. ambitions, factions, plots and focuses) are stored here.Objective modding[?] Merge.\common\offmap_powers\
  • policies\
  • statuses\
Defines nations not represented on the map, but with a significant influence over it.Offmap power modding[?] Merge. Does NOT require Jade Dragon DLC..\common\on_actions\On_actions folder, all on_actions are stored hereEvent moddingMerge. Since patch 2.4 on_actions are merged, with new events being added to the previous list for a particular on_action, instead of replacing the list..\common\opinion_modifiers\Opinion modifiers folder, all opinion modifiers are stored hereModifiers[?] Merge.\common\province_setup\Deprecated since patch 3.0..\common\religion_features\Religion modding[?] Merge, but features with the same key get duplicated.\common\religion_modifiers\Religion_modifiers folder, all religion modifiers are stored here.Modifiers[?] Merge.\common\religions\Religions folder, all religions are stored here.Religion modding
Merge. Vanilla religions can be overridden, without needing to duplicate the whole religion group. Restrictions: need to define reformed religion before the non-reformed..\common\religious_titles\Religious_titles folder, all religious titles are stored here[?] Merge.\common\retinue_subunits\Retinue subunits folder, all retinue subunits are stored here[?] Merge, but retinues with the same key get duplicated.\common\save_conversion\Save game compatibility[?].\common\scripted_effects\Scripted effects[?] Merge.\common\scripted_score_value\Scripted score value[?] Merge.\common\scripted_triggers\Scripted triggersMerge, but scripted triggers with same name append their conditions rather than replacing the original one..\common\societies\Definition of societiesSociety moddingMerge, but override of societies by re-using same name does not work (creates duplicate societies).\common\special_troops\Special units definitionsUnit modding[?] Merge.\common\stories\Not used.N/A.\common\succession_voting\Succession voting rules and AI behaviorSuccession modding[?] Merge.\common\trade_routes\Trade route definitions.Trade route modding[?].\common\traits\Traits folder, all traits are stored here.Trait moddingMerge, but traits with same name will co-exist, and generated characters may get both versions of the trait at the same time. The last definition gets assigned to a character when using commands..\common\tributary_types\Tributary relationship definitions.Tributary modding[?].\common\triggered_modifiers\Defines global modifiers that trigger under certain conditionsTriggered modifiers[?] Merge.\connectui\Appears to be leftover interface for the discontinued Paradox Connect service (used in older Clausewitz games CK2 is based on).Unusable.\decisions\Decisions folder, all decisions are stored hereDecision moddingMerge, but override of decision by re-using same name does not work (breaks the decision effect, that does nothing).\dlc\Contains DLC information and zipped content filesDLC filesN/A.\dlc_metadata\??.\eu4_converter\Europa Universalis 4 Save Converter folder, all files related to the EUIV converter are stored here.

Note: vanilla files were moved inside /dlc/dlc030.zip

EU4 Converter modding[?].\events\Events folder, all events are stored here.Event moddingMerge. If redefining an event in a file loaded alphabetically after the original file, the event will be fully overridden.

Developers have discouraged this practice, as that engine behavior is not guaranteed to remain in the future (source?)

.\gfx\
  • ambitions\
  • characters\
  • coats_of_arms\
  • cursors\
  • eurfonts\
  • event_pictures\
  • flags\
  • fonts\
  • FX\
  • interface\
  • loadingscreens\
  • mapitems\
  • models\
  • polishfonts\
  • titles\
  • traits\
Graphics folder, all graphics are stored here.Graphics modding

Graphics are mapped to a logical name (GFX_xxx) inside .\interface\*.gfx files
Warning: a missing flag for a title in flags\ will cause wrong flags to appear for most titles, due to a shift.

.\history\Historical data for characters, titles, provinces and wars for the possible start dates. This is a likely the text export of an internal database, which is sometime mentioned in the patch notes.[2]History moddingN/A.\history\characters\Historical characters, optionally associated to a dynasty from \common\dynasties\ folder.Character modding[?] Merge. Duplicate character IDs break the character history and must be avoided..\history\diplomacy\Not usedN/AN/A.\history\offmap_powers\History of offmap powers (holder, status, ...)Offmap power modding[?] Merge.\history\provinces\History of provinces (holdings built, change of culture or religion)Province modding[?] Merge.\history\technology\Initial technology of provinces, depending on the start date.Technology modding[?].\history\titles\History of titles (list of successive holders)Note: titles that should be deactivated at game start (ex: reformed religion heads) must have an history file that disables the title.[?] Merge.\history\wars\Important on-going wars (attacker, defender, Casus Belli, war score, ...), usually for historical bookmarks.[?] Merge.\interface\
  • generalstuff.gfx
  • sound.sfx
Interface graphicsInterface modding
  • Sound modding
  • Loading of *.gfx files is in alphanumerical order. Last spriteType definition loaded overrides previous ones with same name, if any (i.e. use zz_ file prefix to override vanilla sprites).
  • Only sound.sfx is taken into account, other .sfx files are ignored.
.\interface\coat_of_arms\Coats of arms moddingCoat of arms definitions can be split across multiple files. No support for appending existing definitions from a different file..\interface\portrait_offsets\.txt files with external offsets for portrait framesPortrait modding.\interface\portrait_properties\Dynamic rules to select portrait properties valuesPortrait modding[?].\interface\portrait\Definitions of spriteType and portraitType elements for portraits.Portrait moddingMerge.\launcher\Launcher graphics and configurationN/A.\localisation\All text data for things like country names and event description, has options for other languagesLocalisationFull override. If duplicates are in different files, first file loaded wins (i.e. use 00_ file prefix to override vanilla keys). If in same file, last duplicate in file wins. Warning: files must end with .csv extension, or they will not be taken into account..\localisation\customizable_localisation\Custom localisation commands definitionsLocalisation#Customizable localisation[?] Merge..\map\
  • adjacencies.csv
  • default.map
  • definition.csv
  • geographical_region.txt
  • positions.txt
  • provinces.bmp
  • rivers.bmp
  • terrain.bmp
  • topology.bmp
  • trees.bmp
  • world_normal_height.bmp
Map settings, province shapes, continents, regions etc.Map moddingN/A.\map\staticsMap external frame size, and positions of fixed 3D map elements (wonders, etc.)Map modding.\map\terrainMap modding.\mod\Dummy mod folder, do not store mods here, use local mod folderMod fileBreaks mods, as configurations like replace_path are ignored..\music\Music used by the gameMusic modding[?] All .txt files song elements are loaded..\sound\All sounds except music[?].\tutorial\Tutorial configuration[?]

Only includes guides not already linked in the "How to mod" column above or otherwise.

Certain, more obscure console commands (that don't show up if you type 'help' in the console) are extremely useful in the process of testing a mod.

More Console commands are available on the main page, and are very useful for more specific alterations like adding lovers or killing people.

Modding - Crusader Kings II Wiki (2024)
Top Articles
Latest Posts
Article information

Author: Merrill Bechtelar CPA

Last Updated:

Views: 5765

Rating: 5 / 5 (70 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Merrill Bechtelar CPA

Birthday: 1996-05-19

Address: Apt. 114 873 White Lodge, Libbyfurt, CA 93006

Phone: +5983010455207

Job: Legacy Representative

Hobby: Blacksmithing, Urban exploration, Sudoku, Slacklining, Creative writing, Community, Letterboxing

Introduction: My name is Merrill Bechtelar CPA, I am a clean, agreeable, glorious, magnificent, witty, enchanting, comfortable person who loves writing and wants to share my knowledge and understanding with you.