effect · add_random_trait
Definition
- Supported scope:
CHARACTER - Supported target:
none
Description
add random trait from specified list to unit leader. add_random_trait = { old_guard brilliant_strategist inflexible_strategist }
add_random_traitCHARACTERnoneadd random trait from specified list to unit leader. add_random_trait = { old_guard brilliant_strategist inflexible_strategist }
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_random_trait is commonly used in character progression systems or historical events to assign random traits to generals, adding unpredictability and replayability. For example, in a "promote general" event, you can randomly select one trait from multiple candidates instead of having the same outcome every game.
# In an option block within a general promotion event
character_event = {
id = my_mod.10
option = {
name = my_mod.10.a
# Current scope is already CHARACTER
add_random_trait = {
old_guard
brilliant_strategist
inflexible_strategist
}
}
}
[has_trait](/wiki/trigger/has_trait) — Check whether the character already has a trait before adding a random one to avoid duplicate or conflicting traits.[add_skill_level](/wiki/effect/add_skill_level) — Random traits often trigger alongside skill increases to simulate a general's overall development.[add_trait](/wiki/effect/add_trait) — Use as a complement when you need to assign a specific trait deterministically (rather than randomly); combining both enables a "guaranteed + random" logic pattern.[can_select_trait](/wiki/trigger/can_select_trait) — Verify that the target character meets the conditions for selecting the trait before execution to prevent errors or silent failures due to trait conflicts.common/unit_leader related files.any_character or a specific character reference before calling this command in country-level events.