这篇文章正在翻译中。 如果您感兴趣可以对照官方百科的词条来编辑它。 |
本教程详细说明了创建基本mod所需的步骤。
同时你也可以复制和修改现有的模组来达成相同效果。不过要注意的是通过Steam创意工坊安装的模组,它们的包装方式不太相同。
此处基于的操作系统(作业系统)是Windows,但是理论上在MacOS和Linux不会有太大不同。
先决条件
- 安装一个好的文件编辑器(像是Notepad++),因为因为Windows上预设的记事本会改变文件编码。
步骤
创建CK2的模组目录
这里涉及到两个不同的目录:
- CK2的安装目录:它包含游戏的基本文件,最好不要尝试修改,并考虑'唯读模式'(任何的修改会在Steam更新时丢失)
- 这个目录可以通过Steam找到:在游戏库中找到CK2,右键单击名称,然后在菜单中选择“属性”。 选择“本地文件”选项卡,然后按“浏览本地文件”。
- CK2的使用者文件:它包含使用者的数据(存档、游戏设定、日志和模组。
- 路径是
~/My Documents/Paradox Interactive/Crusader Kings II/
。 ~
是主目录,根据你的配置和Windows版本,它可能长得像:C:\Users\<YourUser>\Documents\Paradox Interactive\Crusader Kings II
- 路径是
小提示:你可以在桌面上创建这些目录的快捷方式。
第一步:如果不存在mod资料夹,就自行创建一个。~/My Documents/Paradox Interactive/Crusader Kings II/mod/
注意:在游戏文件的目录也存在一个同名资料夹common\Crusader Kings II\mod\
但是存在里头的模组不会被读取。
创建.mod文件
.mod格式只是个纯文本的文件,使用.mod文件扩展名而不是.txt扩展名保存。
小提示:most CK2 files use .txt extension, but there is also .csv (localization), .gfx (graphics), .sfx (sounds), .gui (interface), .lua (global variables) and .info (documentation).
第二步:Create an empty file named "mymod.mod" in the CK2 mod folder (~/My Documents/Paradox Interactive/Crusader Kings II/mod/mymod.mod
).
注意:make sure the file extension is .mod (and not .mod.txt) - disable "Hide Known Extensions" option of Windows explorer.
Step 3: Open the file with your editor and add:
name = "My mod" path = "mod/mymod"
Notes:
- Don't forget the quotes, it is mandatory in case there is a space.
- Save the file with ANSI (Windows-1252) encoding. This is true for all CK2 files: never use UTF-8 encoding (with or without 'BOM') !
Tip: the path is relative to CK2 user directory, hence the "mod/" prefix.
Create the mod data folder
Step 4: Create an empty folder named "mymod" in the CK2 mod folder (~/My Documents/Paradox Interactive/Crusader Kings II/mod/mymod/
).
Tip: best practice is to use same name for path
folder than the mod file name, so that they are next to each other when browsing the CK2 mod folder.
Note: folder and file names are case sensitive on OS other than Windows, so a best practice is to use only lower-case.
进行游戏修改
We need a little change that will be quickly visible in-game, to validate that the mod is working.
Let's do some basic localization modding and change the text "Choose Your Starting Era" on the lobby to "Choose Your Favourite Era" (the corresponding localisation key is PICK_YOUR_STARTING_ERA
)
Step 5: Create an empty folder named "localisation" in the mod data folder (~/My Documents/Paradox Interactive/Crusader Kings II/mod/mymod/localisation/
).
Notes:
- A mod follows the same folder structure as the base game, and the two are merged when loading in memory.
- Beware the folder has to be named "localisation" and not "localization" !
Step 6: Create an empty file named "00_mymod.csv" in that folder (~/My Documents/Paradox Interactive/Crusader Kings II/mod/mymod/localisation/00_mymod.csv
).
Tip: the "00_" prefix is to ensure our localization is loaded first and overrides the vanilla one. Each folder has its own loading order/overriding behavior.
Step 7: Open the file with a text editor and copy the following lines to the file and save:
#CODE;ENGLISH;FRENCH;GERMAN;;SPANISH;;;;;;;;;x PICK_YOUR_STARTING_ERA;Choose Your Favourite Era;;;;;;;;;;;;;x
That's it !
测试模组
Step 8: Activate the mod "My mod" in the launcher (and don't activate any other mod) and start the game.
Troubleshooting: if the mod doesn't show up in the launcher, it probably means the .mod file is not in the correct folder or has the wrong extension (.txt instead of .mod).
Tip: notice that the in-game checksum has not changed compared to the one from the launcher. This is because the localisation folder doesn't alter the checksum, as it's only a cosmetic change.
Step 9: Click on Start and verify that the title of the pop-up has changed.
Troubleshooting: if the change is not visible in game, or the game crashes, check for errors logged by the game at startup in error.log.
Step 10: Take some time to congratulate yourself, and go back for more modding !
Note: each time you modify something in the mod files, you need to stop and restart CK2 so that the change is taken into account.
下一步?
- Mod other game files. Take it slowly, with small challenge, one problem at a time !
- Register your CK2 game and ask for help on the Crusader Kings II - User Modifications forum
- Upload your mod to the Steam Workshop
- Zip the mymod.mod and mymod folder together into a mymod.zip and upload the mod on the forum
外部连结
- Guide: Your first mod -添加事件的选项。