Hands-On Usage
modify_timed_idea is commonly used in events or decisions to dynamically adjust the remaining duration of a timed national focus or idea. For example, extending a buff's duration after completing a focus, or using negative values to penalize and accelerate removal of a temporary bonus. Typical scenarios include: after a player triggers a diplomatic event, granting the nation an additional extension of several days to an ongoing war mobilization order as a reward.
country_event = {
id = my_mod.10
option = {
name = my_mod.10.a
# When the player chooses "accept aid", extend war mobilization by 30 days
modify_timed_idea = {
idea = war_mobilization_bonus
days = 30
}
}
option = {
name = my_mod.10.b
# When the player chooses "reject", internal pressure shortens the remaining time of the idea
modify_timed_idea = {
idea = war_mobilization_bonus
days = -15
}
}
}
Synergy
[add_timed_idea](/wiki/effect/add_timed_idea): Typically used first to add a timed idea to a country; only then does it make sense to call modify_timed_idea to extend or shorten it.
[has_country_flag](/wiki/trigger/has_country_flag): Before executing a duration modification, first check via country flag whether the logic has already been triggered, preventing the same idea from being extended repeatedly.
[has_dynamic_modifier](/wiki/trigger/has_dynamic_modifier): If a timed idea comes with a dynamic modifier, you can first confirm the dynamic modifier exists before adjusting the duration, ensuring logical consistency.
[add_days_remove](/wiki/effect/add_days_remove): Similar in function, but applies to dynamic modifiers rather than ideas. Both are often used together in the same effect block to manage the remaining duration of ideas and modifiers respectively.
Common Pitfalls
- Forgetting that the idea must be a timed idea:
modify_timed_idea only works on ideas added via add_timed_idea or defined with a time limit in the ideas section. Using this command on regular permanent ideas will not cause an error but will have no effect, making bugs difficult to trace.
- At least one of days/months/years must be specified: At least one of the three parameters must be present; if all are omitted, the script will either error or fail silently. Also note that these fields accept variable names, but variables must be assigned beforehand. Otherwise the calculated result will be 0 rather than an error, creating subtle logical problems.