trigger · has_any_license
Definition
- Supported scope:
COUNTRY - Supported target:
any
Description
Country has any active licenses
Example: has_any_license = yes
has_any_licenseCOUNTRYanyCountry has any active licenses
Example: has_any_license = yes
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
has_any_license 常用于外贸/装备授权系统相关的 mod 中,例如在 focus 或 decision 的 available 块里判断某国是否正在享受他国的生产许可,从而决定是否解锁额外外交选项或外交压力事件。也可用于 AI 策略中,区分"自力更生"与"依赖授权"两种国家状态,给予不同的 AI 行为权重。
# 示例:某决策仅对拥有活跃授权的国家可用
decision_category = {
my_embargo_pressure = {
available = {
has_any_license = yes
}
# 触发对授权方的外交压力事件
}
}
[any_purchase_contract](/wiki/trigger/any_purchase_contract):has_any_license 确认存在授权后,可用 any_purchase_contract 进一步遍历具体合同内容,精确筛选特定装备或授权方。[break_embargo](/wiki/effect/break_embargo):当检测到存在授权且满足特定条件时,可调用 break_embargo 中断对应贸易关系,两者形成"判断-执行"的完整逻辑闭环。[create_production_license](/wiki/effect/create_production_license):常作为反向配合——若 has_any_license = no,则通过 create_production_license 新建授权,保证后续逻辑有效;两者合用可实现"无则创建"的模板写法。[all_purchase_contracts](/wiki/trigger/all_purchase_contracts):配合 has_any_license 做前置过滤,确保进入 all_purchase_contracts 遍历时列表非空,避免空集合导致逻辑误判。yes 写成 no 时语义反转却不自知:has_any_license = no 表示"完全没有任何授权",新手有时误以为它检测的是"授权未激活",实际上只要存在哪怕一条活跃授权就返回假,需搭配 any_purchase_contract 做更细粒度的判断。any_owned_state 或 any_unit_leader 等子 scope 内部调用,脚本不会报错但判断结果会静默失效或被引擎忽略,应在进入子 scope 之前于外层国家 scope 完成判断。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.
has_any_license is commonly used in mods related to trade/equipment licensing systems, such as within the available block of a focus or decision to check whether a country is currently enjoying production licenses from another nation, thereby determining whether to unlock additional diplomatic options or trigger diplomatic pressure events. It can also be used in AI strategies to distinguish between two national states—"self-sufficiency" and "license-dependent"—and assign different AI behavior weights accordingly.
# Example: A decision available only to countries with active licenses
decision_category = {
my_embargo_pressure = {
available = {
has_any_license = yes
}
# Trigger diplomatic pressure events against the licensor
}
}
[any_purchase_contract](/wiki/trigger/any_purchase_contract): After has_any_license confirms the existence of a license, use any_purchase_contract to further iterate through specific contract contents and precisely filter for particular equipment or licensors.[break_embargo](/wiki/effect/break_embargo): When detecting an active license and meeting specific conditions, invoke break_embargo to interrupt the corresponding trade relationship; together they form a complete "check-execute" logic loop.[create_production_license](/wiki/effect/create_production_license): Often used as reverse synergy—if has_any_license = no, create a new license via create_production_license to ensure subsequent logic functions properly; using both together enables a "create if absent" template pattern.[all_purchase_contracts](/wiki/trigger/all_purchase_contracts): Pair with has_any_license as a preliminary filter to ensure the list is non-empty when entering all_purchase_contracts iteration, preventing empty sets from causing logical errors.no instead of yes: has_any_license = no means "has absolutely no licenses whatsoever," yet beginners sometimes misinterpret it as "licenses are inactive." In reality, even a single active license will cause it to return false. Pair it with any_purchase_contract for finer-grained detection.any_owned_state or any_unit_leader, the script won't error but the evaluation will silently fail or be ignored by the engine. Always complete the check at the country scope level before entering any sub-scope.