Hands-On Usage
has_custom_difficulty_setting is primarily used in mods that implement custom difficulty systems, dynamically adjusting event triggers, focus tree unlocks, or production bonuses based on the difficulty options selected by the player at game start. For example, an Axis industrial enhancement mod can use this trigger to detect whether the player has enabled the corresponding difficulty option, then decide whether to trigger additional factory construction events.
# In the trigger block of an event, detect whether the player has enabled the Axis industrial enhancement difficulty option
trigger = {
has_custom_difficulty_setting = TheAxisIndustry
}
Synergy
[has_any_custom_difficulty_setting](/wiki/trigger/has_any_custom_difficulty_setting): When you need to check "whether any single custom difficulty is enabled", pair it with this trigger to create complementary strict and lenient validation logic.
[has_game_rule](/wiki/trigger/has_game_rule): Custom difficulty systems typically coexist with the game rules system; both are commonly combined within AND/OR blocks to jointly filter the current session's configuration combination.
[difficulty](/wiki/trigger/difficulty): Vanilla difficulty levels and custom difficulty options often need to be validated simultaneously to ensure mod logic responds correctly across different difficulty configurations.
[if](/wiki/effect/if): Within effect blocks, pair with if conditional branches to decide whether to execute a segment of effect code based on the return value of this trigger.
Common Pitfalls
- Option name case sensitivity: The parameter value of
has_custom_difficulty_setting must match exactly (including case) the option name declared in the custom_difficulty definition file. A single misspelled character will silently return false, and the game will not report an error, making it extremely difficult to debug.
- Scope misunderstanding: Although this trigger supports
any scope, it checks global game settings rather than the state of a specific country or state; therefore it should not be nested within a specific country scope, otherwise it easily causes confusion with other scope-related triggers, leading to the mistaken belief that the result is tied to the current scope.