Hands-On Usage
set_keyed_oob is primarily used in scenarios where a country needs multiple distinct Order of Battle files registered in history files for different purposes. For example, when both army and naval OOBs exist simultaneously, different key values distinguish them and prevent overwriting. In mods, this is commonly seen when rewriting a vanilla nation's initial unit composition or providing alternative starting force configurations for specific historical branches.
# In history/countries/ENG - Britain.txt or corresponding on_actions initialization block
set_keyed_oob = {
key = army
name = "ENG_1936_Army"
}
set_keyed_oob = {
key = naval
name = "ENG_1936_Naval"
}
Synergy
[has_country_flag](/wiki/trigger/has_country_flag): Check specific country flags in conditional branches to determine whether to register a particular OOB file for that nation, enabling different force configurations to load based on player choices or scenario branches.
[clr_country_flag](/wiki/effect/clr_country_flag): Clear temporary flags after OOB registration to prevent the same initialization logic from triggering repeatedly.
[division_template](/wiki/effect/division_template): Division templates referenced by OOB files must be predefined using this command; together they form the complete initial force establishment workflow.
[delete_unit](/wiki/effect/delete_unit): If you need to dynamically remove specific units after OOB loading, use this in combination for fine-grained control over initial forces.
Common Pitfalls
- Identical
key values cause overwriting, not stacking: When the same key value is used twice for a single nation, the later-registered OOB file replaces the earlier one rather than merging with it. To retain multiple OOBs simultaneously, each must use a unique key; newcomers often mistakenly believe identical keys will accumulate units.
- Effects may not work outside history file context: This command is officially marked as "should only be used in history files." Placing it in a regular event or focus
immediate block results in undefined behavior and likely silent failure—no error message, but the OOB won't load as expected.