Hands-On Usage
set_technology is most commonly used in startup scripts or events to bulk-grant technologies to nations, such as unlocking era-appropriate weapons and support technologies for a country during historical mode initialization. It is also frequently employed during civil wars, nation splits, or puppet creation to initialize the new nation's technology tree to a level comparable with its parent state, preventing AI anomalies caused by technology gaps.
# A nation acquires initial infantry technology through a focus
focus = {
id = GER_rearm
...
completion_reward = {
set_technology = {
infantry_weapons = 1
infantry_weapons1 = 1
support_weapons = 1
popup = no
}
}
}
Synergy
[add_tech_bonus](/wiki/effect/add_tech_bonus) —— Use set_technology to directly unlock foundational technologies first, then apply add_tech_bonus to grant research discounts on subsequent techs, forming a coherent incentive chain of "provide basics, reduce costs."
[add_research_slot](/wiki/effect/add_research_slot) —— In technology acceleration scenarios, pair both effects together: first supplement critical prerequisite technologies, then increase research slots so the AI/player can advance the subsequent tree faster.
[has_completed_focus](/wiki/trigger/has_completed_focus) —— In conditional checks, confirm that the required focus is completed before executing set_technology, ensuring tech unlocks trigger only at specific narrative nodes.
[create_equipment_variant](/wiki/effect/create_equipment_variant) —— Create the corresponding equipment variant immediately after unlocking a technology; otherwise, if the technology that a variant depends on does not exist, the script may error or the variant becomes invalid.
Common Pitfalls
- Typos in technology keys or missing tier levels: In HOI4's technology tree, many technologies are tiered (e.g.,
infantry_weapons, infantry_weapons1, infantry_weapons2). Writing only the parent tier without child tiers, or misspelling the key, will not produce obvious errors, but the tech tree UI will display anomalous states—the research tree shows as researched while lacking actual effects. Debugging such issues is extremely difficult.
- Calling outside COUNTRY scope:
set_technology can only execute within a country scope. If accidentally placed in a STATE or CHARACTER scope (for example, directly called within an every_owned_state loop body), the game will silently ignore it or report a scope error. Newcomers often become confused when the effect "disappears" and must use owner = { set_technology = { ... } } to return to country scope.