Hands-On Usage
swap_ideas is commonly used in focus trees, decisions, or events to replace timed ideas—for example, upgrading "War Mobilization (Basic)" to "War Mobilization (Advanced)" while smoothly carrying over the remaining duration and avoiding the flickering effect of an idea briefly disappearing. Using add_days allows you to extend or reduce the new idea's duration on top of the old idea's remaining time, making it ideal for handling temporary bonuses that need to "inherit progress."
# Replace a temporary basic war mobilization with the advanced version and extend it by an additional 30 days
country_event = {
id = my_mod.5
option = {
name = my_mod.5.a
swap_ideas = {
remove_idea = basic_war_mobilization
add_idea = advanced_war_mobilization
add_days = 30
}
}
}
Synergy
[has_country_flag](/wiki/trigger/has_country_flag): Check country flags before executing the swap to ensure only branches meeting specific story conditions trigger the idea upgrade, preventing logic conflicts.
[add_timed_idea](/wiki/effect/add_timed_idea): Use alongside swap_ideas when adding a completely new timed idea (rather than replacing an existing one), together forming a comprehensive temporary buff management system.
[has_allowed_idea_with_traits](/wiki/trigger/has_allowed_idea_with_traits): Pre-validate in the trigger block whether the target idea meets the loading conditions, avoiding script errors caused by the idea not existing.
[add_days_remove](/wiki/effect/add_days_remove): If you need to dynamically adjust the remaining duration of the new idea after the swap, append this command after swap_ideas for fine-tuning.
Common Pitfalls
- Forgetting that the old idea must actually exist on the country: If the idea specified in
remove_idea is not currently active, the script will not throw a hard error but the swap will silently fail, and the new idea in add_idea will not be added either—always guard with conditions like [has_allowed_idea_with_traits](/wiki/trigger/has_allowed_idea_with_traits) or has_country_flag in the outer scope.
- Confusing the semantics of
add_days and days: add_days stacks on top of the old idea's remaining duration, while days overwrites the new idea's duration; if you're unsure how much time the old idea has left and misuse add_days, the new idea's validity period may far exceed expectations or expire immediately.