Wiki

trigger · career_profile_check_playthrough_ratio

Definition

  • Supported scope:any
  • Supported target:any

Description

Compares the ratio (first/second) of two playthrough values to a number

实战 · 配合 · 坑

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

实战用法

此 trigger 常用于生涯模式 mod 中,根据玩家两项游戏记录数据的比值来解锁成就、勋章或特殊事件,例如检查"胜利场次/总场次"来判断玩家的胜率是否达标。它特别适合设计"精英指挥官"类条件——不仅要求绝对数量,还要求质量比例。

# 检查玩家海战胜利场次与总海战场次之比是否 >= 0.75(即胜率 ≥ 75%)
career_profile_check_playthrough_ratio = {
    first = naval_battles_won
    second = naval_battles_total
    value > 0.75
}

配合关系

  • [career_profile_check_playthrough_value](/wiki/trigger/career_profile_check_playthrough_value) — 先用绝对值 trigger 确保分母(如总场次)不为零,再用比值 trigger 进行比率判断,避免除零逻辑问题。
  • [career_profile_check_points](/wiki/trigger/career_profile_check_points) — 常与积分检查并列使用,构成"既要达到一定积分,又要保持高胜率"的复合解锁条件。
  • [career_profile_check_medal](/wiki/trigger/career_profile_check_medal) — 比率检查通过后通常紧接勋章检查,共同作为授予高级奖励的前置门槛。
  • [and](/wiki/trigger/and) — 将比率条件与其他生涯条件组合成完整的多重判断块,是所有复合条件的必要包装器。

常见坑

  1. 未保证分母非零second 对应的 playthrough 值若为 0,比值计算会出现除以零的异常行为,务必在外层用 career_profile_check_playthrough_value 先确认 second 对应字段 > 0 再进行比率检查。
  2. 比较运算符写法错误value 后的比较符(如 ><>=)必须与 value 写在同一赋值行(value > 0.75),不能将其拆写为独立字段,否则脚本解析器会报错或静默忽略整个 trigger。

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

This trigger is commonly used in career mode mods to unlock achievements, medals, or special events based on the ratio of two player gameplay statistics, such as checking "victories/total matches" to determine whether the player's win rate meets the threshold. It is particularly suited for designing "elite commander" type conditions—requiring not just absolute numbers, but also quality proportions.

# Check if the player's naval battle win ratio (naval_battles_won / naval_battles_total) is >= 0.75 (i.e., win rate ≥ 75%)
career_profile_check_playthrough_ratio = {
    first = naval_battles_won
    second = naval_battles_total
    value > 0.75
}

Synergy

  • [career_profile_check_playthrough_value](/wiki/trigger/career_profile_check_playthrough_value) — Use the absolute value trigger first to ensure the denominator (such as total matches) is not zero, then apply the ratio trigger for proportion checking, avoiding division-by-zero logic errors.
  • [career_profile_check_points](/wiki/trigger/career_profile_check_points) — Often used in parallel with points checks to form compound unlock conditions like "must reach a certain score AND maintain a high win rate."
  • [career_profile_check_medal](/wiki/trigger/career_profile_check_medal) — Medal checks typically follow immediately after ratio validation passes, serving together as a prerequisite threshold for granting high-tier rewards.
  • [and](/wiki/trigger/and) — Combines ratio conditions with other career conditions into a complete multi-check block; a necessary wrapper for all compound conditions.

Common Pitfalls

  1. Failing to guarantee non-zero denominator: If the playthrough value corresponding to second is 0, the ratio calculation will exhibit division-by-zero anomalies. Always use career_profile_check_playthrough_value at the outer level to first confirm that the second field is > 0 before performing ratio checks.
  2. Incorrect comparison operator syntax: The comparison operator following value (such as >, <, >=) must be written on the same assignment line as value (e.g., value > 0.75); it cannot be split into a separate field, otherwise the script parser will error or silently ignore the entire trigger.