hoi4-modding
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHOI4 Modding
HOI4 模组制作
Follow the rules in references/modding-rules.md for all HOI4 modding work.
所有 HOI4 模组制作工作均须遵循 references/modding-rules.md 中的规则。
Reference Files
参考文件
Core rules and language foundation
核心规则与本地化基础
- — Core rules for HOI4 modding (encoding, comments, tooltips, loc flavor, design units).
references/modding-rules.md - —
references/mod-structure-template.md/.mod, load order,descriptor.mod,dependencies.replace_path - — Scopes (
references/scopes-template.md/ROOT/FROM),PREV/every_*, event targets.any_* - — Common effects and where to use them.
references/effects-template.md - — Common triggers, logic blocks,
references/triggers-template.md/allowed/available.visible - — Variables, arrays, collections, event targets, loc display.
references/variables-arrays-template.md - — Reusable
references/scripted-effects-template.mdblocks.common/scripted_effects - —
references/on-actions-template.mdhooks and ROOT/FROM discipline.common/on_actions - — YML encoding, color codes, dynamic keys, variables in loc.
references/localisation-syntax-template.md
- — HOI4 模组制作的核心规则(编码、注释、tooltip、loc 文本风格、内容单元设计)。
references/modding-rules.md - —
references/mod-structure-template.md/.mod、加载顺序、descriptor.mod、dependencies。replace_path - — 作用域(
references/scopes-template.md/ROOT/FROM)、PREV/every_*、事件目标。any_* - — 常用 effects 及其使用位置。
references/effects-template.md - — 常用 triggers、逻辑块、
references/triggers-template.md/allowed/available。visible - — 变量、数组、集合、事件目标、loc 显示。
references/variables-arrays-template.md - — 可复用的
references/scripted-effects-template.md块。common/scripted_effects - —
references/on-actions-template.mdhooks 与 ROOT/FROM 使用规范。common/on_actions - — YML 编码、颜色代码、动态键、loc 中的变量。
references/localisation-syntax-template.md
Content system templates
内容系统模板
- — National focus tree templates and field reference.
references/focus-template.md - — Decision category and decision templates.
references/decision-template.md - — Country event and news event templates.
references/event-template.md - — Military industrial organization (MIO) templates and equipment bonuses.
references/mio-template.md - — Laws, national spirits, and manufacturer advisors.
references/idea-template.md - — Sub-doctrine templates and mastery rewards.
references/subdoctrine-template.md - — Special projects, specializations, scientists, and facilities.
references/special-projects-template.md - — Balance of power (BOP) templates.
references/bop-template.md - — AI areas and AI strategies.
references/ai-template.md - — Equipment archetypes and variants.
references/equipment-template.md - — Tank, plane, and ship equipment modules.
references/equipment-module-template.md - — Create equipment variant examples and parts lists.
references/equipment-variant-template.md - — Sub unit definitions and icon registration.
references/unit-template.md - — Country history file structure and starting effects.
references/country-history-template.md - — Order of battle and production line setup.
references/oob-template.md - — State/province definitions and buildings.
references/state-template.md - — Vanilla advisor slots and trait effects.
references/advisor-traits-template.md - — Character definitions for leaders, advisors, commanders, scientists.
references/character-template.md - — Diplomatic opinion modifiers.
references/opinion-modifiers-template.md - — Scripted triggers and scripted localisation.
references/scripted-triggers-template.md - — Custom building definitions and spawn points.
references/buildings-template.md - — Operatives, intelligence operations, and scripted diplomatic actions.
references/intelligence-diplo-template.md - — Faction templates, goals, manifests, rules, member upgrades, and AI FI spending.
references/faction-system-template.md - — Dynamic national spirits with variable-driven modifiers and tooltip conventions.
references/dynamic-modifier-template.md
- — 国家焦点树模板与字段参考。
references/focus-template.md - — 决策分类与决策模板。
references/decision-template.md - — 国家事件与新闻事件模板。
references/event-template.md - — 军事工业组织(MIO)模板与装备加成。
references/mio-template.md - — 法律、国家精神与制造商顾问。
references/idea-template.md - — sub-doctrine 模板与精通奖励。
references/subdoctrine-template.md - — 特殊项目、专业化、科学家与设施。
references/special-projects-template.md - — 力量平衡(BOP)模板。
references/bop-template.md - — AI 领域与 AI 策略。
references/ai-template.md - — 装备原型与变体。
references/equipment-template.md - — 坦克、飞机与舰船装备模块。
references/equipment-module-template.md - — 创建装备变体的示例与部件列表。
references/equipment-variant-template.md - — 兵种定义与图标注册。
references/unit-template.md - — 国家历史文件结构与初始 effects。
references/country-history-template.md - — 战斗序列与生产线配置。
references/oob-template.md - — 州/省份定义与建筑。
references/state-template.md - — 原版顾问槽位与 trait effects。
references/advisor-traits-template.md - — 领袖、顾问、指挥官与科学家的角色定义。
references/character-template.md - — 外交意见修正。
references/opinion-modifiers-template.md - — 脚本化 triggers 与脚本化 localisation。
references/scripted-triggers-template.md - — 自定义建筑定义与生成点。
references/buildings-template.md - — 特工、情报行动与脚本化外交行动。
references/intelligence-diplo-template.md - — 阵营模板、目标、清单、规则、成员升级与 AI FI 支出。
references/faction-system-template.md - — 由变量驱动的动态国家精神与 tooltip 约定。
references/dynamic-modifier-template.md
Extended content (medium priority)
扩展内容(中等优先级)
- — Bookmarks / scenario select screen.
references/bookmarks-template.md - — Full new-country checklist (tag → history → flag → loc).
references/new-country-template.md - —
references/gfx-registration-template.mdsprite registration (goals, ideas, events, shine, flags)..gfx - — Ideologies and sub-ideologies.
references/ideologies-template.md - — Custom country_leader and unit_leader traits.
references/custom-traits-template.md - — Autonomous states / puppet levels.
references/autonomy-template.md - — Wargoals, declare war, peace conference AI hooks.
references/wargoals-peace-template.md - — Resources, railways, supply nodes, strategic regions.
references/resources-supply-template.md - — Name pools and division name groups.
references/names-template.md - — Technology file structure (not just ID lists).
references/technology-file-template.md - — Where modifiers live and how to look up keys.
references/modifiers-index-template.md - — Version adaption / migration checklist.
references/version-migration-template.md
- — 书签/场景选择界面。
references/bookmarks-template.md - — 完整的新国家检查清单(tag → history → flag → loc)。
references/new-country-template.md - —
references/gfx-registration-template.md精灵注册(目标、理念、事件、shine、旗帜)。.gfx - — 意识形态与次级意识形态。
references/ideologies-template.md - — 自定义
references/custom-traits-template.md与country_leadertraits。unit_leader - — 自治州/傀儡等级。
references/autonomy-template.md - — 战争目标、宣战与和平会议 AI hooks。
references/wargoals-peace-template.md - — 资源、铁路、补给节点与战略地区。
references/resources-supply-template.md - — 名称池与师级名称组。
references/names-template.md - — 科技文件结构(不只是 ID 列表)。
references/technology-file-template.md - — 修正器所在位置及键值查找方法。
references/modifiers-index-template.md - — 版本适配/迁移检查清单。
references/version-migration-template.md
Gap-fill (common coverage)
补充覆盖(常见内容)
- — Full
references/common-directory-index.mdfolder → skill page map; check here before inventing systems.common/ - — Continuous focus palettes.
references/continuous-focus-template.md - — Occupation laws, resistance/compliance.
references/occupation-resistance-template.md - — Pre-game rules and
references/game-rules-template.md.has_game_rule - — Technology sharing groups.
references/technology-sharing-template.md - — Dynamic country tag aliases.
references/country-tag-aliases-template.md - — Raid types.
references/raids-template.md - — Commander abilities (command power).
references/abilities-template.md - — Aces and unit medals.
references/aces-medals-template.md - — Idea category / advisor slot layout.
references/idea-tags-template.md - — State categories and terrain.
references/state-category-terrain-template.md - — Grand doctrine / tracks / mastery overview.
references/doctrine-system-template.md - —
references/script-constants-template.mdandscript_constantsvalues.constant:
- — 完整的
references/common-directory-index.md文件夹 → skill 页面映射;创建新系统前先在此处检查。common/ - — 连续焦点配色方案。
references/continuous-focus-template.md - — 占领法律、抵抗/顺从。
references/occupation-resistance-template.md - — 开局前规则与
references/game-rules-template.md。has_game_rule - — 科技共享组。
references/technology-sharing-template.md - — 动态国家 tag 别名。
references/country-tag-aliases-template.md - — 突袭类型。
references/raids-template.md - — 指挥官能力(指挥点数)。
references/abilities-template.md - — 王牌与单位勋章。
references/aces-medals-template.md - — 理念分类/顾问槽位布局。
references/idea-tags-template.md - — 州分类与地形。
references/state-category-terrain-template.md - — 总体 Doctrine/轨道/精通机制概览。
references/doctrine-system-template.md - —
references/script-constants-template.md与script_constants值。constant:
Advanced / low priority
高级功能(低优先级)
- — Scripted GUI +
references/scripted-gui-template.mdwiring..gui - — Super event (big event UI) community pattern.
references/super-event-template.md - —
references/defines-template.mdLua overrides (use sparingly).common/defines - — Map folder responsibilities and safe vs unsafe edits.
references/map-modding-template.md - — 3D unit models / entities entry.
references/unit-models-template.md - — Music assets, songs lists, radio.
references/music-radio-template.md - — Bitmap fonts registration.
references/fonts-template.md - —
references/shaders-template.mdshaders entry (advanced).gfx/FX - — Scripted map modes.
references/map-modes-template.md - — Dynamic place-name renaming entry.
references/dynamic-renaming-template.md - — Lock diplomacy buttons via fixed scripted_trigger names.
references/diplomacy-enable-triggers-template.md - — error.log workflow and debugging order.
references/debug-workflow-template.md
- — 脚本化 GUI 与
references/scripted-gui-template.md连接。.gui - — Super event(大型事件 UI)社区模式。
references/super-event-template.md - —
references/defines-template.mdLua 覆盖(谨慎使用)。common/defines - — 地图文件夹职责与安全/不安全编辑。
references/map-modding-template.md - — 3D 单位模型/entities 入口。
references/unit-models-template.md - — 音乐资源、歌曲列表与广播。
references/music-radio-template.md - — 位图字体注册。
references/fonts-template.md - —
references/shaders-template.md着色器入口(高级)。gfx/FX - — 脚本化地图模式。
references/map-modes-template.md - — 动态地名重命名入口。
references/dynamic-renaming-template.md - — 通过固定
references/diplomacy-enable-triggers-template.md名称锁定外交按钮。scripted_trigger - —
references/debug-workflow-template.md工作流与调试顺序。error.log
Data quick-reference
数据快速参考
- — Vanilla technology code reference.
references/data/tech-list.md - — Vanilla doctrine and sub-doctrine codes.
references/data/doctrine-list.md - — Vanilla equipment codes for bonuses and OOB.
references/data/equipment-list.md - — State categories and national spirit modifier keys.
references/data/state-modifiers.md
- — 原版科技代码参考。
references/data/tech-list.md - — 原版 doctrine 与 sub-doctrine 代码。
references/data/doctrine-list.md - — 用于加成和 OOB 的原版装备代码。
references/data/equipment-list.md - — 州分类与国家精神修正器键。
references/data/state-modifiers.md
Workflow
工作流
- Read before making changes. 1b. Hard rule — backup before editing existing files: Before modifying any existing file, create a timestamped backup; after the edit, compare against the backup for truncation, missing blocks, or brace imbalance; if clean, delete the backup; if broken, restore/fix then delete the backup. See
references/modding-rules.mdsection "Mandatory backup before editing existing files". Never skip this.references/modding-rules.md - When editing /
.mod, load order,descriptor.mod, ordependencies, checkreplace_path.references/mod-structure-template.md - When writing scopes, /
ROOT/FROM, orPREV/every_*blocks, checkany_*.references/scopes-template.md - When writing or looking up effects, check .
references/effects-template.md - When writing or looking up triggers / /
limit/available, checkvisible.references/triggers-template.md - When writing variables, arrays, collections, or event targets, check .
references/variables-arrays-template.md - When writing reusable scripted effects, check .
references/scripted-effects-template.md - When writing hooks, check
on_actions.references/on-actions-template.md - When writing localization files (syntax, color codes, dynamic keys), check and match vanilla flavor per
references/localisation-syntax-template.md.modding-rules.md - When writing a national focus, check .
references/focus-template.md - When writing a decision, check .
references/decision-template.md - When writing an event, check .
references/event-template.md - When writing an MIO, check .
references/mio-template.md - When writing an idea, check .
references/idea-template.md - When writing a sub-doctrine, check .
references/subdoctrine-template.md - When writing a special project, check .
references/special-projects-template.md - When writing a balance of power, check .
references/bop-template.md - When writing AI behavior, check .
references/ai-template.md - When writing equipment, check .
references/equipment-template.md - When writing equipment modules, check .
references/equipment-module-template.md - When creating equipment variants, check .
references/equipment-variant-template.md - When writing units, check .
references/unit-template.md - When writing country history, check .
references/country-history-template.md - When writing OOB or production lines, check .
references/oob-template.md - When writing states, check .
references/state-template.md - When assigning vanilla advisor traits, check .
references/advisor-traits-template.md - When writing characters, check .
references/character-template.md - When adding diplomatic opinion modifiers, check .
references/opinion-modifiers-template.md - When writing scripted triggers or scripted localisation, check .
references/scripted-triggers-template.md - When writing buildings, check .
references/buildings-template.md - When writing intelligence operations or diplomatic actions, check .
references/intelligence-diplo-template.md - When writing a faction system, check .
references/faction-system-template.md - When writing a dynamic national spirit, check .
references/dynamic-modifier-template.md - When writing bookmarks / scenario select, check .
references/bookmarks-template.md - When creating a new country (tag, color, history, flag, loc), check .
references/new-country-template.md - When registering GFX (focus icons, idea icons, event pics, shine, flags), check .
references/gfx-registration-template.md - When editing ideologies or sub-ideologies, check .
references/ideologies-template.md - When writing custom leader or unit leader traits, check .
references/custom-traits-template.md - When defining or setting autonomy/puppet levels, check .
references/autonomy-template.md - When writing wargoals, war declaration, or peace conference AI, check .
references/wargoals-peace-template.md - When placing resources, railways, supply nodes, or strategic regions, check .
references/resources-supply-template.md - When writing name pools or division name groups, check .
references/names-template.md - When writing technology files (tree structure, not only IDs), check .
references/technology-file-template.md - When looking up or placing modifier keys, check then
references/modifiers-index-template.md.references/data/state-modifiers.md - When adapting a mod to a new game version, check .
references/version-migration-template.md - When writing scripted GUI or custom windows, check
.gui.references/scripted-gui-template.md - When implementing super events (big event UI), check .
references/super-event-template.md - When editing defines, check (prefer minimal overrides).
references/defines-template.md - When editing map files or province layout, check .
references/map-modding-template.md - When replacing unit 3D models/entities, check .
references/unit-models-template.md - When adding music or radio stations, check .
references/music-radio-template.md - When adding or changing fonts, check .
references/fonts-template.md - When editing shaders under , check
gfx/FX.references/shaders-template.md - When writing scripted map modes, check .
references/map-modes-template.md - When implementing dynamic place renaming, check .
references/dynamic-renaming-template.md - When locking diplomacy actions, check .
references/diplomacy-enable-triggers-template.md - When debugging load errors or unexpected behavior, check .
references/debug-workflow-template.md - When auditing which systems exist vs this skill, check
common/.references/common-directory-index.md - When writing continuous focuses, check .
references/continuous-focus-template.md - When writing occupation laws or resistance/compliance, check .
references/occupation-resistance-template.md - When writing game rules or AI path rules, check .
references/game-rules-template.md - When writing technology sharing groups, check .
references/technology-sharing-template.md - When writing country tag aliases, check .
references/country-tag-aliases-template.md - When writing raids, check .
references/raids-template.md - When writing commander abilities, check .
references/abilities-template.md - When writing aces or unit medals, check .
references/aces-medals-template.md - When editing idea slot layout (), check
idea_tags.references/idea-tags-template.md - When editing state categories or terrain, check .
references/state-category-terrain-template.md - When working on the grand doctrine system (not only subdoctrines), check .
references/doctrine-system-template.md - When defining script constants, check .
references/script-constants-template.md - When looking up vanilla technology codes, check .
references/data/tech-list.md - When looking up vanilla doctrine codes, check .
references/data/doctrine-list.md - When looking up vanilla equipment codes, check .
references/data/equipment-list.md - When looking up state categories or modifier keys, check .
references/data/state-modifiers.md - When writing localization text (names/descriptions for focus/event/news/idea/decision), look up vanilla localization first and match its flavor/register.
- When unsure about syntax or structure:
- Check if the folder is unfamiliar.
references/common-directory-index.md - Check this skill's references first (language base → content → gap-fill → advanced).
- Check other files in the same directory within the project.
- Check the user's HOI4 base game installation and official wiki / local library.
- Ask the user if none of the above resolve the question.
- 修改前阅读 。 1b. 硬性规则——编辑现有文件前必须备份: 修改任何现有文件前,先创建带时间戳的备份;编辑后将文件与备份进行比较,检查是否存在截断、代码块缺失或大括号不平衡;如果检查无误,则删除备份;如果文件损坏,则恢复或修复后再删除备份。请参阅
references/modding-rules.md中“Mandatory backup before editing existing files”一节。绝不可跳过此步骤。references/modding-rules.md - 编辑 /
.mod、加载顺序、descriptor.mod或dependencies时,检查replace_path。references/mod-structure-template.md - 编写作用域、/
ROOT/FROM或PREV/every_*块时,检查any_*。references/scopes-template.md - 编写或查找 effects 时,检查 。
references/effects-template.md - 编写或查找 triggers / /
limit/available时,检查visible。references/triggers-template.md - 编写变量、数组、集合或事件目标时,检查 。
references/variables-arrays-template.md - 编写可复用的 scripted effects 时,检查 。
references/scripted-effects-template.md - 编写 hooks 时,检查
on_actions。references/on-actions-template.md - 编写本地化文件(语法、颜色代码、动态键)时,检查 ,并按照
references/localisation-syntax-template.md匹配原版文本风格。modding-rules.md - 编写国家焦点时,检查 。
references/focus-template.md - 编写决策时,检查 。
references/decision-template.md - 编写事件时,检查 。
references/event-template.md - 编写 MIO 时,检查 。
references/mio-template.md - 编写理念时,检查 。
references/idea-template.md - 编写 sub-doctrine 时,检查 。
references/subdoctrine-template.md - 编写特殊项目时,检查 。
references/special-projects-template.md - 编写力量平衡时,检查 。
references/bop-template.md - 编写 AI 行为时,检查 。
references/ai-template.md - 编写装备时,检查 。
references/equipment-template.md - 编写装备模块时,检查 。
references/equipment-module-template.md - 创建装备变体时,检查 。
references/equipment-variant-template.md - 编写兵种时,检查 。
references/unit-template.md - 编写国家历史时,检查 。
references/country-history-template.md - 编写 OOB 或生产线时,检查 。
references/oob-template.md - 编写州时,检查 。
references/state-template.md - 指派原版顾问 traits 时,检查 。
references/advisor-traits-template.md - 编写角色时,检查 。
references/character-template.md - 添加外交意见修正时,检查 。
references/opinion-modifiers-template.md - 编写脚本化 triggers 或脚本化 localisation 时,检查 。
references/scripted-triggers-template.md - 编写建筑时,检查 。
references/buildings-template.md - 编写情报行动或外交行动时,检查 。
references/intelligence-diplo-template.md - 编写阵营系统时,检查 。
references/faction-system-template.md - 编写动态国家精神时,检查 。
references/dynamic-modifier-template.md - 编写书签/场景选择时,检查 。
references/bookmarks-template.md - 创建新国家(tag、color、history、flag、loc)时,检查 。
references/new-country-template.md - 注册 GFX(焦点图标、理念图标、事件图片、shine、旗帜)时,检查 。
references/gfx-registration-template.md - 编辑意识形态或次级意识形态时,检查 。
references/ideologies-template.md - 编写自定义领袖或单位领袖 traits 时,检查 。
references/custom-traits-template.md - 定义或设置自治/傀儡等级时,检查 。
references/autonomy-template.md - 编写战争目标、宣战或和平会议 AI 时,检查 。
references/wargoals-peace-template.md - 放置资源、铁路、补给节点或战略地区时,检查 。
references/resources-supply-template.md - 编写名称池或师级名称组时,检查 。
references/names-template.md - 编写科技文件(树状结构,而不只是 ID)时,检查 。
references/technology-file-template.md - 查找或放置修正器键时,先检查 ,再检查
references/modifiers-index-template.md。references/data/state-modifiers.md - 将模组适配到新游戏版本时,检查 。
references/version-migration-template.md - 编写脚本化 GUI 或自定义 窗口时,检查
.gui。references/scripted-gui-template.md - 实现 super events(大型事件 UI)时,检查 。
references/super-event-template.md - 编辑 defines 时,检查 (优先采用最小化覆盖)。
references/defines-template.md - 编辑地图文件或省份布局时,检查 。
references/map-modding-template.md - 替换单位 3D 模型/entities 时,检查 。
references/unit-models-template.md - 添加音乐或广播电台时,检查 。
references/music-radio-template.md - 添加或修改字体时,检查 。
references/fonts-template.md - 编辑 下的着色器时,检查
gfx/FX。references/shaders-template.md - 编写脚本化地图模式时,检查 。
references/map-modes-template.md - 实现动态地名重命名时,检查 。
references/dynamic-renaming-template.md - 锁定外交行动时,检查 。
references/diplomacy-enable-triggers-template.md - 调试加载错误或异常行为时,检查 。
references/debug-workflow-template.md - 核查 中有哪些系统尚未由此 skill 覆盖时,检查
common/。references/common-directory-index.md - 编写连续焦点时,检查 。
references/continuous-focus-template.md - 编写占领法律或抵抗/顺从机制时,检查 。
references/occupation-resistance-template.md - 编写游戏规则或 AI 路径规则时,检查 。
references/game-rules-template.md - 编写科技共享组时,检查 。
references/technology-sharing-template.md - 编写国家 tag 别名时,检查 。
references/country-tag-aliases-template.md - 编写突袭时,检查 。
references/raids-template.md - 编写指挥官能力时,检查 。
references/abilities-template.md - 编写王牌或单位勋章时,检查 。
references/aces-medals-template.md - 编辑理念槽位布局()时,检查
idea_tags。references/idea-tags-template.md - 编辑州分类或地形时,检查 。
references/state-category-terrain-template.md - 处理总体 Doctrine 系统(而非仅 sub-doctrine)时,检查 。
references/doctrine-system-template.md - 定义脚本常量时,检查 。
references/script-constants-template.md - 查找原版科技代码时,检查 。
references/data/tech-list.md - 查找原版 doctrine 代码时,检查 。
references/data/doctrine-list.md - 查找原版装备代码时,检查 。
references/data/equipment-list.md - 查找州分类或修正器键时,检查 。
references/data/state-modifiers.md - 编写本地化文本(焦点/事件/新闻/理念/决策的名称与描述)时,先查找原版本地化文本,并匹配其风格与语体。
- 不确定语法或结构时:
- 如果文件夹不熟悉,检查 。
references/common-directory-index.md - 先检查此 skill 的参考文件(语言基础 → 内容 → 补充覆盖 → 高级功能)。
- 检查项目内同一目录中的其他文件。
- 检查用户的 HOI4 游戏基础安装、官方 wiki 或本地资料库。
- 如果以上内容都无法解决问题,则询问用户。