Hands-On Usage
Commonly used to check whether a country has at least one unit leader meeting specific conditions — for example, inside an available or trigger block of a decision or event, to verify whether a commander with a high skill rating or a particular trait exists, thereby unlocking scripted content or firing special events.
# Example: the decision is only available if Germany has at least one corps commander
# who possesses the "panzer_leader" trait and has skill >= 4
available = {
GER = {
any_unit_leader = {
is_corps_commander = yes
has_trait = panzer_leader
skill >= 4
}
}
}
Synergy
- has_trait — The most common inner condition; filters for leaders that hold a specific trait. Paired with
any_unit_leader, it lets you pinpoint an exact target character.
- is_field_marshal — Used inside the inner scope to distinguish field marshals from corps commanders, preventing the check from casting too wide a net.
- skill — Sets a threshold on a leader's overall skill or sub-skill value; frequently used alongside trait checks.
- has_unit_leader_flag — Checks whether a custom flag has already been set on a leader, preventing the same event chain from triggering more than once.
Common Pitfalls
- Wrong scope:
any_unit_leader can only be called from a COUNTRY scope. If you are already inside a character scope (e.g., inside the body of an every_unit_leader loop) and try to nest any_unit_leader, you must first return to a country scope via ROOT, PREV, or a similar keyword — otherwise the scope mismatch will cause it to silently return false.
- Using it as an effect:
any_unit_leader is a trigger and cannot produce any effects. If you want to perform an operation on every leader that meets certain conditions, use the effect-side every_unit_leader instead (with a limit = { ... } block for inner filtering).