Wiki

trigger · unit_strength

Definition

  • Supported scope:(none)
  • Supported target:THIS, ROOT, PREV, FROM, OWNER, CONTROLLER, OCCUPIED, CAPITAL

Description

Check scope unit strength status 0-1: Example unit_strength < 1

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

unit_strength is commonly used to determine whether units in a given province or state have been weakened below a specific threshold, thereby triggering events, unlocking decisions, or altering AI behavior. For example, in an invasion event chain, subsequent decisions may only be triggered when the garrison strength of occupied territory falls below a certain percentage of full strength:

available = {
    unit_strength < 0.3
}

The above example indicates that the decision is only available when the unit strength within the current scope is less than 30%.

Synergy

Since there are currently no referential effects or trigger commands in the whitelist, there are no cross-reference items to list. It is recommended to combine this with province and country scope-switching commands in actual mods to ensure the scope points to the correct detection target.

Common Pitfalls

  1. Incorrect scope targeting: unit_strength has an empty scope list (meaning it is not restricted to a specific scope type), but in actual usage you must ensure the current scope is a meaningful province or state, otherwise the condition will always return false or produce an error. Beginners often forget to use CONTROLLER/OWNER and similar target-switching commands to switch to the correct scope before making the check.
  2. Threshold value misunderstanding: The numeric range is 0 to 1 (0 represents no troops, 1 represents full strength). Beginners sometimes mistakenly enter values greater than 1 (such as unit_strength < 50), causing the condition logic to always evaluate to true or produce unintended results.