Hands-On Usage
set_mio_research_bonus is used to directly overwrite the base research bonus value of a Military Industrial Organization (MIO), commonly employed in mods to dynamically adjust an MIO's research capability through events or decisions—for example, granting rewards when players achieve specific objectives or resetting research bonuses under particular conditions. Note that this is an overwrite operation, not an accumulation, making it well-suited for "clearing" values previously set through other means.
# In an event option, reset the research bonus of a specified MIO to 0.2
mio:my_custom_mio = {
set_mio_research_bonus = 0.2
}
Synergy
[add_mio_research_bonus](/wiki/effect/add_mio_research_bonus): These two complement each other—set_ is used for hard-overwriting the base value, while add_ stacks an increment on top of the existing value. Typically, set_ establishes the baseline first, then add_ performs fine-grained adjustments.
[has_mio_size](/wiki/trigger/has_mio_size): Before executing an overwrite, it's common to check the MIO's current size so different research bonus values can be applied based on size tiers, avoiding one-size-fits-all approaches.
[is_mio_trait_completed](/wiki/trigger/is_mio_trait_completed): Check within condition blocks whether a certain trait has been completed, then decide whether to trigger a higher research bonus overwrite, implementing "milestone reward" logic.
[set_mio_funds](/wiki/effect/set_mio_funds): Frequently appears alongside this command in the same reward block, synchronizing adjustments to both funds and research bonuses to form a complete MIO state reset or upgrade effect.
Common Pitfalls
- Misusing negative values: The official documentation explicitly states that input values cannot be negative; attempting to pass a negative value (or a variable pointing to a negative number) will cause script errors or abnormal behavior. To "reduce" research bonuses, ensure the target value is non-negative rather than performing subtraction.
- Confusing overwrite with accumulation: Newcomers often mistake
set_mio_research_bonus for the add_ variant, assuming it can be called multiple times to accumulate effects—in reality, each call directly replaces the base value, completely overwriting the result of the previous setting. When debugging, pay special attention to the final effective value in the logs.