Wiki

trigger · career_profile_has_player_flag

Definition

  • Supported scope:any
  • Supported target:any

Description

Checks if the flag is set for the local player

实战 · 配合 · 坑

实战内容由 AI 生成,并已对照 vanilla 命令词表校验 —— 请当作起点而非权威依据。上方的定义节才是游戏自带文档原文。

实战用法

career_profile_has_player_flag 常用于职业生涯 mod 中,根据玩家在历次游戏中积累的个人旗标来解锁特殊选项或成就条件——例如检测玩家是否曾完成过某个特定剧情分支并设置了纪念旗标,再据此开放隐藏内容。它适合放在 focus/decision 的 availableallowed 块中做前置门槛判断。

# 在某个国策的 available 块中:判断玩家是否在历史存档中设置过该旗标
available = {
    career_profile_has_player_flag = my_mod_completed_special_branch
}

配合关系

  • [career_profile_check_value](/wiki/trigger/career_profile_check_value):两者同属职业生涯系统的 trigger 族,常并列使用,先用旗标检查确认玩家走过特定路径,再用数值检查验证积分门槛,形成复合前置条件。
  • [career_profile_check_ribbon](/wiki/trigger/career_profile_check_ribbon):勋带检查与旗标检查组合,可实现"既拿到某勋带、又触发过某剧情"的双重解锁逻辑。
  • [custom_trigger_tooltip](/wiki/trigger/custom_trigger_tooltip):将该 trigger 包裹其中,可以为玩家显示友好的本地化提示文本,避免原始旗标名称直接暴露在 UI 上。
  • [or](/wiki/trigger/or):当多个不同存档旗标都可满足同一解锁条件时,用 or 将多个 career_profile_has_player_flag 归组,提升容错性。

常见坑

  1. 旗标名拼写与设置时不一致:该 trigger 检查的旗标必须与写入时完全一致(区分大小写),新手常在不同文件中用不同写法(如 MyFlag vs my_flag),导致永远返回假而难以排查。
  2. 误用为国家旗标替代品career_profile_has_player_flag 针对的是跨存档的职业生涯本地玩家档案,而非当前游戏会话内的国家旗标;若只需检查本局内的临时状态,应改用普通的国家 flag 机制,混用会导致逻辑在单人/多人或 ironman 环境下行为不一致。

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

career_profile_has_player_flag is commonly used in career profile mods to unlock special options or achievement conditions based on personal flags accumulated by the player across multiple playthroughs—for example, detecting whether the player has completed a specific story branch and set a commemorative flag, then unlocking hidden content accordingly. It works well placed in the available or allowed blocks of focuses or decisions as a prerequisite threshold check.

# In the available block of a focus: check if the player has set the flag in historical saves
available = {
    career_profile_has_player_flag = my_mod_completed_special_branch
}

Synergy

  • [career_profile_check_value](/wiki/trigger/career_profile_check_value): Both belong to the career profile system's trigger family and are commonly used together. First use flag checking to confirm the player followed a specific path, then use value checking to verify score thresholds, forming composite prerequisite conditions.
  • [career_profile_check_ribbon](/wiki/trigger/career_profile_check_ribbon): Combining ribbon checks with flag checks enables dual-unlock logic such as "obtained a specific ribbon AND triggered a specific story event."
  • [custom_trigger_tooltip](/wiki/trigger/custom_trigger_tooltip): Wrapping this trigger within it displays player-friendly localized tooltip text, avoiding direct exposure of raw flag names on the UI.
  • [or](/wiki/trigger/or): When multiple different save flags can satisfy the same unlock condition, use or to group multiple career_profile_has_player_flag instances, improving fault tolerance.

Common Pitfalls

  1. Flag name spelling inconsistency between check and assignment: The flag checked by this trigger must match exactly with how it was written (case-sensitive). Beginners often use different spellings across different files (e.g., MyFlag vs my_flag), causing the trigger to always return false and making bugs hard to trace.
  2. Mistaking it for a country flag substitute: career_profile_has_player_flag targets cross-save career profile data for the local player, not country flags within the current game session. If you only need to check temporary state within a single session, use the standard country flag mechanism instead. Mixing them causes inconsistent behavior across single-player, multiplayer, or ironman environments.