Hands-On Usage
num_faction_members is commonly used to assess the size of a faction that a country belongs to. For example, in the available block of a national focus or decision, it can restrict diplomatic actions to only execute when "the faction has at least N members," or in a trigger block to detect whether the faction has grown large enough to launch a war. Note that this trigger requires the current country to be a member of a faction itself; otherwise it returns false rather than 0.
# Focus available: unlock this focus only when faction members exceed 3 countries
focus = {
id = GER_grand_offensive
available = {
is_faction_leader = yes
num_faction_members > 3
}
...
}
Synergy
[has_completed_focus](/wiki/trigger/has_completed_focus): Typically use focus completion status to determine diplomatic direction first, then use num_faction_members to confirm faction size; combining these conditions controls the unlock timing of subsequent options.
[alliance_strength_ratio](/wiki/trigger/alliance_strength_ratio): More faction members does not equal greater strength. Using both together allows filtering dual conditions of "sufficient members AND adequate combined military power," making triggers more robust.
[add_to_faction](/wiki/effect/add_to_faction): When num_faction_members falls below the threshold, invoke this command in the effect block to recruit new members, logically forming a complete "check → supplement → check again" loop.
[create_wargoal](/wiki/effect/create_wargoal): The typical pattern is to first use num_faction_members > X to ensure the faction is large enough, then generate war goals, preventing hasty declarations of war with a weak faction.
Common Pitfalls
- Silent failure when used outside a faction: If the current country does not belong to any faction, the trigger directly returns false. The script will not error, but the logic will never fire—newcomers often mistakenly believe it returns 0 for comparison. Add
is_in_faction = yes as a guard condition beforehand within the same block.
- Using assignment operator instead of comparison operator: In HOI4 scripting, numerical comparisons must use
num_faction_members > 5 or num_faction_members < 5; == is not supported. Omitting the operator or writing = 5 will cause the game to throw a parse error or produce unexpected behavior.