Modding
Modding (using 'mods', short for modification) in Victoria 3 provides players with the ability to alter various aspects of the game or incorporate new features, enhancing the overall gaming experience. While certain elements remain hardcoded and cannot be modified, such as the Migration or Battle casualty logic or map modes, a wide range of options are available for customization.
Mods do not disable achievements in Victoria 3, as the game has a separate rule governing this aspect.
Getting started[edit | edit source]
Setting up the mod folder[edit | edit source]
- Create a new folder in
Documents\Paradox Interactive\Victoria 3\mod, this new folder corresponds with thegamefolder in the base game.- Don't directly modify the game files, they will be overwritten with any game update.
- In the new folder, create your "common", "localization", etc. folders of your mod as needed.
- Follow the same structure as found in Victoria 3\game folder.
- Place .txt and other files for the actual content inside the appropriate folder.
- Add a
.metadatafolder with a metadata.json file inside. The file may be bare bones, but is a requirement in order for the game to load your mod at all. - Manually add your mod folder in the launcher with "Add more mods" in the playset.
Alternatively, use the Victoria 3 Mod Template from GitHub to set up the basic structure.
Basic tools and resources[edit | edit source]
File editors
- Utilize a source code editor with syntax highlighting and other helpful features, such as Code Search. Popular free programs for modding Victoria 3 include:
- Sublime Text has the best supported plugin: Victoria 3 Tools
- Visual Studio Code has the extension Paradox Highlight and CwTools(supports autocompletion, error checking, tooltips and more) available.
- IntelliJ (The Community Edition is free) has the extension Paradox Language Support available.
- Notepad++ is a less powerful choice, but may feel less overwhelming.
- Select Perl as your language syntax for some syntax highlighting since there are no specific plugins for Victoria 3.
Debug mode
- Use debug mode in order to access hidden developer information and tools in game.
- This can be done by launching in debug mode from the launcher by going to "Game settings" on the left sidebar and scrolling to the bottom
- Alternatively, add the following launch option in Steam by right clicking on Victoria 3 in the game library, select Properties in the pop up, then at the bottom of the General tab add
-debug_mode- This debug mode when launching from the main play button
- Debug mode also makes the game hotload most game files, letting you test changes more quickly without requiring relaunching the game.
- A few folder/files are not covered, such as on_actions; others might require returning to the main menu and starting a new session.
- Alternatively, there are also mods that allow activating and deactivating debug mode in-game, though they don't have the file hotloading functionality.
Documentation
- Use
script_docsandDumpDataTypescommands in the game console to generate other logs with event effects, triggers and scopes.- Access the console in-game with
^when debug_mode is active. - Generated files are located in
Documents\Paradox Interactive\Victoria 3\docs - This is the most reliable technical documentation you can get.
- Access the console in-game with
- Most of the documentation is also available on this wiki: see Effect, Trigger, Event target, and Data types for the main examples and see the navigation box at the bottom of this page for more documentation pages.
- The Modding Git Guide is a community made guide for using Git, GitHub/GitLab, and related tools such as KDiff3. It can be a useful stop for questions beyond this wiki, and contains step by step guides for much of what is talked about here. Though the examples are HOI4 based, the principles apply equally well to any Paradox game mod.
Best practices[edit | edit source]
- Use proper, tabbed indentation to ensure opening and closing brackets are on the same level. This allows for code folding, easier error spotting, and improved readability.
- Consider using an automatic formatting extension for your editor.
- When uncertain about implementation, search the base game code for relevant keywords using your editor.
- Use comments, which always start with
#, to document your script, to navigate easier, or to disable parts of code without deleting them. - Avoid overwriting items you don't want to change to minimize conflicts and enhance clarity.
Priority of modded files[edit | edit source]
- Using a filename that exists in vanilla will overwrite the original file completely.
- If several files with the same name are used by different mods, the lowest modlist position in the launcher is relevant.
- If an item is modified by several mods, the game will choose from the file sorted last ASCII-wise by filename.
- This takes priority over the position in the modlist in the launcher.
Debugging[edit | edit source]
- Read the error.log to find exceptions and warnings the game identified in
Documents/Paradox Interactive/Victoria 3/logs - Debug mode adds a button that opens the error.log for you and also shows its current number of errors since last open.
- The default editor used for this in Windows is Notepad, but it is configurable.
- You can either edit Documents/Paradox Interactive/Victoria 3/pdx_settings.json directly, adding the following keys under the
Systemkey:"editor": "C:\\Program Files\\Sublime Text\\sublime_text.exe"- tells the game which editor to use, you can use any valid editor on your computer, just make sure to use the correct path."editor_postfix": ":$:1"- this is used when opening the editor, for example this Sublime Text specific postfix makes sure the editor is opened scrolled to the latest line.
- Or you can use the ingame settings editor accessible through the in-game console, under the Settings button. Choose System in the Category selector and find the
Editorkey.
- Backup your work, things can go wrong and it is always good to have a backup.
- Using a version control system like Git allows you to track your changes, revert to a working version and collaborate.
- If you are part of a team, consider using GitHub for team collaboration. If you are new to Git, a program like Github Desktop is great for beginners.
- Set encoding to
UTF-8 with BOMinside your editor for code files, especially for localization .yml files. - For localization files, make sure your filenames end with l_language like
foo_l_english.yml. Note the first character in the suffix is an ell (lowercase L), not the numeral 1 or uppercase i. - Join the official discord and modding discord to ask other modders for help.
Overwriting game objects in 1.12[edit | edit source]
Version 1.12 brings a new method of overwriting and changing defined game objects.[1] Mods that do not adopt these changes are likely to cause unexpected behavior.
Keywords[edit | edit source]
INJECT– This mode tries to inject the script into an existing entry; the injected script is added to the end of the object. Errors if the respective entry does not exist.REPLACE– This mode replaces an existing entry with a new one. Errors if the respective entry does not existTRY_INJECT– Same asINJECTbut does not error if the entry does not existTRY_REPLACE– Same asREPLACEbut does not error if the entry does not existREPLACE_OR_CREATE– Same asREPLACEbut if the entry does not exist, it will create itINJECT_OR_CREATE– Same asINJECTbut if the entry does not exist, it will create it
Behavior[edit | edit source]
REPLACE keywords overwrite the specified object as expected, replacing any previous definition with the new one. Note that this still occurs in the usual loading order, so if multiple mods are trying to replace an object entry, the last one loaded "wins".
INJECT keywords add the specified blocks to the object without changing any previous definition. Certain types of blocks cannot be injected this way if that type of block is already defined. Namely, most trigger and effect blocks. For example, trying to inject an is_visible block into a law fails if that law already has a defined is_visible block; however, if the law does not have a defined is_visible block, injecting a new one works as expected. Note that INJECT does not work for scripted effects and scripted triggers. Using INJECT for either of these will result in the original effect/trigger getting overwritten.
When injecting blocks that can be defined multiple times, INJECT keywords append their content to the end of the object's definition. For example, given a base game strategy such as:
ai_strategy_default = {
#... some code
wargoal_scores = {
a = {
# some score calc
}
b = {
# some score calc
}
c = {
# some score calc
}
}
#... some code
}
Injecting the following from a mod:
INJECT:ai_strategy_default = {
wargoal_scores = {
d = {
# some score calc
}
}
}
Effectively results in the following:
ai_strategy_default = {
#... some code
wargoal_scores = {
a = {
# some score calc
}
b = {
# some score calc
}
c = {
# some score calc
}
}
#... some code
wargoal_scores = {
d = {
# some score calc
}
}
}
This can result in unexpected behavior if the injected blocks and the previously defined blocks try to refer to the same elements. If the injected block referred to a for example, it might overwrite the base game calculation or not be read.
Types[edit | edit source]
These files/types in the following folders – and only the following folders – support the new overwrite/extension functions.[2]
common/acceptance_statusescommon/achievementscommon/ai_strategiescommon/alert_groupscommon/alert_typescommon/amendmentscommon/battle_conditionscommon/building_groupscommon/buildingscommon/buy_packagescommon/character_interactionscommon/character_templatescommon/character_traitscommon/cohesion_levelscommon/combat_unit_experience_levelscommon/combat_unit_groupscommon/combat_unit_typescommon/commander_orderscommon/commander_rankscommon/company_charter_typescommon/company_typescommon/country_creationcommon/country_definitionscommon/country_formationcommon/country_rankscommon/country_typescommon/culture_graphicscommon/culturescommon/decisionscommon/decreescommon/diplomatic_actionscommon/diplomatic_catalyst_categoriescommon/diplomatic_catalystscommon/diplomatic_playscommon/discrimination_trait_groupscommon/discrimination_traitscommon/dna_datacommon/dynamic_company_namescommon/dynamic_country_map_colorscommon/dynamic_country_namescommon/dynamic_treaty_namescommon/ethnicitiescommon/flag_definitionscommon/game_conceptscommon/genescommon/geographic_regionscommon/goodscommon/government_typescommon/harvest_condition_typescommon/ideologiescommon/institutionscommon/interest_group_traitscommon/interest_groupscommon/journal_entriescommon/journal_entry_groupscommon/labelscommon/law_groupscommon/lawscommon/legitimacy_levelscommon/liberty_desire_levelscommon/military_formation_flagscommon/mobilization_option_groupscommon/mobilization_optionscommon/modifier_type_definitionscommon/objective_subgoal_categoriescommon/objective_subgoalscommon/objectivescommon/partiescommon/political_lobbiescommon/political_lobby_appeasement (factor)common/political_lobby_appeasement (reason)common/political_movement_categoriescommon/political_movement_pop_supportcommon/political_movementscommon/pop_needscommon/pop_typescommon/power_bloc_coa_piecescommon/power_bloc_identitiescommon/power_bloc_map_texturescommon/power_bloc_namescommon/power_bloc_principle_groupscommon/power_bloc_principlescommon/prestige_goodscommon/production_method_groupscommon/production_methodscommon/proposal_typescommon/religionscommon/script_valuescommon/scripted_buttonscommon/scripted_effects (REPLACE only)common/scripted_guiscommon/scripted_listscommon/scripted_modifierscommon/scripted_progress_barscommon/scripted_rules (REPLACE only)common/scripted_triggers (REPLACE only)common/social_classescommon/social_hierarchiescommon/state_traitscommon/strategic_regionscommon/subject_typescommon/technologycommon/terraincommon/terrain_manipulatorscommon/themescommon/treaty_articlescommon/tutorial_lesson_chainscommon/tutorial_lessonscommon/war_goal_typesgfx/map/army_dioramasgfx/map/city_data/city_building_vfxgfx/map/fleet_dioramasgfx/map/fleet_entitiesgfx/map/front_entitiesgfx/portraits/accessoriesgfx/portraits/portrait_modifiersgui_animationsmodifier_iconsmusicnotificationssound/persistent_objects
Files/types in other folders have not changed their overwriting behavior and do not support this new replace/inject format.
Modding articles[edit | edit source]
- Country modding
- Event modding
- Journal modding
- Modifier modding
- Flag modding
- Model modding
- Goods modding
- Building modding
Tools and utilities[edit | edit source]
| Name | Category | Link(s) | Description |
|---|---|---|---|
| Paradox Highlight | Editor (VS Code) | VS Code Marketplace | Up-to-date syntax highlighting for all Victoria 3 files. Other paradox games like Crusader Kings III are also supported. |
| CWTools - Paradox Language Services | Editor (VS Code) | VS Code Marketplace | For editing Paradox game files in Visual Studio Code. It has syntax-highlighting, error checking, auto-completion and more. Based on the Cwtools library for parsing, editing, and validating Paradox Interactive script files. |
| Victoria 3 Tools | Editor (Sublime Text) | GitHub | Victoria 3 Syntax for Sublime Text 4 |
| Paradox Language Support | Editor (IntelliJ) | JETBRAINS Marketplace | The Intellij IDEA plugin for Paradox Interactive game modding. It has syntax-highlighting, error checking, auto-completion and more. |
| Victoria 3 Modding Support | Editor (IntelliJ) | JETBRAINS Marketplace | Adds support for the Victoria 3 definition and modding files. It has syntax-highlighting. |
| Tiger Mod Validator | General | GitHub | Tiger pounces on bugs. Checks Crusader Kings 3, Victoria 3, or Imperator: Rome user mod files for mistakes and warns about them. For example: missing localizations, or using a faith trigger on a character. |
| Tiger Mod Validator for VSCode | Editor (VSCode) | VS Code Marketplace | An extension for VS Code that integrates Tiger logs with Problems tab and allows to see issues directly in the IDE. |
| Tiger Mod Validator Github Action | General | GitHub | A base repo and guide on how to setup ck3-tiger as a GitHub workflow action. |
| Pdx-Unlimiter | General | GitHub | A powerful and smart savegame manager; it can edit save files and it can preview modded flags without starting the game. |
| Map data editor | General | GitHub | A mapdata editor to edit mapdata in common/history/states visually, it is helpful to edit the which provinces are which countries. |
| Vicky-Mapgen | General | GitHub | A Map Generator generates provinces by heightmap.png and boundaries.png |
| Music Mod Creation Tool | General | GitHub | As its name, it is for music mod, and now it supported Vic 3 |
| UWPDumper | General | GitHub | A tool to extract files from Microsoft Store games. |
| Clausewitz Maya Exporter | General | Paradox Forums | A tool to create and export 3D models to use in vic3 and other Clausewitz games. |
| Jomini.js | General | GitHub | A powerful parsing library in javascript based on webassemby, has a C version named Rakaly. |
| Victoria 3 Mod Template | General | GitHub | A template to set up a GitHub repository for Victoria 3 mods. |
Common problems[edit | edit source]
- Some local mod files fail to load.
- Symptoms:
- A mod is correctly shown up in the launcher, it is added to the playset, but some files do not have an effect.
error.logcontains a line such as[virtualfilesystem.cpp:562]: Could not create lexer from file due to 'fopen() failed: 2'followed by a line about encoding.- Potentially also problems with opening
error.logby clicking on the error deer in game launched with the-debug_modeflag.
- Likely causes:
- Permissions. The game could have trouble accessing the mod files due to broken permissions.
- File path containing non-ASCII characters. Victoria 3 has troubles with this (similarly to other games such as Hearts of Iron IV). In Windows, this can happen due to the user's username, and therefore the user folder containing Documents/Paradox Interactive/Victoria 3/, containing non-ASCII characters. You can easily check whether this is the case by looking at your filepath.
- Solutions:
- You can change the location of local mods by editing Steam/steamapps/common/Victoria 3/launcher/launcher-settings.json, at the line
"gameDataPath": "%USER_DOCUMENTS%/Paradox Interactive/Victoria 3",. - For example, if you change that line to
"gameDataPath": "C:/Paradox Interactive/Victoria 3",, then the local mod folder would be at C:/Paradox Interactive/Victoria 3/mod instead of its default location.
- You can change the location of local mods by editing Steam/steamapps/common/Victoria 3/launcher/launcher-settings.json, at the line
- Symptoms:
Game object reference[edit | edit source]
|
|
This section needs clarification. |
Dependency and Folder Structure[edit | edit source]
If you want to add a new game object, you will need to keep in mind which more fundamental objects it depends on, and how to organize the files so the game recognizes it.
All paths are relative to the 'game' folder inside your Victoria 3 install directory, as that is where all scriptable parts of the game are located.
Note: objects with no dependencies may still reference primitive objects (numbers, strings etc) or core game concepts, but no object type that mods can edit or define, only change the parameter value of. Nested references, especially within modifiers, are generally also not counted, since modifiers can have arbitrary dependency relations.
| Object type | Path | Dependencies |
|---|---|---|
| Professions | common/pop_types | |
| Goods | common/goods | |
| Needs | common/pop_needs |
|
| Eras | common/technology/eras | |
| Technologies | common/technology/technologies |
|
| Institutions | common/institutions | |
| Law groups | common/law_groups | |
| Laws | common/laws |
|
| Ideologies | common/ideologies |
|
| Interest group traits | common/interest_group_traits | |
| Interest groups | common/interest_groups |
|
| Production methods | common/production_methods |
|
| Production method groups | common/production_method_groups |
|
| Building groups | common/building_groups |
|
| Buildings | common/buildings |
|
Parameters[edit | edit source]
When creating a scripted object, there are a number of required and optional elements. See the specific pages on each type of scripted object for details
See also[edit | edit source]
Guides[edit | edit source]
References[edit | edit source]
- ↑ Adapted from the Modding Digest by Bahmut.
- ↑ This list was provided by the modding community's very own industry plant: Doodlez
| Documentation | Defines • Effects • Event targets • Scopes • Triggers Macros • Modifier types • On actions • Script value • Variables GUI script • Localization |
| Scripted content | Decisions • Events • History • Journal • Modifiers • Objectives • Scripted gui • Customizable localization |
| Scripted types | Buildings • Characters • Concepts • Countries • Culture • Decrees • Diplomacy • Goods • Institutions • Interest groups • Laws • Parties • Pops • Power blocs • Religion • Subject types • Technology • Treaties • War goals |
| Map | Map • States |
| Graphics | 3D Models • Interface • Graphical Assets • Fonts • Flags |
| Audio | Music • Sound |
| Other | AI • Console commands • Checksum • Mods • Mod files load order • Mod structure • Scripted tests • Troubleshooting |
| Guides | Mod translation • New country modding • Save-game editing • State modding guide |