Wiki

effect · set_faction_military_unlocked

Definition

  • Supported scope:any
  • Supported target:none

Description

Sets wheter the current countries faction can make changes to the faction research section

### Examples

TAG = { _set_faction_military_unlocked = yes }

实战 · 配合 · 坑

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

实战用法

在 mod 中若你为某个阵营增添了自定义的"军事研究"面板,可用此 effect 在特定事件或决议触发后解锁对应的操作权限,例如当玩家的国家完成某个国策后才允许修改阵营研究设置。下面是一个典型的国策完成触发场景:

focus = {
    id = MY_FOCUS_UNLOCK_FACTION_RESEARCH
    ...
    completion_reward = {
        set_faction_military_unlocked = yes
    }
}

配合关系

  • [set_faction_research_unlocked](/wiki/effect/set_faction_research_unlocked):两者功能高度相关,通常同时调用以确保阵营研究面板的显示与编辑权限同步开放。
  • [hidden_effect](/wiki/effect/hidden_effect):将本 effect 包裹在隐藏块中,避免玩家在事件选项里看到无意义的解锁提示文本。
  • [custom_effect_tooltip](/wiki/effect/custom_effect_tooltip):与 hidden_effect 搭配使用,用自定义文本替代默认的效果说明,向玩家清晰传达"已解锁阵营研究权限"的信息。
  • [has_game_rule](/wiki/trigger/has_game_rule):在执行解锁前先判断当前游戏规则,确保只有特定规则模式下才触发此 effect,避免破坏平衡。

常见坑

  1. Scope 使用错误:此 effect 需在国家 scope(country scope)下调用,若误写在 state 或 province 等其他 scope 的执行块中将导致脚本报错或静默失效,务必确认外层 scope 是目标国家标签。
  2. 只解锁不检查派系归属:直接对一个不属于任何派系的国家调用此 effect 时,效果可能不生效或产生未定义行为,建议在调用前先通过相关 trigger 确认该国家确实存在并隶属于某一派系。

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

In a mod, if you've added a custom "military research" panel for a faction, you can use this effect to unlock the corresponding permissions after a specific event or decision triggers. For example, you might allow players to modify faction research settings only after their nation completes a certain focus. Below is a typical scenario triggered by focus completion:

focus = {
    id = MY_FOCUS_UNLOCK_FACTION_RESEARCH
    ...
    completion_reward = {
        set_faction_military_unlocked = yes
    }
}

Synergy

  • [set_faction_research_unlocked](/wiki/effect/set_faction_research_unlocked): Highly related in functionality; typically invoked together to ensure the faction research panel's display and edit permissions are unlocked simultaneously.
  • [hidden_effect](/wiki/effect/hidden_effect): Wrap this effect in a hidden block to prevent players from seeing meaningless unlock notification text in event options.
  • [custom_effect_tooltip](/wiki/effect/custom_effect_tooltip): Used in conjunction with hidden_effect to replace the default effect description with custom text, clearly communicating to players that "faction research permissions have been unlocked."
  • [has_game_rule](/wiki/trigger/has_game_rule): Check the current game rule before executing the unlock to ensure this effect only triggers under specific rule modes, preventing balance disruption.

Common Pitfalls

  1. Incorrect Scope Usage: This effect must be called within a country scope. If mistakenly written in a state or province scope or other execution blocks, it will cause script errors or silent failure. Always verify the outer scope is the target country tag.
  2. Unlocking Without Verifying Faction Membership: Calling this effect directly on a nation that doesn't belong to any faction may result in ineffective or undefined behavior. It's recommended to confirm via relevant triggers that the nation actually exists and belongs to a faction before invoking this effect.