effect · add_state_modifier
Definition
- Supported scope:
STATE - Supported target:
none
Description
Adds a modifier to the state
Example: add_state_modifier = { modifier = { local_non_core_manpower = 0.2 } }
add_state_modifierSTATEnoneAdds a modifier to the state
Example: add_state_modifier = { modifier = { local_non_core_manpower = 0.2 } }
实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。
add_state_modifier 常用于占领、战后重建或特殊事件场景,给某个州省动态叠加局部加成,例如殖民地管理 mod 中给非核心州省增加人力产出,或在战争事件中为某地施加临时工业惩罚。注意它与 add_dynamic_modifier 不同,添加的 modifier 块是一次性写死的静态效果,不依赖变量动态计算。
# 事件让某州的非核心人力永久提升
state_event = {
id = my_mod.1
# ...
option = {
name = my_mod.1.a
add_state_modifier = {
modifier = {
local_non_core_manpower = 0.2
local_manpower = 0.1
}
}
}
}
[has_state_flag](/wiki/trigger/has_state_flag):先用此触发器检查该州是否已打过特定标记,再决定是否追加 modifier,避免重复叠加效果。[set_state_flag](/wiki/effect/set_state_flag):在添加 modifier 后立即设置一个标记,作为"已施加"的防重复保护机制。[is_controlled_by](/wiki/trigger/is_controlled_by):常作为前置条件,确保只在特定国家实际控制该州时才赋予加成,符合实际战场逻辑。[set_state_category](/wiki/effect/set_state_category):与其配合用于州省升级事件,先改变州省类别规模,再叠加对应的产出 modifier,实现完整的"开发"流程。add_state_modifier 必须在 STATE scope 下执行,若在 COUNTRY scope 内直接调用而未通过 every_neighbor_state 等进入州域,脚本会静默失败且不报错,新手极易忽视。remove_state_modifier,一旦添加便无法通过脚本撤销;若需要可撤销的州省 modifier,应改用 [add_dynamic_modifier](/wiki/effect/add_dynamic_modifier) 配合 [remove_dynamic_modifier](/wiki/effect/remove_dynamic_modifier) 来实现完整的生命周期管理。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.
add_state_modifier is commonly used in occupation, post-war reconstruction, or special event scenarios to dynamically apply localized bonuses to a state. Examples include granting increased manpower output to non-core states in colonial management mods, or applying temporary industrial penalties to a location during war events. Note that it differs from add_dynamic_modifier—the modifier block added is a static effect written once and for all, not dynamically calculated based on variables.
state_event = { id = my_mod.1 # ... option = { name = my_mod.1.a add_state_modifier = { modifier = { local_non_core_manpower = 0.2 local_manpower = 0.1 } } } }
[has_state_flag](/wiki/trigger/has_state_flag): Use this trigger first to check if the state has already been marked with a specific flag, then decide whether to apply additional modifiers to avoid duplicate stacking.[set_state_flag](/wiki/effect/set_state_flag): Set a flag immediately after adding the modifier to serve as a "applied" anti-duplication safeguard.[is_controlled_by](/wiki/trigger/is_controlled_by): Commonly used as a prerequisite condition to ensure bonuses are only granted when the state is actually controlled by a specific country, aligning with realistic battlefield logic.[set_state_category](/wiki/effect/set_state_category): Use in conjunction to handle state upgrade events—first change the state category/size, then stack corresponding production modifiers to achieve a complete "development" workflow.add_state_modifier must execute under the STATE scope. If called directly within a COUNTRY scope without entering state scope via every_neighbor_state or similar, the script silently fails without error reporting—a common oversight for newcomers.remove_state_modifier. Once added, it cannot be reverted through script. If reversible state modifiers are needed, use [add_dynamic_modifier](/wiki/effect/add_dynamic_modifier) paired with [remove_dynamic_modifier](/wiki/effect/remove_dynamic_modifier) instead to implement complete lifecycle management.