模组文件结构:修订间差异

本页面所适用的版本可能已经过时,最后更新于1.9
(文本替换 - 替换“[[Category:”为“[[分类:”)
无编辑摘要
 
第1行: 第1行:
{{Version|1.9}}
{{Version|1.9}}
== 模组文件结构==
{{需要翻译|译者= 霜泽图书馆}}
=== 本地模组===
==Mod File Structure==
本地模组必须位于<code>~/.local/share/Paradox Interactive/Hearts of Iron IV/mod</code> <code>C:\Users\<Username>\Documents\Paradox Interactive\Hearts of Iron IV\mod</code> ,应该包括:
===Local Mod===
Local Mod files must be located in the folder <code>~/.local/share/Paradox Interactive/Hearts of Iron IV/mod</code> or <code>C:\Users\<Username>\Documents\Paradox Interactive\Hearts of Iron IV\mod</code>, which must contain:


* ''' '.mod' 文件''' ,它告诉启动器如何处理模组文件夹。(文件名没有特殊要求,仅本地模组需要,当上传到steam创意工坊时该文件不会上传)
* '''The '.mod' file''', to tell the launcher what to do with the mod-folder (For local use only, any name possible; this file does not get uploaded, when publishing the mod via Steam Workshop)
* ''' 模组文件夹''' 或者包含模组数据的压缩文件。模组数据要与游戏文件有相同的[[#Game structure| 文件结构]]
* '''The mod folder''' or zip containing the mod data. The mod data must have the same [[#Game structure|file and folder structure]] as the game's directory itself.
* '''descriptor.mod 文件''' 在模组文件夹内部——它应当包含与上面的 .mod 文件相同的信息。(注意:文件名必须为 descriptor.mod ,且不能用 UTF-8 BOM 编码储存)
* '''descriptor.mod file''' inside the mod folder - this file should contain the same information as the first .mod file (Note: The File must use the descriptor.mod name and must NOT be saved in UTF-8 BOM format)
* 模组图片 (可选) - 模组文件夹中命名为 '''thumbnail.png''' 的文件, 起到 Steam 创意工坊模组图片的作用。(注意:必须使用 .png 格式并命名为 'thumbnail.png'; 尺寸不重要,但应该按照 1:1 的比率。)
* Mod picture (optional) - a file named '''thumbnail.png''' in the mod folder, to serve as Steam Workshop mod picture (Note: Must use .png format and 'thumbnail.png' name; dimensions aren't important but should be 1:1 ratio). In addition, thumbnail files should be less than '''1MB''' in size, otherwise they cannot be uploaded to ParadoxMods.




游戏启动器的模组配置工具''' 可以自动创建基本的文件结构''' 。前往''Mods'' 标签页,然后点击''Mod 工具'' '' 创建 Mod''
The game launcher's mod config tool '''can create basic structure automatically'''. Just go to ''Mods'' tab, then click ''Mod Tools'' and ''Create Mod''.
注意文件夹和文件的名字在 macOS 和 Linux 上大小写敏感。
Note that folder and file names are case sensitive on Mac OS X and Linux.


===Steam 工坊模组===
===Steam Workshop Mods===
steam 创意工坊订阅和下载的模组位于<code>.../Paradox Interactive/Hearts of Iron IV/workshop/content/394360</code> 或在某些情况下位于<code>...\SteamLibrary\steamapps\workshop\content\394360</code>
Subscribed and downloaded mods from the steam workshop are in <code>.../Paradox Interactive/Hearts of Iron IV/workshop/content/394360</code> or sometimes <code>...\SteamLibrary\steamapps\workshop\content\394360</code>


Steam 创意工坊下载的模组与手动安装或创建的模组其处理方式有所差异:<br />
Mods downloaded from the Steam Workshop are treated differently than those manually installed or created:<br />
虽然模组的 .mod 文件会出现在模组文件夹(表示为''remote_file_id'' ),但是模组的内容被存储在<code>...\Paradox\Hearts of Iron IV\workshop\content\<remote_file_id></code><br />
Though the mods .mod files will appear in the mod folder (represented by a ''remote_file_id''), The content of the mod will be stored in <code>...\Paradox\Hearts of Iron IV\workshop\content\394360\<remote_file_id></code><br />
''remote_file_id'' 是创意工坊给予模组的一个标识。这个标识被用来表示模组 .mod zip 文件的名字,但在 .mod descriptor.mod 文件中是这样表示的:
The ''remote_file_id'' is an ID given to mods from the workshop. The ID is displayed as the name of the mod's .mod and zip files, but is further represented within the .mod and descriptor.mod files as such:


  name="New Ideologies"
  name="New Ideologies"
第27行: 第28行:
  }
  }
  remote_file_id="678893824"
  remote_file_id="678893824"
  supported_version="1.0.0.19987"
  supported_version="1.11.*"
''' 注意:''' 从游戏 1.9.0 开始,新创建的模组不再存储在 .zip 压缩包中
'''Note:''' Newer mods, starting with game version 1.9.0 are no longer stored in a .zip archive


==Creating a New Mod==
===General rules===
*Mods modify the game with the same file structure as in the vanilla game.
*All appropriate files found in the folder are loaded
*All .txt files should use UTF-8 without BOM format, Localisation files should use UTF-8 BOM Format
*To overwrite the vanilla file, use the same file name
*To add content without changing any vanilla files, use a different file name
*The Game will not check any further than the file directory for changes. If one is trying to add a line to a text file, one must copy the entire text file and add the line within said text file.


== 创建一个模组==
===Creating a simple local mod===
===总原则===
For example, to create a mod called "Test1", create a new text file called ''test1.mod'' and a folder named 'test1' within <code>...\Paradox\Hearts of Iron IV\mod</code>.
*修改游戏的模组的文件结构应与原版游戏保持一致。
*文件夹中找到的所有文件都会被游戏加载。
*所有 .txt 文件都应使用 UTF-8 without BOM 的格式,本地化(localisation)文件都应该使用 UTF-8 BOM 的格式。
*要覆盖原版文件,使用相同的文件名。
*要添加新内容同时不改变任何原版文件,使用一个不同的文件名。
*游戏除文件目录的变化外不会作进一步的变化检查。如果想在文本文件里新添一行,则需要复制整个文本文件后再在复制后的文件里添加。
 
===创建简单的本地模组===
例如,要创建一个名为“Test1”的模组,则要在<code>...\Paradox\Hearts of Iron IV\mod</code> 目录下新建一个名为''test1.mod''的文本文件和名为'test1'的文件夹。
 
''test1.mod''的内容应该与下述一致:


The contents of ''test1.mod'' should be as follows:
  name="Test1"
  name="Test1"
  path="mod/test1"
  path="mod/test1"
第51行: 第51行:
  }
  }
  picture="thumbnail.png"
  picture="thumbnail.png"
  supported_version="1.5.4"
  supported_version="1.11.*"


这样做是为了给游戏启动器提供模组的信息。包括了模组的名称、位置(来自 mod 文件)、标签(额外的描述符)、图片名称和支持的游戏版本。
This is done to provide the game launcher with information about the mod. This includes the mod's name, location (from the mod file), tags (extra descriptors), picture name, and supported game version.
=== 创建次级模组===
===Creating a  Submod ===
有时你会想你的模组能依赖其他模组,并且按照一定的加载顺序。模组通常会按字母顺序加载(所以列表中最后一个模组会覆盖前面的模组)。但是有些东西可能会影响这点,所以如果你需要一个特定的加载顺序,确保你写明了依赖关系,这需要在 .mod 文件的 "dependencies" 下写出其全名来指定。
Sometimes you will want your mod to depend on other mods, and also require a certain loading order. Mods will usually load in alphabetical order (so the mod last in the list will overwrite the earlier). But some things may affect this so if you need a certain load order and be clear that you have dependencies this needs to be specified by including its full name in the .mod file under "dependencies".


  name="testmodB"
  name="testmodB"
第64行: 第64行:
  "testmodA" 
  "testmodA" 
  }
  }
  supported_version="1.5.2"
  supported_version="1.11.*"


== 增加模组内容==
==Adding Mod Content==
例如,一个简单的修改就可以改变游戏中显示的文本。
For example, a simple modification could be changing the text that appears in the game.


要改变加载界面中出现的名人名言,请把游戏原版文件,“.../Hearts of Iron IV/localisation/loading_tips_I_english.yml ”,中的“localisation/loading_tips_I_english.yml”文件复制到你新创建的“mod/test1”文件夹下的“localisation”文件夹。
To change the quotes that appear in the loading screen, copy the "localisation/loading_tips_I_english.yml" file from the base install of the game, ".../Hearts of Iron IV/localisation/loading_tips_I_english.yml" to a "localisation" folder you create in the new "mod/test1" folder.


文件结构现在看起来应如下所示:
The file structure now looks like the following:


   ''...\Paradox Interactive\Hearts of Iron IV\mod''
   ''...\Paradox Interactive\Hearts of Iron IV\mod''
第77行: 第77行:
     test1 (dir)
     test1 (dir)
      localisation (dir)
      localisation (dir)
       loading_tips_I_english.yml
       loading_tips_L_english.yml


当“loading_tips_I_english.yml ”未被改变时,游戏将会像往常一样正常运行。但是如果改变了,游戏就会使用新内容而不是惯常的“loading_tips_I_english.yml ”。修改模组文件夹中的“loading_tips_I_english.yml ”文件,让它包含这些内容:
As "loading_tips_I_english.yml" is unaltered, the game will run the same as usual. However, if it is changed, the information will be used by the game instead of the usual "loading_tips_I_english.yml". Modify the "loading_tips_I_english.yml" file in the mod folder so that it contains this:


   l_english:
   l_english:
   LOADING_TIP_0:0 "Test1 mod"
   LOADING_TIP_0:0 "Test1 mod"


当游戏加载这个模组并以英文运行时,唯一显示的名人名言就会是这句“Test1 mod ”。
When the game is loading with this mod active in the English language, the only quote shown will be "Test1 mod".


== 小提示==
==Tips==
* 要准确理解代码中的东西是怎么工作的,查看游戏文件以及搜索你的模组会改变什么东西等类似的事会很有帮助
*To understand how certain things in the code work, it can be useful to look into game files and search for things similar to what your mod is supposed to change
* 另外,你可以在<code>...\steamapps\workshop\content\394360</code> 下搜索其他用户模组的文件
*Alternatively, you can search the files of other users' mods in <code>...\steamapps\workshop\content\394360</code>
* 尽量减少对原版文件的覆盖,这样你在管理模组让它与最新版游戏保持一致,并且减少与其他模组的冲突时都会更方便一些
*Try to minimize vanilla file overwrites, this will make it both easier for you to manage your mod content to keep it up to date and reduce risk of conflict with other mods
* 测试模组时,查看<code>...\Documents\Paradox Interactive\Hearts of Iron IV\logs\error.log</code> 下的错误日志很有帮助,这能让你在有些东西不起作用时得到相关线索。
*When testing the mod, it can be very useful to look into Error log <code>...\Documents\Paradox Interactive\Hearts of Iron IV\logs\error.log</code> to gain a clue when something isn't working
*To keep your mod updated between smaller updates, replace the third number in your version with a *. For example, replace "1.5.4" with "1.5.*" to make that mod work with all versions of 1.5


== 参见==
==See also==
根据你的模组要做什么,你可能会想浏览一些与部分更基础的游戏内容修改相关的页面:
Depending on what your mod is supposed to do, you may want to visit some of these pages relating to some more basic game content modding:
* [[Country creation]] - 如何创建一个新的国家,指定国旗,添加新国家到游戏里
* [[Country creation]] - How to create a new country, assign flag, place the new country into the game
* [[National Focus modding]] - 如何修改国策树
* [[National Focus modding]] - How to edit National Focus tree
* [[Idea modding]] - 如何添加/ 修改国家理念
* [[Idea modding]] - How to add/edit National Ideas
* [[Event modding]] - 如何添加/ 修改事件
* [[Event modding]] - How to add/edit an Event
{{Modding navbox}}
{{Modding navbox}}
[[分类:Modding]]
[[分类:Modding]]

2024年9月21日 (六) 20:12的最新版本

Mod File Structure

Local Mod

Local Mod files must be located in the folder ~/.local/share/Paradox Interactive/Hearts of Iron IV/mod or C:\Users\<Username>\Documents\Paradox Interactive\Hearts of Iron IV\mod, which must contain:

  • The '.mod' file, to tell the launcher what to do with the mod-folder (For local use only, any name possible; this file does not get uploaded, when publishing the mod via Steam Workshop)
  • The mod folder or zip containing the mod data. The mod data must have the same file and folder structure as the game's directory itself.
  • descriptor.mod file inside the mod folder - this file should contain the same information as the first .mod file (Note: The File must use the descriptor.mod name and must NOT be saved in UTF-8 BOM format)
  • Mod picture (optional) - a file named thumbnail.png in the mod folder, to serve as Steam Workshop mod picture (Note: Must use .png format and 'thumbnail.png' name; dimensions aren't important but should be 1:1 ratio). In addition, thumbnail files should be less than 1MB in size, otherwise they cannot be uploaded to ParadoxMods.


The game launcher's mod config tool can create basic structure automatically. Just go to Mods tab, then click Mod Tools and Create Mod. Note that folder and file names are case sensitive on Mac OS X and Linux.

Steam Workshop Mods

Subscribed and downloaded mods from the steam workshop are in .../Paradox Interactive/Hearts of Iron IV/workshop/content/394360 or sometimes ...\SteamLibrary\steamapps\workshop\content\394360

Mods downloaded from the Steam Workshop are treated differently than those manually installed or created:
Though the mods .mod files will appear in the mod folder (represented by a remote_file_id), The content of the mod will be stored in ...\Paradox\Hearts of Iron IV\workshop\content\394360\<remote_file_id>
The remote_file_id is an ID given to mods from the workshop. The ID is displayed as the name of the mod's .mod and zip files, but is further represented within the .mod and descriptor.mod files as such:

name="New Ideologies"
archive="workshop/content/281990/678893824/newideologies.zip"
tags={
	"Balance"
	"Gameplay"
}
remote_file_id="678893824"
supported_version="1.11.*"

Note: Newer mods, starting with game version 1.9.0 are no longer stored in a .zip archive

Creating a New Mod

General rules

  • Mods modify the game with the same file structure as in the vanilla game.
  • All appropriate files found in the folder are loaded
  • All .txt files should use UTF-8 without BOM format, Localisation files should use UTF-8 BOM Format
  • To overwrite the vanilla file, use the same file name
  • To add content without changing any vanilla files, use a different file name
  • The Game will not check any further than the file directory for changes. If one is trying to add a line to a text file, one must copy the entire text file and add the line within said text file.

Creating a simple local mod

For example, to create a mod called "Test1", create a new text file called test1.mod and a folder named 'test1' within ...\Paradox\Hearts of Iron IV\mod.

The contents of test1.mod should be as follows:

name="Test1"
path="mod/test1"
tags={
	"Alternative History"
}
picture="thumbnail.png"
supported_version="1.11.*"

This is done to provide the game launcher with information about the mod. This includes the mod's name, location (from the mod file), tags (extra descriptors), picture name, and supported game version.

Creating a Submod

Sometimes you will want your mod to depend on other mods, and also require a certain loading order. Mods will usually load in alphabetical order (so the mod last in the list will overwrite the earlier). But some things may affect this so if you need a certain load order and be clear that you have dependencies this needs to be specified by including its full name in the .mod file under "dependencies".

name="testmodB"
path="mod/testmodb/"

# this guarantees we load testmodA first before our testmodB is loaded
dependencies= { 
	"testmodA" 
}
supported_version="1.11.*"

Adding Mod Content

For example, a simple modification could be changing the text that appears in the game.

To change the quotes that appear in the loading screen, copy the "localisation/loading_tips_I_english.yml" file from the base install of the game, ".../Hearts of Iron IV/localisation/loading_tips_I_english.yml" to a "localisation" folder you create in the new "mod/test1" folder.

The file structure now looks like the following:

 ...\Paradox Interactive\Hearts of Iron IV\mod
     test1.mod
     test1 (dir)
       localisation (dir)
         loading_tips_L_english.yml

As "loading_tips_I_english.yml" is unaltered, the game will run the same as usual. However, if it is changed, the information will be used by the game instead of the usual "loading_tips_I_english.yml". Modify the "loading_tips_I_english.yml" file in the mod folder so that it contains this:

 l_english:
  LOADING_TIP_0:0 "Test1 mod"

When the game is loading with this mod active in the English language, the only quote shown will be "Test1 mod".

Tips

  • To understand how certain things in the code work, it can be useful to look into game files and search for things similar to what your mod is supposed to change
  • Alternatively, you can search the files of other users' mods in ...\steamapps\workshop\content\394360
  • Try to minimize vanilla file overwrites, this will make it both easier for you to manage your mod content to keep it up to date and reduce risk of conflict with other mods
  • When testing the mod, it can be very useful to look into Error log ...\Documents\Paradox Interactive\Hearts of Iron IV\logs\error.log to gain a clue when something isn't working
  • To keep your mod updated between smaller updates, replace the third number in your version with a *. For example, replace "1.5.4" with "1.5.*" to make that mod work with all versions of 1.5

See also

Depending on what your mod is supposed to do, you may want to visit some of these pages relating to some more basic game content modding: