模组制作:修订间差异

本页面所适用的版本可能已经过时,最后更新于1.0
(简单的搬运modding)
 
 
(未显示3个用户的15个中间版本)
第1行: 第1行:
{{Version|pre-release}}
{{ 版本|1.0}}
Modding allows to change elements of the game or add new features.
模组可以更改游戏中的元素,也可以为游戏加入新特性。
Certain things are hardcoded, i.e. not available for modding, such as changing map modes or adding new hotkeys.
相当多的东西被硬编码,不能被编辑,比如说新的地图模式和加入快捷键。


All mods will be achievement compatible unless they utilize console commands.
所有不使用到[[控制台指令]]的模组都可以使用成就


== Tips ==
== 提示 ==


* Create a mod instead of directly modifying the game files, as they will be overwritten with any game update
* 不要直接在游戏文件里修改文件,不仅会破坏游戏而且修改的内容也会在游戏更新中被覆盖。
* Use a good text editor that has syntax highlighting and other useful features like find in files. The following programs are free and currently have plugins to support Victoria 3 scripting:
* 使用可以高亮语法的编辑器可以让模组制作事半功倍,下面是拥有对维多利亚3语法支持插件的编辑器:
*# [https://www.sublimetext.com/ Sublime Text] is very fast and has syntax, completion, and documentation support with the plugin found here: [https://github.com/dementive/Victoria3Tools Victoria 3 Tools]
*# [https://code.visualstudio.com/ Visual Studio Code] 是一个完备但是稍慢的文本编辑器,使用[https://marketplace.visualstudio.com/items?itemName=tboby.cwtools-vscode CwTools] 插件可以使其支持维多利亚3的语法
*# [https://code.visualstudio.com/ Visual Studio Code] is a slower but feature rich editor that has a fan-made plugin called CWTools that is found here: [https://marketplace.visualstudio.com/items?itemName=tboby.cwtools-vscode CwTools]
*# [https://www.sublimetext.com/ Sublime Text] 是非常快的编辑器,支持高亮语法,自动补全和文档查询,搭配维多利亚3插件[https://github.com/dementive/Victoria3Tools Victoria 3 Tools]使用
*# [https://notepad-plus-plus.org/ Notepad++] is another good lightweight editor but it has no fan made plugins that support Victoria 3 specifically. Choosing Perl as your language syntax will give satisfactory syntax highlighting.
* "-debug_mode" "-filewatcher" 指令可以开启调试模式,调试模式可以使用控制台和开发工具,同时也能热更改一些文件而不需要重启。
* Start the game with "-debug_mode" and "-filewatcher" options to use the console, dev tools, and automatically reload changed files without having to restart the game.
* 查看error.log 以捕获bug,这种精确的记录对于模组制作者来说是一种可以判断为什么一些东西不工作的利器。文件位于Documents/Paradox Interactive/Victoria 3/logs
* Use the error.log to catch any bugs, it is extremely useful the logging is very accurate and is one of the greatest tools modders have for debugging things that are not working. It is located next to the mod folder in Documents/Paradox Interactive/Victoria 3/logs
* 请备份,所有东西都可能会变坏所以需要备份。你可以手动备份也可以使用诸如GIt的版本控制工具、可以考虑使用Github来团队协作,如果你是初学者建议使用以[https://desktop.github.com/ Github Desktop]i熟悉Git。
* Backup your work, things can go wrong and it is always good to have a backup. Either do it manually or use a version control system like Git. Also consider using GitHub for team collaboration. If you are new to Git a program like [https://desktop.github.com/ Github Desktop]is great for beginners.
* 使用Use "script_docs" "DumpDataTypes" 控制台指令可以在Documents/Paradox Interactive/Victoria 3/logs 生成效果、条件、作用域和事件目标的记录。
* Use "script_docs" and "DumpDataTypes" console commands in the game to generate other logs with event effects, triggers and scopes.
* 如果你不清楚怎么做,可以在游戏文件搜索你需要搜索的单词,查找文件中的单词是写出没有错误的mod的一个快捷方法。
* If you are unsure of how to do something, search through the base game files for words you know you need to use. Finding in files is one of the most important tools to quickly write bug free mods.
* 当你下载了你上传的Steam mod ,在本地文件又有原本的Steam mod,Steam的mod不会运行。
* Remove your local mod when you subscribe to the Steam version, otherwise it won't work.
* 括号要补全,这样才能使得代码都在一个层次内,正确的代码是可以让大括号在文本编辑器折起来的。漂亮的代码能够更好看清楚错误和增强可读性。
* 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.


==Modding Guides==
== 实用的工具==
[[New country modding|Countries modding]]


[[Event modding]]
* [https://github.com/dragon-archer/paradox-highlight Paradox Highlight] 提供Victoria 3和各类其它Paradox游戏语法高亮的Visual Studio Code插件
* [https://github.com/crschnick/pdx_unlimiter Pdx-Unlimiter] 可以修改存档数据的实用工具
* [https://github.com/Linnest2020/Vic3-mapdata-editor Map data editor] 基于jomini.js制作的用chrome启动的省份数据编辑器,可以可视化编辑history/states的数据
* [https://github.com/runite-drill/music-mod-creation-tool Music Mod Creation Tool] 顾名思义,这是一个音乐mod制作工具


[[Journal modding]]
==模组指导==
[[ 自定义国家]]


[[Modifier modding]]
[[ 自定义事件]]


== Game object reference ==
[[自定义日志]]


=== Dependency and Folder Structure ===
[[自定义修正]]


If you want to add a new game object, you will need to keep in mind which more fundamental objects it depends on, and how to organize the files so the game recognizes it.
== 游戏对象参考 ==


All paths are relative to the 'game' folder inside your Victoria 3 install directory, as that is where all scriptable parts of the game are located.
=== 依赖项和文件夹结构 ===


Note: objects with no dependencies may still reference primitive objects (numbers, strings etc) or core game concepts, but no object type that mods can edit or define, only change the parameter value of. Nested references, especially within modifiers, are generally also not counted, since modifiers can have arbitrary dependency relations.
如果要添加新的游戏对象,则需要记住它依赖于哪些更基本的对象,以及如何组织文件以便游戏识别它。


所有路径都与 Victoria 3 安装目录中的“game”文件夹相关,因为这是游戏的所有可编写脚本部分所在的位置。
注意:没有依赖关系的对象仍然可以引用原始对象(数字、字符串等)或核心游戏概念,但 mod 无法编辑或定义任何对象类型,只能更改参数值。嵌套引用,尤其是修饰符中的嵌套引用,通常也不计算在内,因为修饰符可以具有任意依赖关系。
{| class="mildtable sortable mw-collapsible"
{| class="mildtable sortable mw-collapsible"
! Object type
! Object type
! Path
! 路径
! Dependencies
! Dependencies
|- 
|- 
! Professions
! 人群职业
| common/pop_types
| common/pop_types
| {{icon|no}}
| {{ 图标|no}}
|-
|-
! [[Goods_modding|Trade goods]]
! [[Goods_modding| 商品]]
| common/goods
| common/goods
| {{icon|no}}
| {{ 图标|no}}
|-
|-
! Needs
! 人群需求
| common/pop_needs
| common/pop_needs
|
|
第59行: 第64行:
: Trade goods, via 'goods' inside 'entry'
: Trade goods, via 'goods' inside 'entry'
|-
|-
! Eras
! 时代
| common/technology/eras
| common/technology/eras
| {{icon|no}}
| {{ 图标|no}}
|-
|-
! [[Technology_modding|Technologies]]
! [[Technology_modding| 科技]]
| game/common/technology/technologies
| game/common/technology/technologies
|
|
第69行: 第74行:
:Technologies, via 'unlocking_technologies'
:Technologies, via 'unlocking_technologies'
|-
|-
! [[Institution_modding|Institutions]]
! [[Institution_modding| 析构]]
| common/institutions
| common/institutions
| {{icon|no}}
| {{ 图标|no}}
|-
|-
! Law groups
! 法律组
| common/law_groups
| common/law_groups
| {{icon|no}}
| {{ 图标|no}}
|-
|-
! [[Laws_modding|Laws]]
! [[Laws_modding| 法律]]
| common/laws
| common/laws
第85行: 第90行:
:Laws, via 'possible_political_movements'
:Laws, via 'possible_political_movements'
|-
|-
! Ideologies
! 意识形态
| common/ideologies
| common/ideologies
|
|
第91行: 第96行:
: Laws, via law group parameter mappings
: Laws, via law group parameter mappings
|-
|-
! Interest group traits
! 利益集团特质
| game/common/interest_group_traits
| game/common/interest_group_traits
| {{icon|no}}
| {{ 图标|no}}
|-
|-
! [[Interest group modding|Interest groups]]
! [[Interest group modding| 利益集团]]
| common/interest_groups
| common/interest_groups
|
|
第101行: 第106行:
: Ideologies, via 'ideologies'
: Ideologies, via 'ideologies'
|-
|-
! Production methods
! 生产方式
| common/production_methods
| common/production_methods
|
|
第108行: 第113行:
: Production methods, via 'unlocking_production_methods'
: Production methods, via 'unlocking_production_methods'
|-
|-
! Production method groups
! 生产方式组
| common/production_method_groups
| common/production_method_groups
|
|
: Production methods, via 'production_methods'
: Production methods, via 'production_methods'
|-
|-
! Building groups
! 建筑组
| common/building_groups
| common/building_groups
|
|
第119行: 第124行:
: Building, via 'default_building'
: Building, via 'default_building'
|-
|-
! [[Building_modding|Buildings]]
! [[Building_modding| 建筑]]
| common/buildings
| common/buildings
|
|
第128行: 第133行:
|}
|}


=== 参数 ===


=== Parameters ===
创建游戏对象时,通常需要遵循特定的模式。以下是各种游戏对象的参数、它们的含义、必需的参数以及要输入的值类型。
 
When creating a game object, you generally need to follow a specific pattern. Here are the parameters for various game objects, what they mean, which are required, and what type of value to enter.


{| class="mildtable sortable mw-collapsible"
{| class="mildtable sortable mw-collapsible"
第143行: 第147行:
| texture
| texture
| string
| string
| {{icon|yes}}
| {{ 图标|yes}}
| good icon filepath
| good icon filepath
|-
|-
| cost
| cost
| integer
| integer
| {{icon|yes}}
| {{ 图标|yes}}
| base good price
| base good price
|-
|-
第157行: 第161行:
: luxury
: luxury
: military
: military
| {{icon|yes}}
| {{ 图标|yes}}
| which goods category it belongs to
| which goods category it belongs to
|-
|-
| prestige_factor
| prestige_factor
| integer
| integer
| {{icon|yes}}
| {{ 图标|yes}}
| base prestige for being lowest rank leading producer:
| base prestige for being lowest rank leading producer:
specifically, holding the MIN_PRESTIGE_AWARD spot.
specifically, holding the MIN_PRESTIGE_AWARD spot.
第168行: 第172行:
| traded_quantity
| traded_quantity
| integer
| integer
| {{icon|no}}
| {{ 图标|no}}
| how many goods are traded for each level of a trade route
| how many goods are traded for each level of a trade route
|-
|-
| convoy_cost_multiplier
| convoy_cost_multiplier
| floating point number
| floating point number
| {{icon|no}}
| {{ 图标|no}}
| how many times more convoys are needed to transport this good
| how many times more convoys are needed to transport this good
|-
|-
| consumption_tax_cost
| consumption_tax_cost
| integer
| integer
| {{icon|no}}
| {{ 图标|no}}
| how much authority it costs to levy a consumption tax
| how much authority it costs to levy a consumption tax
note: absence of this parameter implies no consumption tax can be levied
note: absence of this parameter implies no consumption tax can be levied
第185行: 第189行:
| technology_cost
| technology_cost
| integer
| integer
| {{icon|yes}}
| {{ 图标|yes}}
| the base technology cost for techs in this era
| the base technology cost for techs in this era
|-
|-
第191行: 第195行:
| era
| era
| Technology Era
| Technology Era
| {{icon|yes}}
| {{ 图标|yes}}
| which era this technology belongs to
| which era this technology belongs to
|-
|-
| texture
| texture
| string
| string
| {{icon|yes}}
| {{ 图标|yes}}
| technology icon filepath
| technology icon filepath
|-
|-
第204行: 第208行:
: military
: military
: society
: society
| {{icon|yes}}
| {{ 图标|yes}}
| which category this technology belongs to
| which category this technology belongs to
|-
|-
| modifier
| modifier
| country modifier
| country modifier
| {{icon|no}}
| {{ 图标|no}}
| which immediate effects this technology has on your country
| which immediate effects this technology has on your country
Example: Cotton Gin provides 25% cotton plantation throughput.<br/>
Example: Cotton Gin provides 25% cotton plantation throughput.<br/>
第217行: 第221行:
| unlocking_technologies
| unlocking_technologies
| list of technologies
| list of technologies
| {{icon|no}}
| {{ 图标|no}}
| All prerequisite technologies. If empty, it has no prerequisites
| All prerequisite technologies. If empty, it has no prerequisites
|-
|-
| can_research
| can_research
| boolean
| boolean
| {{icon|no}}
| {{ 图标|no}}
| if 'no', makes it unavailable for normal research.
| if 'no', makes it unavailable for normal research.
Example: [[Production_technology#Sericulture|Sericulture]].
Example: [[Production_technology#Sericulture|Sericulture]].
第229行: 第233行:




==See also==
== 参见==
[[Console commands]]
[[ 控制台指令]]


[[On actions]]
[[On actions]]


=== Modders Guides===
=== 模组制作指南===
[[User:Gr3st3r|Grester's Compendium]]
[[User:Gr3st3r|Grester's Compendium]]


{{Modding navbox}}
{{Modding navbox}}
[[Category:Modding]]
[[ 分类: 模组]]
[[en:Modding]]
[[en:Modding]]

2024年2月15日 (四) 11:40的最新版本

模组可以更改游戏中的元素,也可以为游戏加入新特性。 相当多的东西被硬编码,不能被编辑,比如说新的地图模式和加入快捷键。

所有不使用到控制台指令的模组都可以使用成就

提示

  • 不要直接在游戏文件里修改文件,不仅会破坏游戏而且修改的内容也会在游戏更新中被覆盖。
  • 使用可以高亮语法的编辑器可以让模组制作事半功倍,下面是拥有对维多利亚3语法支持插件的编辑器:
    1. Visual Studio Code 是一个完备但是稍慢的文本编辑器,使用CwTools插件可以使其支持维多利亚3的语法
    2. Sublime Text 是非常快的编辑器,支持高亮语法,自动补全和文档查询,搭配维多利亚3插件Victoria 3 Tools使用
  • 以 "-debug_mode" 和 "-filewatcher" 指令可以开启调试模式,调试模式可以使用控制台和开发工具,同时也能热更改一些文件而不需要重启。
  • 查看error.log以捕获bug,这种精确的记录对于模组制作者来说是一种可以判断为什么一些东西不工作的利器。文件位于Documents/Paradox Interactive/Victoria 3/logs
  • 请备份,所有东西都可能会变坏所以需要备份。你可以手动备份也可以使用诸如GIt的版本控制工具、可以考虑使用Github来团队协作,如果你是初学者建议使用以Github Desktopi熟悉Git。
  • 使用Use "script_docs" 和 "DumpDataTypes" 控制台指令可以在Documents/Paradox Interactive/Victoria 3/logs生成效果、条件、作用域和事件目标的记录。
  • 如果你不清楚怎么做,可以在游戏文件搜索你需要搜索的单词,查找文件中的单词是写出没有错误的mod的一个快捷方法。
  • 当你下载了你上传的Steam mod,在本地文件又有原本的Steam mod,Steam的mod不会运行。
  • 括号要补全,这样才能使得代码都在一个层次内,正确的代码是可以让大括号在文本编辑器折起来的。漂亮的代码能够更好看清楚错误和增强可读性。
  • 以#开头来进行注释,可以说明代码的用途,也可以注释掉暂时不需要用的代码。

实用的工具

  • Paradox Highlight 提供Victoria 3和各类其它Paradox游戏语法高亮的Visual Studio Code插件
  • Pdx-Unlimiter 可以修改存档数据的实用工具
  • Map data editor 基于jomini.js制作的用chrome启动的省份数据编辑器,可以可视化编辑history/states的数据
  • Music Mod Creation Tool 顾名思义,这是一个音乐mod制作工具

模组指导

自定义国家

自定义事件

自定义日志

自定义修正

游戏对象参考

依赖项和文件夹结构

如果要添加新的游戏对象,则需要记住它依赖于哪些更基本的对象,以及如何组织文件以便游戏识别它。

所有路径都与 Victoria 3 安装目录中的“game”文件夹相关,因为这是游戏的所有可编写脚本部分所在的位置。

注意:没有依赖关系的对象仍然可以引用原始对象(数字、字符串等)或核心游戏概念,但 mod 无法编辑或定义任何对象类型,只能更改参数值。嵌套引用,尤其是修饰符中的嵌套引用,通常也不计算在内,因为修饰符可以具有任意依赖关系。

Object type 路径 Dependencies
人群职业 common/pop_types No
商品 common/goods No
人群需求 common/pop_needs
Trade goods, via 'default'
Trade goods, via 'goods' inside 'entry'
时代 common/technology/eras No
科技 game/common/technology/technologies
Eras, via 'era'
Technologies, via 'unlocking_technologies'
析构 common/institutions No
法律组 common/law_groups No
法律 common/laws
Institutions, via 'institution'
Law groups, via group
Laws, via 'disallowing_laws'
Laws, via 'possible_political_movements'
意识形态 common/ideologies
Law groups, as parameters
Laws, via law group parameter mappings
利益集团特质 game/common/interest_group_traits No
利益集团 common/interest_groups
Interest group traits, via 'traits'
Ideologies, via 'ideologies'
生产方式 common/production_methods
Technologies, via 'unlocking_technologies'
Laws, via 'disallowing_laws'
Production methods, via 'unlocking_production_methods'
生产方式组 common/production_method_groups
Production methods, via 'production_methods'
建筑组 common/building_groups
Building groups, via 'parent_group'
Building, via 'default_building'
建筑 common/buildings
Building groups, via 'building_group'
Technology, via 'unlocking_technologies'
Production method groups, via 'production_method_groups'

参数

创建游戏对象时,通常需要遵循特定的模式。以下是各种游戏对象的参数、它们的含义、必需的参数以及要输入的值类型。

Object type Parameter Parameter type Required Meaning
Trade goods texture string Yes good icon filepath
cost integer Yes base good price
category keyword, one of:
staple
industrial
luxury
military
Yes which goods category it belongs to
prestige_factor integer Yes base prestige for being lowest rank leading producer:

specifically, holding the MIN_PRESTIGE_AWARD spot.

traded_quantity integer No how many goods are traded for each level of a trade route
convoy_cost_multiplier floating point number No how many times more convoys are needed to transport this good
consumption_tax_cost integer No how much authority it costs to levy a consumption tax

note: absence of this parameter implies no consumption tax can be levied

Technology Era technology_cost integer Yes the base technology cost for techs in this era
Technology era Technology Era Yes which era this technology belongs to
texture string Yes technology icon filepath
category keyword, one of:
production
military
society
Yes which category this technology belongs to
modifier country modifier No which immediate effects this technology has on your country

Example: Cotton Gin provides 25% cotton plantation throughput.
Unlocked buildings, production methods, laws, etc are specified
from the unlocked object, not the unlocking technology.

unlocking_technologies list of technologies No All prerequisite technologies. If empty, it has no prerequisites
can_research boolean No if 'no', makes it unavailable for normal research.

Example: Sericulture.


参见

控制台指令

On actions

模组制作指南

Grester's Compendium