命令百科

effect · country_event

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

Fires a country event.
Example:
country_event = {
	id = germany.75 # The event to fire.
	# Optional Fields:
	hours = 12 # The number of hours to wait before firing the event.
	days = 5 # The number of days to wait before firing the event.
	months = 1 # The number of months to wait before firing the event, where a month is treated as 30 days.
	# Note:  hours, days, and months can all be used and will simply be added together.
	random_hours = 18 # A random amount of hours to be added to the delay before firing, from 0 up to but not including random_hours.
	random_days = 2 # A random amount of days to be added to the delay before firing, from 0 up to but one hour less than random_days.
	# Note:  random_hours and random_days can both be used and will simply be added together.
	random = 6 # Equivalent to random_hours; preserverd for backwards compatibility.
	random = { chance = 50 ... } # Specify a set of child effects to execute as part of this effect, with a percentage chance of randomly happening or not (as a group, not individually).
	tooltip = germany.75.t # Manually specify which tooltip to use for this effect.
}

实战 · 配合 · 坑

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

实战用法

country_event 是 mod 中触发剧情事件、外交对话、决策后续反应最常用的手段。典型场景包括:玩家完成国策后弹出剧情对话、AI 国家自动触发势力扩张事件、以及带延迟的连锁事件链(如战争准备倒计时)。

# 在国策完成后,延迟数天触发一个外交事件,并加入随机波动
complete_national_focus = {
    ...
    immediate = {
        country_event = {
            id = my_mod.101
            days = 3
            random_days = 2   # 实际延迟为 3~4 天,避免所有局都在同一天触发
        }
    }
}

配合关系

  • [add_political_power](/wiki/effect/add_political_power):通常在事件 option 中与 country_event 链式使用——先给政治点奖励,再通过延迟事件触发下一段剧情,形成"奖励→后续"结构。
  • [has_completed_focus](/wiki/trigger/has_completed_focus):作为事件触发条件,判断某国策是否已完成,确保 country_event 只在剧情推进到正确节点后才有意义地被调用。
  • [add_ideas](/wiki/effect/add_ideas):常与 country_event 同块执行,在事件弹出的同时为国家附加 idea(如特殊法令),让事件在视觉与机制上双重生效。
  • [every_other_country](/wiki/effect/every_other_country):向多国批量广播同一事件时,将 country_event 嵌套在此循环内,是实现"全球公告"类事件的标准写法。

常见坑

  1. 混淆 scope 导致事件打给错误国家country_event 始终对当前 scope 的国家触发,若在 every_other_countryevery_faction_member 内部调用,事件目标会是被迭代的那个国家而非触发国——需要明确当前 scope 是谁,否则事件 FROM 关系会错乱。
  2. 省略延迟字段导致事件"瞬发"堆叠:不写 days/hours 时事件立即入队,若同一 tick 内多次调用(如循环体内),会产生大量重复事件同帧弹出,建议始终为连锁事件至少加一小时延迟来错开执行帧。