Wiki

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 内多次调用(如循环体内),会产生大量重复事件同帧弹出,建议始终为连锁事件至少加一小时延迟来错开执行帧。

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

country_event is the most frequently used mechanism in mods for triggering narrative events, diplomatic dialogues, and decision follow-ups. Typical scenarios include: narrative popups upon player focus completion, AI nations automatically triggering expansion events, and chained event sequences with delays (such as war preparation countdowns).

# Trigger a diplomatic event several days after focus completion with random variance
complete_national_focus = {
    ...
    immediate = {
        country_event = {
            id = my_mod.101
            days = 3
            random_days = 2   # Actual delay is 3-4 days, preventing all games from triggering on the same day
        }
    }
}

Synergy

  • [add_political_power](/wiki/effect/add_political_power): Typically chained with country_event within event options—grant political power first, then trigger the next narrative segment via a delayed event, forming a "reward → continuation" structure.
  • [has_completed_focus](/wiki/trigger/has_completed_focus): Serves as an event trigger condition to check whether a focus has been completed, ensuring country_event is only meaningfully invoked after the narrative reaches the correct checkpoint.
  • [add_ideas](/wiki/effect/add_ideas): Often executed in the same block as country_event—attach ideas to the nation (such as special decrees) as the event fires, making the event effective both visually and mechanically.
  • [every_other_country](/wiki/effect/every_other_country): When broadcasting the same event to multiple nations in bulk, nest country_event within this loop—this is the standard pattern for implementing "global announcement" type events.

Common Pitfalls

  1. Confusing scope results in events firing to the wrong nation: country_event always triggers for the nation in the current scope. If called inside every_other_country or every_faction_member, the event target becomes the iterated nation rather than the triggering nation—failure to clarify the current scope causes the event's FROM relationships to become corrupted.
  2. Omitting delay fields causes events to "fire instantly" and stack: Without days/hours, the event queues immediately; if called multiple times within the same tick (such as in loops), masses of duplicate events pop simultaneously on the same frame. It is recommended to always add at least a one-hour delay to chained events to stagger their execution frames.