Wiki

trigger · career_profile_check_ratio

Definition

  • Supported scope:any
  • Supported target:any

Description

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

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_check_ratio is ideal for career mode-related mods to dynamically unlock rewards, medals, or special events based on the ratio of two career statistics, such as determining whether "number of victories / total campaigns" meets a certain threshold. It is commonly used to check player performance ratios before deciding whether to trigger specific story branches.

Check whether the ratio of two career values meets the threshold

trigger = { career_profile_check_ratio = { first = career_wins second = career_total_battles ratio > 0.75 } }

Synergy

  • [career_profile_check_value](/wiki/trigger/career_profile_check_value) — Checks the absolute value of a single career statistic; commonly used alongside ratio checks to ensure safer conditional logic by verifying the denominator (second value) is non-zero before performing ratio calculations.
  • [career_profile_check_points](/wiki/trigger/career_profile_check_points) — Checks total career points; typically combined with ratio conditions within an and block to create a composite threshold of "points qualified AND performance ratio qualified."
  • [career_profile_check_medal](/wiki/trigger/career_profile_check_medal) — After passing the ratio check, this is often used immediately after to verify whether the corresponding medal has already been awarded, preventing duplicate reward grants.
  • [and](/wiki/trigger/and) / [or](/wiki/trigger/or) — Combines ratio checks with other career conditions into compound logic; the standard approach for wrapping multiple career_profile_check_* series triggers.

Common Pitfalls

  1. Division by zero errors from null denominator: If the career value corresponding to second could be 0 in certain save files (e.g., the player has never fought a campaign), using this trigger directly may cause script errors or unexpected results. Always use career_profile_check_value to confirm the second value is greater than 0 before performing the ratio check.
  2. Incorrect comparison operator syntax: Comparison operators (>, <, >=, etc.) in HOI4 scripts are easily confused with field assignment syntax; beginners sometimes mistakenly write ratio = 0.75 instead of ratio > 0.75, causing the condition to never be satisfied or only when values match exactly.