Wiki

effect · add_scientist_trait

Definition

  • Supported scope:CHARACTER
  • Supported target:none

Description

Add a trait to a scientist character in scope.
	ex: my_character = {
	  add_scientist_trait = my_trait_token
	}

Hands-On Notes

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.

Hands-On Usage

add_scientist_trait is commonly used in mods to assign exclusive traits to custom scientist characters during initialization, or to dynamically unlock new traits after specific events trigger (for example, rewarding a scientist with a "breakthrough discovery" trait upon completing a research project). Note that this command must be called within CHARACTER scope, typically used together with hidden_effect blocks in national events or focus completion rewards.

# After a focus completes, add a trait to the designated scientist character
focus = {
    id = my_focus_boost_scientist
    ...
    completion_reward = {
        my_scientist_character = {
            add_scientist_trait = my_breakthrough_trait
        }
    }
}

Synergy

  • [add_scientist_role](/wiki/effect/add_scientist_role): Before assigning a trait, ensure the character already holds a scientist position, otherwise the trait may fail to take effect or be meaningless.
  • [add_scientist_level](/wiki/effect/add_scientist_level): Commonly used in tandem with trait addition to simultaneously raise the scientist's level, reflecting the completeness of the growth reward.
  • [has_trait](/wiki/trigger/has_trait): Check in condition blocks whether the character already possesses a certain trait, avoiding duplicate additions of the same trait that cause logic errors.
  • [is_active_scientist](/wiki/trigger/is_active_scientist): Use before adding a trait to verify whether the character is currently in an active scientist status, ensuring the operation target is valid.

Common Pitfalls

  1. Scope Error: Calling add_scientist_trait directly in COUNTRY scope without first entering CHARACTER scope through a character variable will result in script errors or silent failures—be sure to switch to the character's own scope using the my_character = { ... } form before executing.
  2. Trait Token Not Registered: The trait token you specify must already be declared in the scientist_traits related definition files. Typing an undefined string will not produce an error message but will have no effect whatsoever, easily overlooked during debugging.