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

本页面所适用的版本可能已经过时,最后更新于1.9
(merge from offical wiki)
 
无编辑摘要
第1行: 第1行:
{{Version|1.9}}
{{Version|1.9}}
==Mod File Structure==
== 模组文件结构==
===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:
本地模组必须位于<code>~/.local/share/Paradox Interactive/Hearts of Iron IV/mod</code> <code>C:\Users\<Username>\Documents\Paradox Interactive\Hearts of Iron IV\mod</code> ,应该包括:


* '''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)
* ''' '.mod' 文件''' ,它告诉启动器如何处理模组文件夹。(文件名没有特殊要求,仅本地模组需要,当上传到steam创意工坊时该文件不会上传)
* '''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.
* ''' 模组文件夹''' 或者包含模组数据的压缩文件。模组数据要与游戏文件有相同的[[#Game structure| 文件结构]]
* '''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)
* '''descriptor.mod 文件''' 在模组文件夹内部——它应当包含与上面的.mod 文件相同的信息。(注意:文件名必须为descriptor.mod ,且不能用UTF-8 BOM 编码储存)
* 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)
* 模组图片 (可选) - 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)




第13行: 第13行:
Note that folder and file names are case sensitive on Mac OS X and Linux.
Note that folder and file names are case sensitive on Mac OS X and Linux.


===Steam Workshop Mods===
===Steam 工坊模组===
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>
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>


第31行: 第31行:




==Creating a New Mod==
== 创建一个模组==
===General rules===
=== 总原则===
*Mods modify the game with the same file structure as in the vanilla game.
*Mods modify the game with the same file structure as in the vanilla game.
*All appropriate files found in the folder are loaded
*All appropriate files found in the folder are loaded
第40行: 第40行:
*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.
*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>.
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>.


第54行: 第54行:


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.
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".
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".


第66行: 第66行:
  supported_version="1.5.2"
  supported_version="1.5.2"


==Adding Mod Content==
== 增加模组内容==
For example, a simple modification could be changing the text that appears in the game.
For example, a simple modification could be changing the text that appears in the game.


第86行: 第86行:
When the game is loading with this mod active in the English language, the only quote shown will be "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
*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 <code>...\steamapps\workshop\content\394360</code>
*Alternatively, you can search the files of other users' mods in <code>...\steamapps\workshop\content\394360</code>
第92行: 第92行:
*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
*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


==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:
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]] - How to create a new country, assign flag, place the new country into the game
* [[Country creation]] - How to create a new country, assign flag, place the new country into the game

2020年9月10日 (四) 17:02的版本

模组文件结构

本地模组

本地模组必须位于~/.local/share/Paradox Interactive/Hearts of Iron IV/modC:\Users\<Username>\Documents\Paradox Interactive\Hearts of Iron IV\mod,应该包括:

  • '.mod'文件,它告诉启动器如何处理模组文件夹。(文件名没有特殊要求,仅本地模组需要,当上传到steam创意工坊时该文件不会上传)
  • 模组文件夹或者包含模组数据的压缩文件。模组数据要与游戏文件有相同的文件结构
  • descriptor.mod文件在模组文件夹内部——它应当包含与上面的.mod文件相同的信息。(注意:文件名必须为descriptor.mod,且不能用UTF-8 BOM编码储存)
  • 模组图片 (可选) - 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)


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工坊模组

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.0.0.19987"

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


创建一个模组

总原则

  • 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 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.

创建简单的本地模组

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.5.4"

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.

创建次级模组

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.5.2"

增加模组内容

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_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:
  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".

小提示

  • 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

参见

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: