Hands-On Usage
upgrade_intelligence_agency is commonly used in national focuses, decisions, or events to automatically unlock specified intelligence agency upgrade modules for the player upon completion of certain intelligence research conditions, eliminating the need for manual clicking. For example, in a mod that enhances the espionage system, you can bind upgrades that originally required manual purchase to focus completion events, improving scenario immersion.
focus = {
id = GER_strengthen_intelligence
...
completion_reward = {
# Ensure the agency exists first before adding the upgrade
create_intelligence_agency = { name = "Abwehr" }
upgrade_intelligence_agency = upgrade_army_department
}
}
Synergy
[create_intelligence_agency](/wiki/effect/create_intelligence_agency): The intelligence agency must exist before upgrades can be added; these two effects are nearly always used together. If the agency has not been created when this effect is called, the command will have no effect.
[has_done_agency_upgrade](/wiki/trigger/has_done_agency_upgrade): Check whether the target upgrade has already been obtained using this trigger before adding upgrades, to avoid assigning the same upgrade multiple times and causing logic conflicts.
[agency_upgrade_number](/wiki/trigger/agency_upgrade_number): Can be used in limit blocks to restrict triggering only when the current number of upgrades reaches a certain threshold, precisely controlling the upgrade pace.
[add_ideas](/wiki/effect/add_ideas): Commonly used together with this effect to provide corresponding numerical bonuses or scenario buffs to intelligence agency upgrades through additional ideas, forming a complete intelligence enhancement reward package.
Common Pitfalls
- Calling the command before the agency is created: The most common mistake is writing
upgrade_intelligence_agency directly in an effect block without first confirming that the intelligence agency exists (either create_intelligence_agency was not called or the player never established an agency). In this case, the command will silently fail without error messages, and the upgrade will not take effect, making it extremely difficult to debug.
- Upgrade identifier misspelling: Upgrade names (such as
upgrade_army_department) come from the definition file of intelligence_agency_upgrades. If you define a new upgrade in your mod but misspell the key, the game will similarly ignore it silently. Be sure to cross-check against the definition file character by character.