Mod

提供:ck3wiki
2021年1月6日 (水) 00:16時点におけるGnagaoka (トーク | 投稿記録)による版 (→‎Creating a mod)
ナビゲーションに移動 検索に移動
CK3 Modding #1 -Brief introduction to modding. Roll1D2 Games guide on useful tools and how-to mod beginner's guide.

Modding, or creating mods, is the act of modifying the assets or behavior of the game either for personal use, or to release publicly to other players, for instance via Paradox Mods or the Steam Workshop.

As with all Paradox games, Crusader Kings III is moddable to a great extent. Motivations of modders may vary widely; better translation to native language, more events or decisions, better map, major overhaul, cheating, etc.

This guide is intended to lower the entry barriers to the world of Crusader Kings III modding. However, 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 experimentation.

Important: the majority of mods will change the checksum, not allowing the player to get achievements. See checksum_manifest.txt in the game folder for the list of checksummed folders and files. The only safe mods are the ones that replace textures, shaders, fonts or music.

Tips & guidelines

  • Create a mod for your modifications: use a personal mod even for minor changes, and never directly modify the game files in the CK3 game folder as they may be overwritten without warning.
  • Use a good text editor to edit files and search through folders. The following are free:
    • Visual Studio Code. Has a fan-made CWTools extension with Paradox syntax highlighting, validation and tooltips for triggers and effects. To install it, go to Extensions on the left panel of VS and search for CWTools. (Note: validation rules are incomplete and will show many false errors in gui and localization files)
    • Notepad++. Choose Perl as your language, as it will provide good highlighting and allow to fold blocks of code and comments. To set it as default, go to Settings, Styler Configurator, find Perl in the list on the left and add "gui txt" (without quotes) to the "User ext." field at the bottom.
    • Atom. Doesn't include UTF-8-BOM encoding needed for localization files. Otherwise is very customizable. Choose Perl 6 as your language for better results. To set it as default, go to File, Config, find "core:" and add below it: "customFileTypes: "source.perl6": [ "txt" "gui"]", like in this example.
    • Sublime Text. There is an extension for it released by the developers of Imperator which could be used with CK3: Sublime Tools. It adds colored highlighting for effects and triggers. If you want to toggle comments in Sublime, you also need to add this file to the same "User" folder.
  • Always check the error.log file for execution errors. ...\Documents\Paradox Interactive\Crusader Kings III\logs
  • The log folder also contains lists of effects, triggers and scopes. Use "script_docs" and "DumpDataTypes" console commands in the game to generate them.
  • Start the game with -debug_mode -develop launch options to use the console and "reload gui", "reload gfx" commands.
    • On Steam: right-click the game on Steam -> Properties -> Set Launch Options -> add -debug_mode -develop
    • Windows: Create a shortcut for the .exe file -> right-click it -> Properties -> add -debug_mode -develop at the end of the Target field
  • The directory for the CK3 folder on Linux is ~/.local/share/Paradox Interactive/Crusader Kings III
  • Communicate key facts about your mod clearly and succinctly.
    • Your mod description should begin with a short but clear description of what your mod adds to or changes about the game. Don't begin with a changelog, or a long list of notices or pre-requisites, or installation instructions, etc.
    • Don't assume the person reading the description has ever heard of the mod before (if they had, they wouldn't generally be reading the description).
    • Clearly and visibly state whether your mod is Ironman-compatible. (Even if it seems obvious to you.)
  • Remove your local mod when you subscribe to the Steam version, otherwise it may not work in the game.
  • Backup your work. Either manually or with a source control system like Git. Also consider using GitHub for team collaboration.
  • Use a proper merge tool (like WinMerge) to merge between folders and update modified files for a new patch.
  • If you're replacing text across dozens or hundreds lines of code, you may want to use regular expressions. They are available in all of the text editors above. Learning resources: RegexOne, RegExr.

ローカライズファイル

  • localizationフォルダにある*.yml[1]ファイルはゲームで正しく読み込まれるようにするためにBOM付きUTF-8[2]でエンコードされて保存されている必要があります。
  • ゲームでファイルを正しく読み込むには、ファイル名を*l_<language>.ymlの形式で保存する必要があります。例:council_l_english.yml
    • "localization"とアメリカ英語のスペルを使用する必要があります。イギリス英語の"localisation"というスペルにすると動作しません。
    • 既存のローカライズ値を上書きするには、変更を加えたファイルをlocalization フォルダ内の「replace」という名前のフォルダに置きます。[3]

Modの作成

メイン記事へ: Mod structure#Creating initial files

Modの初期ファイル郡を作成するには、ゲームランチャーを使用することをお勧めします。

Uploading/updating a mod

Upload your mod again to update it.

  1. Open the launcher.
  2. Navigate to the "Mods" section.
  3. Press "Mod Tools", choose your mod from the dropdown menu.
  4. Choose what platform to upload it to.
  5. Enter any description. (If updating, make sure the launcher copied the most recent one from the site.)
  6. Add a thumbnail
    • For the Steam Workshop, put thumbnail.png in the mod folder. Use 1:1 ratio, 1MB max. The biggest thumbnail the Workshop displays is around 600x600 pixels.
    • For Paradox Mods, drag the thumbnail to the field below the description. Suggested minimum size is 900x500, png or jpg, 1MB max.
  7. Press "Upload".
    • On Steam, the mod will be uploaded in private mode and appear in your Steam Profile -> Workshop Items. Open it and change visibility on the side bar to Public to actually publish.
    • On Paradox Mods the mod will be published after the verification process. You may need to edit your description, as the site usually removes line breaks and BBCode formatting.

Save game editing

Save files are located in:

  • Windows: Documents\Paradox Interactive\Crusader Kings III\save games
  • Linux: ~/.local/share/Paradox Interactive/Crusader Kings III/save games

It is not possible to edit an ironman save!

First start the game in the debug mode and save.

  • On Steam: right-click the game on Steam -> Properties -> Set Launch Options -> add -debug_mode
  • Windows: Create a shortcut for the .exe file -> right-click it -> Properties -> add -debug_mode at the end of the Target field

PC:

  1. Find the save file in the save games folder.
  2. Right-click the save file and extract it like an archive with 7-Zip or WinRar.
  3. Rename the extracted 'gamestate' file to something with a .ck3 extension.
  4. Right-click it and open with your text editor (Windows Notepad is not recommended as the save files are very big).
  5. Edit the file and save it.
  6. Load it in the game.

Autosaves can be edited directly without extracting the gamestate.

Mac:

  1. Open Terminal
  2. Ensure that the directory is set to the correct folder
  3. Type in "unzip FileName.ck3"
  4. Rename the extracted 'gamestate' file to something with a .ck3 extension
  5. Edit this plain-text save
  6. Load it directly in the game (no need to re-compress)
OS Save type Location
Windows Local C:\Users\%USERPROFILE%\Documents\Paradox Interactive\Crusader Kings III\save games
Windows Steam Cloud C:\Program Files (x86)\Steam\userdata\####\1158310\remote\save games
Mac Local $HOME/Documents/Paradox Interactive/Crusader Kings III/save games
Linux Local $HOME/.local/share/Paradox Interactive/Crusader Kings III/save games

Contents of the gamestate file

The table below contains the possible first-level blocks in the gamestate file. Entries are provided in order of appearance.

Block Description
meta_data Contains metadata about the game, such as the game version. Used by the main menu screen.
ironman_manager Related to ironman saving.
(various variables) These variables do not belong in a block.
Variable
date
bookmark_date
first_start
speed
random_seed
random_count
variables Contains script flags.
game_rules Contains the save's current game rules.
provinces Contains province data, including buildings.
landed_titles Contains the following sub-blocks:
Sub-block Description
dynamic_templates
landed_titles
(repetition)
Contains an entry for each landed title in the game, in the format:
# Exact formatting in file is different in terms of spaces and lines
# It is usually more compact.
# It has been edited here for clarity and demonstration.


# Index for titles starts at 0
index={
	key="(title id)" # The one used in 00_landed_titles.txt, e.g. k_england

	de_facto_liege=(title index) # Optional
	de_jure_liege=(title index) # Optional. The number at the start of a similar block, NOT the title id
	de_jure_vassals={ (title index...) } # Optional, list of title indices.
	holder="(character id)" # Optional

	name="..."
	adj="..." # Optional
	pre="..." # Optional
	article="..." # Optional

	date=2020.10.27 # yyyy.mm.dd
	heir={ (character id...) } # Optional. List of character ids.
	claim={ (character id...) } # Optional
	history = { (...) } # Optional 
	capital=(province id)
	capital_barony=yes # Optional
	theocratic_lease=yes # Optional
	history_government="(government id)" # Optional
	laws={ "(law id)"... } # Optional. List of law ids.

	# Optional (succession_election).
	succession_election={
		electors = {  (character id...) }
		candidates={ (character id...) }
		nominations={
			{
				elector=(character id)
				candidate=(character id)
				strength=(value)
			}
		
		}
	} # end of succession_election block

	coat_of_arms_id=(coat of arms id)
	localization_key="(localization key)" # Optional

	# All below is used for mercenary bands
	special={
		type=mc
		identity=(id)
	}
	color=rgb { (r) (g) (b) }
	landless=yes
	destroy_if_invalid_heir=yes
	no_automatic_claims=yes
	definite_form=yes
}

In vanilla CK3, this block ends at entry ~12369.

index=(value)
(variable)
dynasties Contains the following sub-blocks:
  • dynasty_house (ends at entry ~6401)
  • dynasties (ends at entry ~6239)
  • static_dynasties (list of numbers)
  • static_dynasty_houses (list of numbers)
deleted_characters
living Contains entries of living characters. The following format is used for each character:
index={
	first_name="..."
	birth=(date)
	female=yes # Optional
	culture=(culture index)
	faith=(faith index)
	dynasty_house=(dynasty house index) # Optional
	skill={ (diplomacy) (stewardship) (martial) (intrigue) (learning) (prowess) } # One value for each skill
	sexuality=(sexuality id) # Optional
	dna="(dna string)" # Optional
	mass=(value) # Optional
	traits={ (trait index...) } # List of trait indices
	inactive_traits = { (trait index...) } # Optional. List of trait indices
	
	# Optional (family_data)
	family_data={
		primary_spouse=(character id)
		spouse=(character id)
		child = { (character id...) } # List of character ids
	}

	alive_data={

		# Optional (variables), contains flags
		variables={
			data={
				# (...)
			}
		}

		gold=(value) # Optional
		income=(value) # Optional
		location=(landed title index) # Optional
		fertility=(value)
		health=(value)
		piety={
			currency=(value)
			accumulated=(value) # Optional
		}
		prestige={
			currency=(value)
			accumulated=(value) # Optional
		}
		weight_update=(value)
	} # End of alive_data block

	court_data={
		# All keys within this block are optional
		employer=(character id)
		council_task=(council task index)
		regiment=(regiment index)
		knight=yes
	}

	# Optional (landed_data)
	landed_data={
		domain={ (landed title index...) } # List of landed title indices
		vassal_contracts={ (values) } # List of values
		became_ruler_date=(date)
		laws={ "(law id)"... } # List of law ids
		strength=(value)
		balance=(value)
		succession={ (character id...) } # List of character ids
		domain_limit=(value)
		vassal_limit=(value)
		vassals_towards_limit=(value)
		government="(government id)"
		realm_capital=(value
		ai_allowed_to_marry=yes
		council={ (value...) } # List of values
		at_peace_penalty=(value)
		diplo_centers={ (value...) } # List of values
		election_titles={ (landed title index...) } # List of landed title indices
	} # End of landed_data block

	# Optional (playable_data)
	playable_data={
		knights={ (character id...) } # List of character ids
		was_player=yes
	}

}

dead_unprunable Contains character entries.
characters Contains the following sub-blocks:
  • dead_prunable (contains character entries)
  • prune_queue
  • dummy_female (contains a character entry)
  • dummy_male (contains a character entry)
  • unborn (contains unborn data entries)
  • natural_deaths
  • current_natural_death
  • sexuality_chances
character_lookup
units
activities
opinions Contains the following sub-blocks:
  • active_opinions (contains opinion entries)
relations Encompasses hooks, alliances, Contains the following sub-blocks:
  • active_relations
schemes Contains the following sub-blocks:
  • active (contains scheme entries)
stories Contains the following sub-blocks:
  • active (contains story entries)
  • next=(date) (variable)
pending_character_interactions Contains the following sub-blocks:
  • data
  • player
secrets Contains the following sub-blocks:
  • secrets (contains entries of secrets) (repetition)
  • known_secrets
armies Contains the following sub-blocks:
  • regiments
  • army_regiments
  • armies
religion Contains the following sub-blocks:
  • religions
  • faiths
  • great_holy_wars
  • holy_sites
wars Contains the following sub-blocks:
  • active_wars
  • names
sieges Contains the following sub-blocks:
  • sieges (repetition)
raid Contains the following sub-blocks:
  • raid (repetition)
succession
holdings
ai Contains the following sub-blocks:
  • war_coordinator_db
  • war_plan_db
  • ai_stategies
county_manager Contains the following sub-blocks:
  • counties
  • monthly_increase (list of values)
fleet_manager Contains the following sub-blocks:
  • fleets
council_task_manager Contains the following sub-blocks:
  • active
important_action_manager Contains the following sub-blocks:
  • active
faction_manager Contains the following sub-blocks:
  • factions
culture_manager Contains the following sub-blocks:
  • cultures
  • template_cultures (list of numbers)
  • era_discovery
mercenary_company_manager Contains the following sub-blocks:
  • mercenary_companies
holy_orders Contains the following sub-blocks:
  • holy_orders
  • religion_name
  • faith_name
coat_of_arms Contains the following sub-blocks:
  • coat_of_arms_manager_name_map
  • coat_of_arms_manager_database (ends at entry ~17278)
  • next_id=(id) (variable)
(triggered events) Each triggered event has its own block, started using triggered_event={
next_player_event_id=(value) (variable)
played_character Contains the following sub-blocks:
  • name="..." (variable)
  • character=(character id) (variable)
  • player=(value) (variable)
  • important_decisions
  • legacy
  • rally_points
currently_played_characters={ (character id...) } List of character ids.


Extracting files From Microsoft Store version

If you want to read the files using the Microsoft Store version, you can use a program called UWPDumper to extract the files.

  1. Download the latest x64 binary of UWPDumper
  2. Enable Developer Mode (Windows Settings -> Update and Security -> For Developers -> Developer Mode).
  3. Run CK3.
  4. Run UWPInjector.exe from the program you just downloaded.
  5. Enter the number next to ck3.exe : ParadoxInteractive.ProjectTitus_zfnrdv2de78ny as the processID.
  6. Check where it is going to store the files (probably somewhere like C:\Users\%USERPROFILE%\AppData\Local\Packages\ParadoxInteractive.ProjectTitus_zfnrdv2de78ny\TempState\DUMP
  7. Wait for the program to finish.

The files should then be present in the directory specified earlier. If you want to edit the files, create a mod and copy the desired files there.

Tools & utilities

日本語化Mod

Xbox GamepassなどSteam以外でプレイしている人はSteamWorkshopオンリーでの配布なのでModファイルを自身で抽出する作業が必要

  • https://github.com/matanki-saito/Ck3JpMod
  • Releaseページへ移動
  • JSONファイルを開くとZIPファイルのリンク先がわかるのでそれをDLしModフォルダに展開
  • ゲームランチャーでModを有効化

外部リンク



  1. 訳者注:アスタリスク(*)は任意の長さの文字列を意味します
  2. 訳者注:ほとんどのテキストエディタはUTF-8と書いてある場合はBOMなしを意味します。BOM付きを保存できるエディタを用意してください。
  3. 訳者注:実例が日本語化MODのgithub repositoryにあるので参考にしてみてください。: https://github.com/matanki-saito/Ck3JpMod