Hands-On Usage
has_character_flag is commonly used to track whether a character has triggered a specific event or completed a certain process, such as restricting a particular general to receive a special training bonus only once, or determining whether a character has progressed to the next stage in a quest chain. Combined with the days parameter, it can also implement "cooldown" logic—for example, requiring a certain number of days to pass before a buff can be applied again after its last use.
# Ensure a general has never received the special training bonus, and more than 180 days have passed since the last grant
limit = {
NOT = {
has_character_flag = {
flag = received_special_training
days > 180
}
}
}
Synergy
[set_character_flag](/wiki/effect/set_character_flag): The most direct partner—use this effect to set the flag first, then use has_character_flag to check if it exists, forming a complete "write → read" cycle.
[clr_character_flag](/wiki/effect/clr_character_flag): When conditions are met and the process ends, clear the flag. Combined with has_character_flag, this enables resettable state machine logic.
[modify_character_flag](/wiki/effect/modify_character_flag): Used to increment the numeric value of a flag. When combined with the value < parameter in has_character_flag, it enables counter-based multi-stage checks.
[has_unit_leader_flag](/wiki/trigger/has_unit_leader_flag): Functionally nearly identical but operates on unit commander flags. When uncertain whether a character simultaneously holds a commander position, it is often necessary to check both has_character_flag and this trigger in parallel to avoid omissions.
Common Pitfalls
- Forgetting that the
flag field is mandatory: Beginners often write has_character_flag = my_flag directly (imitating shorthand syntax), but this trigger's block syntax requires explicitly declaring flag = <name>. Without this, the parser will error or fail silently, causing the condition to never evaluate to true.
- Confusing the semantic direction of
days >: days > 30 means the flag has existed for more than 30 days, but many mistake it to mean "valid within 30 days" and reverse the logic. To express "within 30 days of flag creation," you need to wrap it with NOT.