Hands-On Usage
generate_character is most commonly used in historical or alternate-history mods to batch-generate shared advisor or general templates for multiple nations. For example, you can generate the same type of military advisor for a group of minor nations simultaneously, each with their own independent instance, avoiding the need to write repetitive create_corps_commander or add_advisor_role blocks. Its core advantage lies in automatically generating a unique token for each nation via token_base, naturally preventing token conflicts.
every_country = {
limit = {
OR = {
original_tag = BUL
original_tag = HUN
original_tag = ROM
}
}
generate_character = {
token_base = axis_minor_general_1
advisor = {
slot = army_chief
allowed = { original_tag = PREV }
traits = { army_chief_offensive_2 }
}
}
}
Synergy
[has_character](/wiki/trigger/has_character): Check in a limit block whether a nation already possesses the corresponding character to prevent duplicate generation of the same token.
[activate_advisor](/wiki/effect/activate_advisor): By default, a generated character only "exists" in the character pool and requires this command to immediately assume an advisor position.
[original_tag](/wiki/trigger/original_tag) (used within the limit block of every_country): Precisely filter the target nation scope and serves as the standard method for controlling batch generation boundaries.
[add_ideas](/wiki/effect/add_ideas): If a generated character is bound to an idea, you can use this command immediately after generation to grant the nation the corresponding idea effect, achieving a complete advisor activation chain.
Common Pitfalls
- Forgetting the uniqueness rule of
token_base: generate_character uses token_base as the final token. If the same token_base is triggered repeatedly in the same nation, the second generation will silently fail or be overwritten. Always protect against this with a [has_character](/wiki/trigger/has_character) check in the limit block.
- Calling directly outside nation scope: This effect must be executed under a
COUNTRY scope (typically inside every_country). If mistakenly placed in a STATE or UNIT LEADER scope, it will cause script errors or abnormal character assignment. When debugging, pay attention to checking scope hierarchy.