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.
Warning: do not set user_dir for sub-mods of a main mod, as all user_dir of active mods are concatenated.
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/characters"
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\""
"Another Mod" }
dependencies = { "MyMod" "\"Another Mod\"" }
supported_checksums
will evaluate to true. This can be used in event modding to display a warning to the player.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.
- achievements.txt
- defines.lua
- defines.txt
- hints.txt
- region_colors.txt
- static_modifiers.txt
- technology.txt
- 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
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.- policies\
- statuses\
Note: vanilla files were moved inside /dlc/dlc030.zip
Developers have discouraged this practice, as that engine behavior is not guaranteed to remain in the future (source?)
- ambitions\
- characters\
- coats_of_arms\
- cursors\
- eurfonts\
- event_pictures\
- flags\
- fonts\
- FX\
- interface\
- loadingscreens\
- mapitems\
- models\
- polishfonts\
- titles\
- traits\
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.
- generalstuff.gfx
- sound.sfx
- 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.
- 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
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.