Wiki

effect · set_character_flag

Definition

  • Supported scope:CHARACTER
  • Supported target:none

Description

set character flag

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

set_character_flag is commonly used to record a specific state or event progress for a character—for instance, marking that a general has participated in a particular battle, completed a quest node, or achieved a milestone. Subsequent events or decisions can then check this flag to determine whether to trigger. A typical scenario is setting flags in the immediate block of character-related events to prevent the same event from firing repeatedly.

# Mark "accepted secret mission" on a character event
character_event = {
    id = my_mod.1
    immediate = {
        set_character_flag = accepted_secret_mission
    }
    option = {
        name = my_mod.1.a
        # Subsequent effects...
    }
}

Synergy

  • [has_character_flag](/wiki/trigger/has_character_flag) — Once a flag is set, this trigger is typically used to check whether that flag exists, thereby controlling the firing conditions of subsequent events or decisions.
  • [clr_character_flag](/wiki/effect/clr_character_flag) — The counterpart to set_character_flag, used to clear flags that are no longer needed after a character's state changes, preventing stale data from accumulating.
  • [modify_character_flag](/wiki/effect/modify_character_flag) — When you need to perform numeric increments or modifications on a flag (rather than simple on/off toggles), use this alongside set_character_flag to manage numeric-type character state flags.
  • [operative_leader_event](/wiki/effect/operative_leader_event) — Frequently paired in operative task events: first set a flag via an event trigger, then drive subsequent intelligence chain narratives through that flag.

Common Pitfalls

  1. Scope Mismatchset_character_flag must execute within a CHARACTER scope. Beginners often call it directly in a country scope (such as within an option in country_event), causing script errors or flags being set on the wrong target. Use every_character or specific_character to properly switch to the correct character scope first.
  2. Flag Name Collisions — Flag names are global strings; if different mods or event chains use the same flag name (e.g., done, flag_1), it can cause state confusion across characters or events. Adopt a naming convention with a mod prefix (e.g., mymod_character_accepted_mission) to avoid conflicts.