模组结构

本页面所适用的版本可能已经过时,最后更新于1.1
Antimony讨论 | 贡献2021年2月11日 (四) 19:15的版本 (除表格外完全翻译)

Mods文件位于 ~\Paradox Interactive\Crusader Kings III\mod 文件夹中

  • Windows下的默认路径: %USERPROFILE%\Documents\Paradox Interactive\Crusader Kings III\mod
  • Linux下的默认路径: ~/.local/share/Paradox Interactive/Crusader Kings III/mod

每个mod需要两个部分:

  • 一个.mod后缀的纯文本文件,包含使用该mod所需的元数据
  • 一个mod文件夹(或.zip文件),包含此mod对游戏的修改内容,如事件、图像、决议和角色

两部分都必须位于上面的文件夹中,并且共享相同的名称,但文件扩展名除外;否则,游戏启动器将无法识别mod。请注意,文件夹和文件名在Mac和Linux上是区分大小写的。

创建初始文件

为了更为便捷以及避免人为错误,建议通过游戏启动器生成初始mod文件。

  1. 打开游戏启动器。
  2. 通过滚动或按“开始游戏”按钮下的 "Mod "标签,导航到 "Mods "部分。
  3. 点击"Mod工具 "按钮。
  4. 点击 "创建mod "按钮。
  5. 在这里,你可以创建你的mod,包括名称、版本(mod版本,而非游戏)、目录(将始终位于上述游戏的mod文件夹中)和任意标签。启动器提供的标签包括:
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

也可以通过回到 "Mod工具 "菜单,然后在下拉列表中选择你的mod来更改建议的游戏版本、缩略图和描述(显示在创意工坊里)。

这个过程将创建以下内容。

  • mod文件夹,以你的mod命名。
  • 一个descriptor.mod文件,包含在mod文件夹内。
  • 另一个.mod文件,这个文件以mod命名,位于mod文件夹旁边。

*.mod 文件

游戏使用的.mod文件是纯文本文件,其中包含了相应mod的元数据。每个mod都有两个.mod文件。

  • (modname).mod,位于mod的文件夹旁边。这个是必须的,没有它,启动器将无法识别mod。
  • descriptor.mod,位于mod文件夹内。建议这个文件和其他文件保持一致,删除文件中包含path键的行,因为这一行并不需要出现在描述文件中

语法

与其他游戏文件类似,单行注释可以使用哈希(#)开始。要将一个值设置为一个键,对于单个值使用格式key="value";对于列表则使用以下结构

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

下表描述了可在.mod文件中使用的键。

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"

基础例子

下面的例子展示了一个.mod文件的基本内容。请随意复制并粘贴到您自己的.mod文件中,记得更改具体细节以符合您自己的mod和游戏版本。注意,descriptor.mod文件不需要path键。

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

Mod文件夹

用来编辑游戏的文件必须放在mod文件夹里面,然后再由游戏加载。这些文件往往要放在特定的文件夹里,否则可能无法被游戏加载。下面列出了一些常见的例子

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

具体内容,可以使用本页底部的导航框查阅相关的修改页面,或者在游戏文件中查找 (Windows/Steam: C:/Program Files (x86)/Steam/steamapps/common/Crusader Kings III/game) 并将给定文件的文件夹结构复制到(并不包含) game 文件夹中

Tips

  • 当编辑你的mod文件夹和.mod文件时,你可以在启动器中重新加载mods来更新它们,而无需重新启动它。在 "mods "部分,按 "Manage all mods",然后按 "Reload installed mods"。如果你的mod没有显示出来,可以尝试这一操作。
  • 一旦你创建了你的初始mod结构,强烈建议你使用某种形式的备份系统(就像把你的文件复制到别的地方一样简单),或者源代码控制,比如Git / Github。如果你丢失了你的mod文件或以某种方式破坏了你的mod,而你又想回到一个旧的版本,这将会有很大的帮助。
  • 当创建你的.mod文件时,确保你正确地遵循语法规则,否则你的mod可能根本不会显示出来。例如,注意在需要的地方使用引号(""),尤其是在路径和名称等值的周围。
  • 检查所有地方的拼写,包括文件和文件夹的内容和名称。即使是最简单的错误也会造成很大的问题。