Wiki

trigger · division_has_majority_template

Definition

  • Supported scope:(none)
  • Supported target:none

Description

checks if division template has majority of subunit type.

实战 · 配合 · 坑

实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。

实战用法

division_has_majority_template 常用于针对特定兵种构成的师团进行专项判断,例如在事件或决议中检测某个师团是否以装甲或步兵为主,从而给予对应加成或触发不同叙事分支。在装备/训练类 mod 中,也常用来限制某些特殊指令仅对"以某兵种为主"的师团生效。

# 示例:当师团以装甲亚单位为主时触发某事件判断
division_has_majority_template = {
    type = armor  # 检测该师团模板是否以装甲类亚单位为多数
}

配合关系

由于当前白名单中暂无同 scope 下的其他 effect 或 trigger 命令,无法列出有效的交叉引用条目。如需配合使用,请结合通用条件块(如 limit)在更高层级的 scope 中进行组合。

常见坑

  1. 误用 scope:该 trigger 的支持 scope 为空列表,意味着它只能在特定上下文(如迭代师团的循环块)中被正确调用,直接在国家或角色 scope 下裸写往往会导致脚本报错或静默失效,需确认外层已处于正确的师团上下文中。
  2. type 字段填写错误:亚单位类型名称必须与 /common/units/ 下定义的实际 key 严格一致(区分大小写),填写显示名或本地化文本会导致条件永远不成立,且游戏通常不会给出明显报错提示。

Hands-On Notes

Hands-on notes are AI-generated and checked against the vanilla command vocabulary — treat them as a starting point, not authoritative reference. The definition above is the game's own documentation.

Hands-On Usage

division_has_majority_template is commonly used to perform specialized checks on divisions with specific unit composition types. For example, in events or decisions, it can detect whether a division is primarily composed of armor or infantry units, allowing you to grant corresponding bonuses or trigger different narrative branches. In equipment/training mods, it is also frequently used to restrict certain special commands to only apply to divisions that are "primarily of a certain unit type."

# Example: Trigger an event check when a division is primarily composed of armor sub-units
division_has_majority_template = {
    type = armor  # Check if this division template has armor-type sub-units as the majority
}

Synergy

Since the current whitelist contains no other effect or trigger commands within the same scope, no cross-reference entries can be listed. For combined usage, please use general condition blocks (such as limit) to compose at higher scope levels.

Common Pitfalls

  1. Incorrect scope usage: This trigger's supported scope list is empty, meaning it can only be correctly invoked in specific contexts (such as loops iterating over divisions). Writing it directly under country or character scope often results in script errors or silent failures. You must ensure the outer context is already within the correct division scope.
  2. type field entry errors: The sub-unit type name must strictly match the actual key defined in /common/units/ (case-sensitive). Entering display names or localization text will cause the condition to never trigger, and the game typically will not provide an obvious error message.