Wiki

trigger · ai_irrationality

Definition

  • Supported scope:COUNTRY
  • Supported target:none

Description

check the ai irrationality value

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

ai_irrationality is commonly used for AI behavior debugging and special event trigger scenarios. For example, unlocking special decisions or triggering random events when an AI's irrationality value exceeds a certain threshold, or assessing a given AI nation's current decision-making "chaos level" to provide intelligence feedback to the player. A typical use case is filtering out nations with low rationality values in AI-exclusive limit blocks to prevent them from triggering focus chains that require stable logic.

# Only trigger certain events when AI irrationality meets the condition
country_event = {
    trigger = {
        is_ai = yes
        ai_irrationality > 10
    }
    ...
}

# Use as a threshold in the available block of a decision
available = {
    ai_irrationality < 5
}

Synergy

  • [has_country_flag](/wiki/trigger/has_country_flag): Use country flags to record whether a particular irrational behavior has already been triggered, then combine with ai_irrationality as a double threshold to prevent repeated execution.
  • [is_ai](/wiki/trigger/is_ai): Ensure the target nation exists before checking irrationality values, preventing errors against dead nations.
  • [add_ai_strategy](/wiki/effect/add_ai_strategy): When irrationality exceeds limits, add AI strategies to "correct" behavioral tendencies, forming a complete "detect→correct" logic loop.
  • [has_country_flag](/wiki/trigger/has_country_flag) + [clr_country_flag](/wiki/effect/clr_country_flag): Combine flag clearing and checking to precisely control the trigger window for irrationality values, avoiding multiple responses within the same time period.

Common Pitfalls

  1. Forgetting to scope to AI nations: ai_irrationality only makes sense for AI-controlled nations. If used within a player-controlled nation scope, its value is typically 0 or meaningless. You must combine it with logic to ensure it's only called within AI nation scopes, otherwise conditions will never trigger as expected.
  2. Misusing comparison operators: Beginners often omit the comparison operator and write ai_irrationality = 5 directly, but this trigger requires using > / < / >= and other numerical comparison forms. Using equals signs typically fails to match correctly, silently breaking the condition block.