Hands-On Usage
In the progression logic of Special Projects, has_project_flag is commonly used to determine whether a specific event has been triggered or a milestone has been achieved in a certain research stage, thereby controlling whether subsequent rewards or branch conditions are unlocked. For example, in a nuclear weapons development project, you can check whether the "material purification completed" flag exists and how long it has been set, then decide whether to unlock the next stage options:
available = {
has_project_flag = {
flag = material_purification_done
days > 30
}
}
Synergy
[set_project_flag](/wiki/effect/set_project_flag): The most direct companion. First use the effect to set a flag, then use has_project_flag in other condition blocks to check whether the flag exists and its time validity.
[clr_project_flag](/wiki/effect/clr_project_flag): When you need to reset the state of a certain stage, first clear the flag. You can use has_project_flag as a protective check before clearing to avoid performing meaningless operations on non-existent flags.
[modify_project_flag](/wiki/effect/modify_project_flag): Used to modify the numeric value of a flag. Combined with the value comparison in has_project_flag, this can implement accumulative counter-style progress gating logic.
[hidden_trigger](/wiki/trigger/hidden_trigger): Wrap complex has_project_flag combination conditions in hidden_trigger to make UI tooltips cleaner and prevent players from seeing implementation details.
Common Pitfalls
- Forgetting scope restrictions:
has_project_flag can only be used under the SPECIAL_PROJECT scope. Beginners often call it directly in country or character scopes, causing script errors or conditions to always evaluate as false. Make sure the outer scope has already been switched to the correct scope through methods like any_special_project.
- Confusing the semantics of
date and days: date compares the absolute date when the flag was last modified, while days compares the number of days elapsed since now. These two are easily reversed in logic, causing conditions to trigger at unexpected times or never trigger at all.