模组制作:修订间差异

本页面所适用的版本可能已经过时,最后更新于pre-release
无编辑摘要
无编辑摘要
第20行: 第20行:
* 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.
* 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.
* Add comments, starting with #, to remember later how things works, to navigate easier or to disable parts of code without deleting them.
==实用的工具==
* [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制作工具


==模组指导==
==模组指导==
[[自定义国家|自建国]]
[[ 自建国| 自定义国家]]


[[自定义事件]]
[[自定义事件]]

2022年11月15日 (二) 23:20的版本

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

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

提示

  • 不要直接在游戏文件里修改文件,不仅会破坏游戏而且修改的内容也会在游戏更新中被覆盖。
  • 使用可以高亮语法的编辑器可以让模组制作事半功倍,下面是拥有对维多利亚3语法支持插件的编辑器:
    1. Visual Studio Code 是一个完备但是稍慢的文本编辑器,使用CwTools插件可以使其支持维多利亚3的语法
    2. Sublime Text 是非常快的编辑器,支持高亮语法,自动补全和文档查询,搭配维多利亚3插件Victoria 3 Tools使用
    3. 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" 指令可以开启调试模式,调试模式可以使用控制台和开发工具,同时也能热更改一些文件而不需要重启。
  • 查看error.log以捕获bug,这种精确的记录对于模组制作者来说是一种可以判断为什么一些东西不工作的利器。文件位于Documents/Paradox Interactive/Victoria 3/logs
  • 请备份,所有东西都可能会变坏所以需要备份。你可以手动备份也可以使用诸如GIt的版本控制工具、可以考虑使用Github来团队协作,如果你是初学者建议使用以Github Desktopi熟悉Git。
  • 使用Use "script_docs" 和 "DumpDataTypes" 控制台指令可以在Documents/Paradox Interactive/Victoria 3/logs生成效果、条件、作用域和事件目标的记录。
  • 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.
  • 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.

实用的工具


模组指导

自定义国家

自定义事件

自定义日志

自定义修正

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.

Object type Path Dependencies
Professions common/pop_types No
Trade goods common/goods No
Needs common/pop_needs
Trade goods, via 'default'
Trade goods, via 'goods' inside 'entry'
Eras common/technology/eras No
Technologies game/common/technology/technologies
Eras, via 'era'
Technologies, via 'unlocking_technologies'
Institutions common/institutions No
Law groups common/law_groups No
Laws common/laws
Institutions, via 'institution'
Law groups, via group
Laws, via 'disallowing_laws'
Laws, via 'possible_political_movements'
Ideologies common/ideologies
Law groups, as parameters
Laws, via law group parameter mappings
Interest group traits game/common/interest_group_traits No
Interest groups common/interest_groups
Interest group traits, via 'traits'
Ideologies, via 'ideologies'
Production methods common/production_methods
Technologies, via 'unlocking_technologies'
Laws, via 'disallowing_laws'
Production methods, via 'unlocking_production_methods'
Production method groups common/production_method_groups
Production methods, via 'production_methods'
Building groups common/building_groups
Building groups, via 'parent_group'
Building, via 'default_building'
Buildings common/buildings
Building groups, via 'building_group'
Technology, via 'unlocking_technologies'
Production method groups, via 'production_method_groups'


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.

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.


See also

Console commands

On actions

Modders Guides

Grester's Compendium