(2021年11月16日 (二) 22:49 Long Game Short) |
|||
第3行: | 第3行: | ||
'''模组制作'''(Modding)允许改变游戏的要素或者添加新特性。<br> | '''模组制作'''(Modding)允许改变游戏的要素或者添加新特性。<br> | ||
Certain things are hardcoded, i.e. not available for modding, such as changing mapmodes and diplomatic actions or adding new hotkeys.<br><br> | Certain things are hardcoded, i.e. not available for modding, such as changing mapmodes and diplomatic actions or adding new hotkeys.<br><br> | ||
Important: the majority of mods will change the checksum, not allowing the player to get achievements. Loading an ironman game with such a mod will irreversably corrupt the save file, so be careful.<br> | |||
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, fonts or music. | 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, fonts or music. | ||
== 提示和指南 == | == 提示和指南== | ||
* Create a mod instead of directly modifying the game files, as they will be overwritten with any game update. | * Create a mod instead of directly modifying the game files, as they will be overwritten with any game update. | ||
* Use a good text editor for syntax highlighting, autocompletion and search across multiple files. The following programs are free: | * Use a good text editor for syntax highlighting, autocompletion and search across multiple files. The following programs are free: | ||
第26行: | 第26行: | ||
== 创建你的第一个 mod== | == 创建你的第一个 mod== | ||
1. Start the game launcher, go to Mods, Mod | 1. Start the game launcher, go to All Installed Mods, Upload Mod, Create a Mod and fill in all the fields, including tags. Clicking Create will create a new folder and a .mod file in Documents/Paradox Interactive/Imperator/mod. | ||
* "Version" refers to the game version this mod is made for. | * "Version" refers to the game version this mod is made for. | ||
* Folder name may include spaces, although it is common to use lower_spaces instead. | * Folder name may include spaces, although it is common to use lower_spaces instead. | ||
第36行: | 第36行: | ||
* Remember to check the error.log for any errors. | * Remember to check the error.log for any errors. | ||
4. To add a thumbnail for a mod, name your image "thumbnail.png" and put it inside your mod folder. Make it at least 200x200 pixels, so Steam doesn't add black borders around it.<br> | 4. To add a thumbnail for a mod, name your image "thumbnail.png" and put it inside your mod folder. Make it at least 200x200 pixels, so Steam doesn't add black borders around it.<br> | ||
5. To upload a mod, open the game launcher, go to Mods, Mod | 5. To upload a mod, open the game launcher, go to All Installed Mods, Upload Mod. Select your mod from the dropdown menu, select the platform to upload it to and click Upload. The description isn't necessary. | ||
* You will find your mod in your Steam profile, Workshop Items. New mods are uploaded in private mode, so change their visibility to Public to actually publish them. | * You will find your mod in your Steam profile, Workshop Items. New mods are uploaded in private mode, so change their visibility to Public to actually publish them. | ||
* Remember, remove your local mod folder if you want to test the Steam version of it, otherwise they will conflict with each other. You may simply move it, along with the .mod file, to another folder and move it back whenever you want to update your mod. | * Remember, remove your local mod folder if you want to test the Steam version of it, otherwise they will conflict with each other. You may simply move it, along with the .mod file, to another folder and move it back whenever you want to update your mod. | ||
6. To update a mod, simply open the launcher and upload it again.<br> | |||
6. To update a | |||
(When you upload a mod for the first time, the launcher creates a descriptor.mod file in your mod folder which links to your Steam mod. This is what's used for updating, so don't remove this file.) | (When you upload a mod for the first time, the launcher creates a descriptor.mod file in your mod folder which links to your Steam mod. This is what's used for updating, so don't remove this file.) | ||
第47行: | 第46行: | ||
* [[Effects]] - 用于动态地影响游戏。 | * [[Effects]] - 用于动态地影响游戏。 | ||
* [[Triggers]] - 用于执行命令/事件/决议/等等。只有当特定条件为真时。 | * [[Triggers]] - 用于执行命令/事件/决议/等等。只有当特定条件为真时。 | ||
* [[Scopes]] | * [[Scopes]] - 用于明确规定命令和条件的目标。 | ||
* [[Modifier list]] - 影响游戏方方面面的脚本修正。 | * [[Modifier list]] - 影响游戏方方面面的脚本修正。 | ||
* [[Defines]] - 用于游戏在几乎所有方面的全局值。 | * [[Defines]] - 用于游戏在几乎所有方面的全局值。 | ||
第65行: | 第64行: | ||
== 指南 == | == 指南 == | ||
{{MultiColumn| | |||
* [[AI 修改]] | |||
* [[建筑修改]] | |||
* [[人物修改]] | |||
* [[盾徽修改]] | |||
* [[国家修改]] | |||
* [[文化修改]] | |||
* [[决议修改]] | |||
* [[事件修改]] | |||
* [[基因修改]] | |||
* [[GFX 修改]] | |||
* [[政府修改]] | |||
* [[GUI 修改]] | |||
* [[理念修改]] | |||
* [[本地化]] | |||
* [[地图修改]] | |||
* [[Mod 文件]] | |||
* [[省份设置]] | |||
* [[宗教修改]] | |||
* [[研究修改]] | |||
* [[单位修改]] | |||
|4}} | |||
== 排除故障 == | == 排除故障 == | ||
===Mod在上传到 Steam 之后不工作=== | ===Mod 在上传到 Steam 之后不工作=== | ||
Check whether other mods work for you. If not and your Documents folder is not in the default place, the launcher can't find it. | Check whether other mods work for you. If not and your Documents folder is not in the default place, the launcher can't find it. | ||
第100行: | 第120行: | ||
== 杂项 == | == 杂项 == | ||
* [[校验码#影响校验码计算的文件|校验码]] | * [[校验码#影响校验码计算的文件|校验码]] | ||
== 参考资料 == | == 参考资料 == |
2022年3月5日 (六) 22:37的版本
模组制作(Modding)允许改变游戏的要素或者添加新特性。
Certain things are hardcoded, i.e. not available for modding, such as changing mapmodes and diplomatic actions or adding new hotkeys.
Important: the majority of mods will change the checksum, not allowing the player to get achievements. Loading an ironman game with such a mod will irreversably corrupt the save file, so be careful.
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, fonts or music.
提示和指南
- Create a mod instead of directly modifying the game files, as they will be overwritten with any game update.
- Use a good text editor for syntax highlighting, autocompletion and search across multiple files. The following programs are free:
- Visual Studio Code. There is a fan-made CWTools extension for VS, which recognizes Paradox code language, will warn you of missing brackets and show information about scopes and effects in a tooltip. To install it, go to Extensions on the left panel of VS and search for CWTools. (Note: if the extension isn't up to date with the patch, it may show many false errors)
- Sublime Text. Imperator developers have released Sublime Tools with syntax highlighting and function search. In addition, to be able to toggle comments, you need to add this file to the same "User" folder.
- 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. 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.
- Indent properly, so that opening and closing brackets are on the same level. Proper formatting will allow you to fold blocks of code, help spot any mistakes and make it easier to read.
- Add comments, starting with #, to remember later how things works, to navigate easier or to disable parts of code without deleting them.
- Use UTF-8 encoding for text files.
- Use UTF-8-BOM for localization files.
- Start the game with the "-debug_mode" and "-develop" options to use the console, dev tools and "reload" commands. See here how to add launch options.
- Use the error.log to catch any bugs. It's located next to the mod folder, in Documents/Paradox Interactive/Imperator/logs.
- Use "script_docs" and "DumpDataTypes" console commands in the game to generate other logs with event effects, triggers and scopes.
- Remove your local mod when you subscribe to the Steam version, otherwise it won't work.
- Clearly communicate to users whether your mod is ironman-friendly.
- 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.
创建你的第一个 mod
1. Start the game launcher, go to All Installed Mods, Upload Mod, Create a Mod and fill in all the fields, including tags. Clicking Create will create a new folder and a .mod file in Documents/Paradox Interactive/Imperator/mod.
- "Version" refers to the game version this mod is made for.
- Folder name may include spaces, although it is common to use lower_spaces instead.
2. Copy the game files you wish to mod to your newly created mod folder or create your own files, while using the same folder structure.
- For example, if you want to mod the topbar, your should have the following: my_topbar_mod/gui/ingame_topbar.gui.
- If you want to add events to this mod, you would have my_topbar_mod/events/topbar_events.txt.
3. After modifying the files, enable the mod in the launcher and test it in the game.
- If modding UI, you can use "reload gui" command to see new changes without restarting the game. (This requires both -develop and -debug_mode launch options. See above how to enable them.)
- Remember to check the error.log for any errors.
4. To add a thumbnail for a mod, name your image "thumbnail.png" and put it inside your mod folder. Make it at least 200x200 pixels, so Steam doesn't add black borders around it.
5. To upload a mod, open the game launcher, go to All Installed Mods, Upload Mod. Select your mod from the dropdown menu, select the platform to upload it to and click Upload. The description isn't necessary.
- You will find your mod in your Steam profile, Workshop Items. New mods are uploaded in private mode, so change their visibility to Public to actually publish them.
- Remember, remove your local mod folder if you want to test the Steam version of it, otherwise they will conflict with each other. You may simply move it, along with the .mod file, to another folder and move it back whenever you want to update your mod.
6. To update a mod, simply open the launcher and upload it again.
(When you upload a mod for the first time, the launcher creates a descriptor.mod file in your mod folder which links to your Steam mod. This is what's used for updating, so don't remove this file.)
游戏数据
- Effects - 用于动态地影响游戏。
- Triggers - 用于执行命令/事件/决议/等等。只有当特定条件为真时。
- Scopes - 用于明确规定命令和条件的目标。
- Modifier list - 影响游戏方方面面的脚本修正。
- Defines - 用于游戏在几乎所有方面的全局值。
- Country list - 原版游戏中全部国家的基本信息,包括国家代码。
- Console commands - 关于如何使用游戏控制台命令的指南。
- 游戏预置脚本
- 游戏预置修正
- 总表
指南
排除故障
Mod 在上传到 Steam 之后不工作
Check whether other mods work for you. If not and your Documents folder is not in the default place, the launcher can't find it.
You need to edit "launcher-settings.json":
- open the game directory (Right-click on Steam, Properties, Local Files, Browse Local Files)
- in the 'launcher' folder open launcher-settings.json with a notepad
- change gameDataPath to "%USER_DOCUMENTS%/Paradox Interactive/Imperator"
If this still doesn't help, try using the whole path, like "F:/Documents/Paradox Interactive/Imperator". Make sure you use forward slashes / and double quotes ".
在 .mod 文件中的路径变成绝对路径
The new launcher overwrites the "mod/modname" path to the absolute one, like "C:/Users/User/Documents.../mod/modname".
While this is normal, for some modders it can prevent the game from loading the mod. To solve it:
- Change the path to relative again.
- Right-click the file -> Properties -> check Read-only.
This will prevent the launcher from editing it. Remember to disable read-only when uploading, since the launcher needs access to the file.
工具与实用程序
- Clausewitz Maya Exporter - 此工具允许更简便地创建3D模型(单位)用于较新的克劳塞维茨引擎游戏中的模组。
- VS Code - 强大的、可控制的、免费开源编辑器,来自微软。(在VS Code扩展中心搜索安装中文语言包)
- CWTools - 一个用于VS Code的扩展,提供拼写验证、代码补全、语法高亮以及更多功能给Paradox脚本文件。(在VS Code扩展中心搜索安装CWTools)
- Notepad++ Syntax Highlighter - Notepad++语法高亮规则定义。(已过时)
- province setup converter 1.3.x -> 1.4 - 一个用来转换旧的省份数据信息,从 Imperator 1.3.x 或者使用 province_setup.csv 文件到文本格式给 Imperator 1.4
社区
- 官方论坛的模组制作指南:Imperator Modding Guide Index
- Imperator: Rome - User Mods - 在Paradox Plaza论坛上的子论坛,专门用于用户为I:R制作模组。
- Imperator Modding Coop - 一个Discord服务器,专门用于用户为I:R制作模组。
杂项
参考资料
文档 | 效果指令 • 触发条件 • 修正列表 • 作用域 • 变量 • 数据类型 • 本地化 • 可自定义的本地化 |
脚本 | AI • 建筑 • 宣战理由 • 人物 • 人物互动 • 战术 • 国家 • 文化 • 决议 • Defines • 经济政策 • 事件 • 渊源 • 政府 • 总督政策 • 理念 • 修正 • 军事传统 • 官职 • 行动 • 派系 • 价格 • 人口 • 宗教 • 省份 • Script Values • Scripted Modifiers • 附属国类型 • 科技 • 商品 • 特质 • 单位 |
地图 | 地图 • 地形 • 地图定位器 |
图形 | 3D模型 • 界面 • 盾徽 • 图形资产 • 字体 • 粒子效果 • 着色器 • 单位模型 |
音频 | 音乐 • 音效 |
其他 | 控制台命令 • 校验和 • 模组结构 • 错误调试 |