Hands-On Usage
random_navy_leader is commonly used to randomly grant a trait or boost the skill of one of a country's navy leaders — for example, rewarding a naval commander through an event or decision without needing to know their specific ID in advance. You can also pair it with a limit block to filter for leaders that meet specific conditions, enabling targeted random selection.
GER = {
random_navy_leader = {
limit = {
is_navy_leader = yes
skill > 2
}
add_trait = { trait = old_guard_navy }
add_skill_level = 1
}
}
Synergy
- is_navy_leader: Use inside the
limit block to ensure the selected character is actually a navy leader, preventing accidental selection of army or air force commanders.
- has_trait: Use inside the
limit block to exclude or target leaders who already possess a certain trait, avoiding duplicate additions.
- add_unit_leader_trait: Use in the effect block alongside this command to append unit leader traits to the randomly selected navy leader.
- add_skill_level: Pair with this command to directly increase the skill level of the randomly selected leader; commonly seen in reward-type events.
Common Pitfalls
- Forgetting
limit and accidentally selecting non-navy leaders: Even with random_navy_leader, if the limit conditions are too broad — or omitted entirely — the game may still pick a character who is not currently acting as a navy leader. It is strongly recommended to explicitly include is_navy_leader = yes inside limit as an extra safeguard.
- Calling this effect outside a COUNTRY scope: This effect can only be executed within a country scope. Writing it directly inside a character scope or state scope will cause a script error or silent failure. Always switch to the correct country scope first via something like
GER = { ... } before calling it.