Wiki

effect · clr_character_flag

Definition

  • Supported scope:CHARACTER
  • Supported target:none

Description

clear 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

clr_character_flag is used to clear temporary flags previously set on a character via set_character_flag. It is commonly employed in event chains for state resets, such as clearing an "ongoing task" flag after a mission completes, or cleaning up residual flags when a character dies or retires to prevent subsequent logic errors.

character_event = {
    id = my_mod.10
    ...
    option = {
        name = my_mod.10.a
        # Task completed, clear in-progress flag
        clr_character_flag = on_special_mission
    }
}

Synergy

  • [has_character_flag](/wiki/trigger/has_character_flag): Before clearing, typically use this trigger to check whether the flag exists first, avoiding meaningless clear operations when the flag is not set.
  • [set_character_flag](/wiki/effect/set_character_flag): Together with clr_character_flag, they form a complete "set/clear" lifecycle. Used in combination, they allow fine-grained control over character state machine transitions.
  • [modify_character_flag](/wiki/effect/modify_character_flag): When you need to modify a flag's value rather than completely clear it, you can combine this with clr_character_flag, selecting either to clear or modify based on different branches.

Common Pitfalls

  1. Scope Error: clr_character_flag must execute within a CHARACTER scope. If misused in a COUNTRY scope, the game will not error but the flag will not be cleared. Use = { clr_character_flag = ... } to first switch to the target character's scope.
  2. Flag Name Typos: Flag names are pure string matches. set_character_flag = my_flag and clr_character_flag = My_Flag are not the same flag. Case sensitivity or underscore differences will cause the clear to fail silently with no error message.