Wiki

trigger · difficulty

Definition

  • Supported scope:any
  • Supported target:none

Description

check if the difficulty is above or below specified value 0-2 (difficulty enum). Example: difficulty > 0 (above easy)

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

difficulty is commonly used to automatically adjust mod balance based on the player's current difficulty level, such as granting AI bonuses at higher difficulties or unlocking helpful tooltips at lower difficulties. It can also be used in achievement/career systems to restrict specific rewards so they only trigger at higher difficulty levels.

# Only allow AI to access a certain special decision at Normal difficulty and above
available = {
    difficulty > 0
}

Synergy

  • [is_ironman](/wiki/trigger/is_ironman): Ironman mode and high difficulty often appear together; combining them allows precise control over content that only unlocks in "hardcore" playstyles.
  • [has_game_rule](/wiki/trigger/has_game_rule): Custom game rules can be combined with difficulty to form compound conditions, providing fine-grained control over behavior across different difficulty + rule combinations.
  • [is_historical_focus_on](/wiki/trigger/is_historical_focus_on): Using historical mode together with difficulty levels lets you distinguish specific playstyle scenarios such as "historical + hard".
  • [custom_effect_tooltip](/wiki/effect/custom_effect_tooltip): When difficulty is used in hidden logic, pair it with this effect to display difficulty-related explanatory text to players, improving mod readability.

Common Pitfalls

  1. Confusion over enumeration boundaries: Beginners often misread difficulty > 1 as "greater than normal"; you should carefully cross-reference with the official documentation's 0-2 enumeration meanings. Using the wrong comparison operator (e.g., = instead of > or <) will cause the condition to never match.
  2. Mistakenly thinking scope switching is needed under country/state scope: This trigger supports any scope and does not require—nor should you—switch to a specific scope before calling it. Unnecessary scope nesting is not only pointless but may also trigger parsing warnings.