模组结构:修订间差异

本页面所适用的版本可能已经过时,最后更新于1.1
(咯咯炀移动页面Mod structure模组结构
无编辑摘要
第1行: 第1行:
{{需要翻译}}
{{version|1.1}}{{需要翻译}}
Mod位于该路径下 ''~\Paradox Interactive\Crusader Kings III\mod'', 里面必须包含:
Mods are located in the folder ''~\Paradox Interactive\Crusader Kings III\mod'':
* Default on Windows: {{cite file|%USERPROFILE%\Documents\Paradox Interactive\Crusader Kings III\mod}}
* Default on Linux: {{cite file|~/.local/share/Paradox Interactive/Crusader Kings III/mod}}
Each mod requires two parts. Both must be located in the folder above and share the same name, barring file extensions; otherwise, the game launcher will ''not'' recognise the mod. Note that folder and file names are case sensitive on Mac and Linux.
* A .mod file, a plain text file with metadata required to use the mod.
* A mod folder containing files specific to modding the game, such as events, images, decisions and characters. It may also be a .zip file instead.


* 一个 *.mod 文件, 用于告诉启动器如何处理mod文件夹
== Creating initial files ==
* mod 文件夹或者是压缩包包含了mod的数据。mod数据必须和游戏本体中 CK2game.exe 所在路径的文件和文件夹架构一致。注意文件和文件夹名称在Mac和Linux系统上需要区分大小写。
 
It is recommended to generate the initial mod files through the game launcher in the interests of speed and avoiding human error.
# Open the game launcher.
# Navigate to the "Mods" section, either by scrolling or pressing the "Mods" tab under the play button.
# Press the "Mod tools" button underneath your current playset.
# Press the "Create a mod" button.
# Here, you can create your mod with a name, version (mod, not game), directory (will always be located in the game's mod folder described above) and any tags. The tags offered by the launcher include:
{| class="wikitable"
|-
| Alternative History || Historical
|-
| Balance || [[Map modding|Map]]
|-
| [[Bookmarks modding|Bookmarks]] || Portraits
|-
| Character Focuses || [[Religion modding|Religion]]
|-
| Character Interactions || Schemes
|-
| [[Culture modding|Culture]] || [[Sound modding|Sound]]
|-
| [[Decision modding|Decisions]] || Total Conversion
|-
| [[Event modding|Events]] || [[Localization|Translation]]
|-
| Fixes || Utilities
|-
| Gameplay || Warfare
|-
| Graphics
|}
 
It is also possible to change the suggested game version, thumbnail and description (for Steam Workshop) by going back to the "Mod tools" menu, and then selecting your mod in the drop-down list.
 
This process will create the following:
* The mod folder, named after your mod.
* A ''descriptor.mod'' file, contained within the mod folder.
* Another .mod file, this one named after the mod, located alongside the mod folder.


== *.mod 文件 ==
== *.mod 文件 ==


注意:使用Crusader Kings III启动器,您可以通过导航到 <Mods> -> <Mod Tools (Next to Manage Mods)> -> <Create Mod> 并键入以下内容来生成mod文件夹及其对应的* .mod文件。 相应的名称,版本,版本兼容性,图标,标签和mod文件夹目录/ 存档。 由于以这种方式开始创建mod容易得多,因此强烈建议您首先进行此操作,然后根据需要对* .mod文件进行更改。
The .mod files used by the game are plain text files that contain metadata about their corresponding mod. There are two .mod files for every mod:
* ''(modname).mod'', located ''alongside'' the mod's folder. This one is required; without it, the launcher will not recognise the mod.
* ''descriptor.mod'', located ''within'' the mod folder. It is recommended to keep this file consistent with the other one, excluding the line containing the ''path'' key which is not needed in the descriptor file.
 
=== Syntax ===
 
Similar to other game files, single-line comments can be started using hash (<code>#</code>). To set a value to a key, use the format <code>key="value"</code> for single values; alternatively, use the following structure for lists:
<pre>
list={
"element0"
"element1"
"element2"
}
</pre>


== mod 文件夹 ==
=== Keys ===
The table below describes the keys available for use within the .mod file.


.mod 文件的内容:
{| class="wikitable"
{| class="wikitable"
! Keys
! Required?
! Description
! Example
|-
| name
| Yes
| Determines the name that shows up in the launcher.
| name="My Mod"
|-
|-
! Key !! Required? !! Effect !! Example
| version
| Yes
| Allows you to define a version of your mod, defined as a string.
| version="0.0.1"
 
|-
| tags
| No
| Sets the tags that mod is considered part of. Correlates with Steam Workshop categories.
|
<pre>
tags={
"Culture"
"Decisions"
"Fixes"
}
</pre>
 
|-
|-
| name || Yes || 在启动器中显示的名称 || name="My Mod"
| supported_version
| Required for file alongside mod folder; not required for descriptor.mod
| Defines the latest game version the mod supports; launcher will show a warning if a mod is outdated. The game uses semantic versioning (MAJOR.MINOR.PATCH). Wildcards (<code>*</code>) may be used to define a range of versions.
| supported_version="1.1.3"
 
|-
|-
| path || Yes || Defines which folder is the mod's folder. It is NO LONGER RELATIVE to The CK3 folder. Instead, you must use the entire file path. || path = "C:/Users/Example/Documents/Paradox Interactive/Crusader Kings III/mod/my_mod"
| path
| Yes
| Sets which folder is the mod's folder. Note that it is no longer relative to the main ''Crusader Kings III'' folder, but rather to the Crusader Kings III user folder (described above). Alternatively, one can use the entire path.
|
* <code>path="C:/Users/Example/Documents/Paradox Interactive/Crusader Kings III/mod/my_mod"</code> (Windows)
* <code>path="/home/example/.local/share/Paradox Interactive/Crusader Kings III/mod/my_mod"</code> (Linux)
* <code>path="mod/my_mod"</code> (Relative, any OS)
|-
|-
| version || No || 允许你为mod定义一个版本,类型是字符串 || version="0.0.1"
| remote_file_id
| Required if uploading and updating your own Steam Workshop mod. Set automatically when mod is uploaded.
| Must match the Steam Workshop ID of the mod. Can be found at the end of a Steam Workshop URL, such as "2220762808" in https://steamcommunity.com/sharedfiles/filedetails/?id=2220762808.
| remote_file_id="2220762808"
 
|-
|-
| picture || No || Determines the Steam Icon. || picture="thumbnail.png"
| picture
| No
| Determines the Steam icon.
| picture="thumbnail.png"
|}
|}
=== Basic example ===
The example below displays the basic contents of a .mod file. Feel free to copy and paste it for your own .mod file, remembering to change specific details to match your own mod and game version. Note that the descriptor.mod file does ''not'' require the <code>path</code> key.
<pre>
version="0.0.1"
tags={
"Culture"
"Decisions"
"Fixes"
}
name="My Mod"
supported_version="1.1.3"
path="mod/my_mod"
</pre>
== Mod folder ==
Files that edit the game must be put inside the mod folder and are then subsequently loaded by the game. Files often have to be put into specific folders, otherwise they may not be loaded by the game. Some general ones have been listed below:
{| class="wikitable"
! Type
! Folder
|-
| Events
| events
|-
| Decisions
| common\decisions
|-
| Defines
| common\defines
|-
| Traits
| common\traits
|}
For specifics, either consult the relevant modding page using the navigation box at the bottom of this page, or look in the game files (Windows/Steam: {{cite file|C:/Program Files (x86)/Steam/steamapps/common/Crusader Kings III/game}}) and copy the folder structure for a given file up to (and not including) the {{cite file|game}} folder.
== Tips ==
* When editing your mod folder and .mod file(s), you can reload mods in the launcher to update them without restarting it. In the "Mods" section, press "Manage all mods", then "Reload installed mods". Try this if your mod is not showing up.
* Once you have created your initial mod structure, it is highly recommended to use some form of backup system (as simple as copying your files to someplace else), or source control such as Git / Github. This will greatly help if you lose your mod files or somehow break your mod and you want to go back to an old version.
* When creating your .mod file, ensure that you follow the syntax rules correctly, otherwise your mod may not show up at all. For instance, pay attention to using speech marks (<code>"</code>) where needed, especially around values like paths and names.
* Check spelling everywhere, including the contents and names of files and folders. Even the simplest of errors cause the greatest problems.
{{Modding navbox}}
{{Modding navbox}}
[[Category:模组制作]]
[[Category:模组制作]]
[[en:Mod structure]]
[[en:Mod structure]]

2020年11月11日 (三) 19:46的版本

Mods are located in the folder ~\Paradox Interactive\Crusader Kings III\mod:

  • Default on Windows: %USERPROFILE%\Documents\Paradox Interactive\Crusader Kings III\mod
  • Default on Linux: ~/.local/share/Paradox Interactive/Crusader Kings III/mod

Each mod requires two parts. Both must be located in the folder above and share the same name, barring file extensions; otherwise, the game launcher will not recognise the mod. Note that folder and file names are case sensitive on Mac and Linux.

  • A .mod file, a plain text file with metadata required to use the mod.
  • A mod folder containing files specific to modding the game, such as events, images, decisions and characters. It may also be a .zip file instead.

Creating initial files

It is recommended to generate the initial mod files through the game launcher in the interests of speed and avoiding human error.

  1. Open the game launcher.
  2. Navigate to the "Mods" section, either by scrolling or pressing the "Mods" tab under the play button.
  3. Press the "Mod tools" button underneath your current playset.
  4. Press the "Create a mod" button.
  5. Here, you can create your mod with a name, version (mod, not game), directory (will always be located in the game's mod folder described above) and any tags. The tags offered by the launcher include:
Alternative History Historical
Balance Map
Bookmarks Portraits
Character Focuses Religion
Character Interactions Schemes
Culture Sound
Decisions Total Conversion
Events Translation
Fixes Utilities
Gameplay Warfare
Graphics

It is also possible to change the suggested game version, thumbnail and description (for Steam Workshop) by going back to the "Mod tools" menu, and then selecting your mod in the drop-down list.

This process will create the following:

  • The mod folder, named after your mod.
  • A descriptor.mod file, contained within the mod folder.
  • Another .mod file, this one named after the mod, located alongside the mod folder.

*.mod 文件

The .mod files used by the game are plain text files that contain metadata about their corresponding mod. There are two .mod files for every mod:

  • (modname).mod, located alongside the mod's folder. This one is required; without it, the launcher will not recognise the mod.
  • descriptor.mod, located within the mod folder. It is recommended to keep this file consistent with the other one, excluding the line containing the path key which is not needed in the descriptor file.

Syntax

Similar to other game files, single-line comments can be started using hash (#). To set a value to a key, use the format key="value" for single values; alternatively, use the following structure for lists:

list={
	"element0"
	"element1"
	"element2"
}

Keys

The table below describes the keys available for use within the .mod file.

Keys Required? Description Example
name Yes Determines the name that shows up in the launcher. name="My Mod"
version Yes Allows you to define a version of your mod, defined as a string. version="0.0.1"
tags No Sets the tags that mod is considered part of. Correlates with Steam Workshop categories.
tags={
	"Culture"
	"Decisions"
	"Fixes"
}
supported_version Required for file alongside mod folder; not required for descriptor.mod Defines the latest game version the mod supports; launcher will show a warning if a mod is outdated. The game uses semantic versioning (MAJOR.MINOR.PATCH). Wildcards (*) may be used to define a range of versions. supported_version="1.1.3"
path Yes Sets which folder is the mod's folder. Note that it is no longer relative to the main Crusader Kings III folder, but rather to the Crusader Kings III user folder (described above). Alternatively, one can use the entire path.
  • path="C:/Users/Example/Documents/Paradox Interactive/Crusader Kings III/mod/my_mod" (Windows)
  • path="/home/example/.local/share/Paradox Interactive/Crusader Kings III/mod/my_mod" (Linux)
  • path="mod/my_mod" (Relative, any OS)
remote_file_id Required if uploading and updating your own Steam Workshop mod. Set automatically when mod is uploaded. Must match the Steam Workshop ID of the mod. Can be found at the end of a Steam Workshop URL, such as "2220762808" in https://steamcommunity.com/sharedfiles/filedetails/?id=2220762808. remote_file_id="2220762808"
picture No Determines the Steam icon. picture="thumbnail.png"

Basic example

The example below displays the basic contents of a .mod file. Feel free to copy and paste it for your own .mod file, remembering to change specific details to match your own mod and game version. Note that the descriptor.mod file does not require the path key.

version="0.0.1"
tags={
	"Culture"
	"Decisions"
	"Fixes"
}
name="My Mod"
supported_version="1.1.3"
path="mod/my_mod"

Mod folder

Files that edit the game must be put inside the mod folder and are then subsequently loaded by the game. Files often have to be put into specific folders, otherwise they may not be loaded by the game. Some general ones have been listed below:

Type Folder
Events events
Decisions common\decisions
Defines common\defines
Traits common\traits

For specifics, either consult the relevant modding page using the navigation box at the bottom of this page, or look in the game files (Windows/Steam: C:/Program Files (x86)/Steam/steamapps/common/Crusader Kings III/game) and copy the folder structure for a given file up to (and not including) the game folder.

Tips

  • When editing your mod folder and .mod file(s), you can reload mods in the launcher to update them without restarting it. In the "Mods" section, press "Manage all mods", then "Reload installed mods". Try this if your mod is not showing up.
  • Once you have created your initial mod structure, it is highly recommended to use some form of backup system (as simple as copying your files to someplace else), or source control such as Git / Github. This will greatly help if you lose your mod files or somehow break your mod and you want to go back to an old version.
  • When creating your .mod file, ensure that you follow the syntax rules correctly, otherwise your mod may not show up at all. For instance, pay attention to using speech marks (") where needed, especially around values like paths and names.
  • Check spelling everywhere, including the contents and names of files and folders. Even the simplest of errors cause the greatest problems.