effect · add_defense
Definition
- Supported scope:
CHARACTER - Supported target:
none
Description
Adds defense skill to a unit leader
Example: add_defense = 1
add_defenseCHARACTERnoneAdds defense skill to a unit leader
Example: add_defense = 1
Hands-on notes are AI-generated and checked against the vanilla command vocabulary — treat them as a starting point, not authoritative reference. The definition above is the game's own documentation.
add_defense is commonly used in mods to design growth events for specific commanders, such as rewarding a leader's defense skill after a campaign victory or dynamically enhancing their attributes upon promotion to reflect accumulated battlefield experience. This command must be executed within a CHARACTER scope and is typically invoked through event options triggered by unit_leader_event.
# After a campaign victory, the commander receives a defense skill reward
unit_leader_event = {
id = my_mod.10
title = "Master of the Defense Line"
option = {
name = "Accept the Commendation"
add_defense = 2
add_trait = { trait = defense_expert }
}
}
[add_attack](/wiki/effect/add_attack): A sibling attribute command to add_defense, frequently combined within the same event option to comprehensively strengthen a leader's offensive and defensive stats.[add_trait](/wiki/effect/add_trait): Adds a trait to a leader while simultaneously boosting numerical attributes, ensuring growth is reflected both narratively and mechanically.[defense_skill_level](/wiki/trigger/defense_skill_level): Used to check a leader's current defense level before executing add_defense, preventing attribute overflow or exceeding design caps.[add_skill_level](/wiki/effect/add_skill_level): Overall skill level increases are typically paired with single-attribute boosts to balance comprehensive growth with specialized enhancements.add_defense within COUNTRY or other non-CHARACTER scopes will cause the script to fail silently. Always ensure you switch to the target character's CHARACTER scope correctly via characters = { ... } or using event from/root references.add_defense multiple times consecutively will not trigger script errors, but can produce values exceeding design intent. It is recommended to pair this with [defense_skill_level](/wiki/trigger/defense_skill_level) for conditional checks to impose limits.