触发器:修订间差异

本页面所适用的版本可能已经过时,最后更新于1.7
(1.1 更新至12:48, 27 October 2020)
Qi讨论 | 贡献
无编辑摘要
 
(未显示4个用户的8个中间版本)
第1行: 第1行:
{{Version|1.1}}{{需要翻译}}
{{Version|1.7}}
Triggers are used in the game to check conditions.
[[File:Trigger runner.png|alt=a screenshot of the in-game tool to check triggers showing multiple triggers being false or true|thumb|trigger runner]]
==Triggers==
===Scripted Triggers===
===Trigger Localization===


==Custom Triggers==
A trigger is a check that returns '''true''' or '''false''' for the scope where it's used.
===Creating Custom Triggers===


==List of triggers==
For example, <code>is_ai = yes</code> would return '''true''' for an AI character, and '''false''' for a player.
Note that this list has been generated programmatically.
 
{| class="wikitable sortable" width="100%"
This could be used to disable an event for a player, by using it in a trigger block of an event.
   ! width="15%" | Name
 
   ! width="15%" | Description
Triggers that compare values can also return the value itself.
   ! width="40%" | Usage
 
   ! width="10%" | Traits
For example, <code>add_gold = gold</code> would add the same amount of gold that the character currently has.
   ! width="10%" | Supported Scopes
 
   ! width="10%" | Supported Targets
The full list of available code triggers can be found in [[Triggers_list|triggers.log]].
|-
 
|any_dynasty_member
Run <code>script_docs</code> console command in the game and find the log in Documents\Paradox Interactive\Crusader Kings III\logs.
|Iterate through all dynasty members
 
|any_dynasty_member = { <count=num/all> / <percent=fixed_point> <triggers> }
== Trigger blocks ==
|
 
|dynasty
Triggers are used in trigger script blocks.
|character
 
|-
Those usually are either explicitly named so, like an event's <code>trigger = { }</code> block, or their name are questions which can be answered by yes or no, like a decision's <code>is_shown = { }</code> and <code>is_valid = { }</code>.
|blood_legacy_track_perks
 
|How many legacies in the Blood legacy track does this dynasty have?
In some cases, triggers are used in hybrid script blocks that accept triggers amongst other things.
|
 
|<, <=, =, !=, >, >=
Ex: [[weight modifier]]
|dynasty
<pre>modifier = {
|
  is_ai = yes
|-
  factor = 0
|dynasty_can_unlock_relevant_perk
}</pre>
|Can the scoped dynasty unlock a 'relevant' legacy? Relevant meaning one that isn't the first in its track unless the dynasty has no partially filled tracks
In this block, <code>is_ai = no</code> is a trigger, but <code>factor = 0</code> is an operator.
|
 
|yes/no
=== Early out ===
|dynasty
 
|
Unless they are being tooltipped, trigger blocks operate on the so-called "early out" principle.
|-
 
|dynasty_prestige
For a trigger block to be true, all triggers within must be true. "early out" means that as soon as a trigger in the block is evaluated as false, the rest of the triggers in that block are not evaluated.
|Does the dynasty have the required prestige?
 
|
This is useful to avoid errors.
|<, <=, =, !=, >, >=
 
|dynasty
Ex: the following trigger block checks that the current character scope's primary spouse has the same culture as them. To avoid errors, it first checks that the character `has` a spouse to begin with.
|
<pre>trigger = {
|-
  exists = primary_spouse
|dynasty_prestige_level
  culture = primary_spouse.culture
|Does the dynasty have the required level of splendor?
}</pre>
|
If <code>exists = primary_spouse</code> is false, the second trigger is not evaluated.
|<, <=, =, !=, >, >=
 
|dynasty
It is also useful for performance optimization. In a trigger block containing multiple triggers, putting the ones most likely to fail first can significantly reduce the number of triggers checked overall.
|
 
|-
Ex: this trigger block checks that the current character scope is a player and an independent ruler.
|erudition_legacy_track_perks
<pre>trigger = {
|How many legacies in the Erudition legacy track does this dynasty have?
  is_ai = no
|
  is_independent_ruler = yes
|<, <=, =, !=, >, >=
}</pre>
|dynasty
If this trigger block is evaluated once a year for each character in the game, since most characters in the game are not players, <code>is_ai = no</code> will almost always be false, and the 2nd trigger will almost never be evaluated at all.
|
 
|-
=== Logic blocks ===
|glory_legacy_track_perks
 
|How many legacies in the Glory legacy track does this dynasty have?
Trigger blocks can contain several triggers. By default, if all of them are true, the trigger block as a whole is true, but some logic blocks can manipulate that logic.
|
 
|<, <=, =, !=, >, >=
==== AND ====
|dynasty
 
|
<pre>AND = {
|-
  is_ai = no
|guile_legacy_track_perks
  is_independent_ruler = yes
|How many legacies in the Guile legacy track does this dynasty have?
}</pre>
|
 
|<, <=, =, !=, >, >=
The <code>AND</code> block is true if the current character both is a player and an independent ruler.
|dynasty
 
|
==== OR ====
|-
 
|has_dynasty_modifier
<pre>OR = {
|Does the scoped dynasty have a given modifier?
  is_ai = no
|has_dynasty_modifier = name
  is_independent_ruler = yes
|
}</pre>
|dynasty
 
|
The <code>OR</code> block is true if the current character scope is either a player `or` an independent ruler.
|-
 
|has_dynasty_modifier_duration_remaining
==== NOT/NOR/NAND ====
|Does the scoped dynasty have the duration remaining on a given modifier?
 
|has_dynasty_modifier_duration_remaining = name
<pre>NOT = { has_title = title:k_france }</pre>
|
 
|dynasty
The <code>NOT</code> block is true if the current character scope does not hold the Kingdom of France.
|
 
|-
To avoid ambiguity, <code>NOT</code> should only contain a single trigger. For multiple triggers, using <code>NOR</code> or <code>NAND</code> makes the intent clear.
|has_dynasty_perk
 
|Does the dynasty have this legacy?
<pre>NAND = {
|has_dynasty_perk = key
  has_title = title:k_france
|
  has_title = title:k_aquitaine
|dynasty
}</pre>
|
 
|-
The <code>NAND</code> block is true if the current character scope holds either the Kingdom of France or the Kingdom of Aquitaine or neither of the two. It is false if they hold both titles.
|kin_legacy_track_perks
 
|How many legacies in the Kin legacy track does this dynasty have?
<pre>NOR = {
|
  has_title = title:k_france
|<, <=, =, !=, >, >=
  has_title = title:k_aquitaine
|dynasty
}</pre>
|
 
|-
The <code>NOR</code> block is true if the current character scope holds neither the Kingdom of France nor the Kingdom of Aquitaine. It is false if they hold either of the titles.
|law_legacy_track_perks
 
|How many legacies in the Law legacy track does this dynasty have?
=== Limit blocks ===
|
 
|<, <=, =, !=, >, >=
The <code>limit</code> block is used for conditional effects and triggers.
|dynasty
 
|
==== if/else_if ====
|-
 
|warfare_legacy_track_perks
The most common use of the <code>limit</code> block is with the <code>if</code>/<code>else_if</code> effects, to execute effects only if the <code>limit</code> block is true.
|How many legacies in the Warfare legacy track does this dynasty have?
 
|
Ex: this effect adds gold to the current character scope if they are a player.
|<, <=, =, !=, >, >=
<pre>if = {
|dynasty
  limit = { is_ai = no }
|
  add_gold = 100
|-
}</pre>
|compare_value
 
|Compare the scoped value.
==== effect list-builders ====
|var:variable_name = { compare_value < 4 }
 
|<, <=, =, !=, >, >=
Limit blocks are also commonly used to restrict effect list builders.
|value
 
|
Ex: this effect adds gold to the current character scope's children if they are male
|-
<pre>every_child = {
|any_house_member
  limit = { is_male = yes }
|Iterate through all house members
  add_gold = 100
|any_house_member = { <count=num/all> / <percent=fixed_point> <triggers> }
}</pre>
|
 
|dynasty house
Note: the <code>any_X</code> list-builder does ''not'' use a <code>limit</code> block.
|character
 
|-
==== trigger_if/trigger_else_if/trigger_else ====
|has_house_modifier
 
|Does the scoped house have a given modifier?
<code>trigger_if</code> can be used to check a trigger only if the <code>limit</code> block is true.
|has_house_modifier = name
 
|
Ex: if the current character scope is not an ai, this trigger checks whether they are an independent ruler
|dynasty house
<pre>trigger_if = {
|
  limit = { is_ai = no }
|-
  is_independent_ruler = yes
|has_house_modifier_duration_remaining
}</pre>
|Does the scoped house have the duration remaining on a given modifier?
 
|has_house_modifier_duration_remaining = name
Conditional triggers are often used in tooltipped trigger blocks both for legibility and to avoid errors, because when tooltipped, early-out does not apply.
 
Ex: this trigger, when tooltipped, would throw an error when <code>primary_spouse</code> does not exist.
<pre>trigger = {
  exists = primary_spouse
  culture = primary_spouse.culture
}</pre>
but this would not throw an error, because if the <code>limit</code> block is false, the trigger is not evaluated.
<pre>trigger_if = {
  limit = { exists = primary_spouse }
  culture = primary_spouse.culture
}</pre>
 
== Trigger syntax ==
 
=== Scope comparison ===
 
A scope comparison is a statement with two scopes on either side of an <code>=</code> sign. It is true if both objects are the same, and false otherwise.
 
Scopes in a scope comparison can be database scopes, event targets, saved scopes or variables.
 
Note: even if both scopes are not the same objects, they do need to be of the same scope type.
 
Ex: this trigger checks whether whoever holds the kingdom of France is the same character as the father of the current character scope.
<pre>title:k_france.holder = father</pre>
 
In a scope comparison, both sides need to be valid. In this example, the current character must have a father, and the Kingdom of France must be created, otherwise the scope comparison throws an error in the error log, so the existence of both scopes needs to be checked at some point before the comparison is made.
 
The existence of the scope on the left-hand side of the comparison itself by using <code>?=</code>:
<pre>title:k_france.holder ?= father</pre>


|
=== Value comparison ===
|dynasty house
|
|-
|any_faith
|Iterate through all faiths within a religion
|any_faith = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|religion
|faith
|-
|is_in_family
|Is the scoped faith in a given religious family?
|is_in_family = rf_abrahamic


|
A value comparison is a statement with two numerical values on either side of either
|religion
* an equal sign <code>=</code>
|
* a comparison symbol
|-
** strictly greater than <code>></code>
|any_scheme_agent
** greater than or equal to <code>>=</code>
|Iterate through all agents in the scheme
** lower than <code><</code>
|any_scheme_agent = { <count=num/all> / <percent=fixed_point> <triggers> }
** lower than or equal to <code><=</code>
|
It is true if the comparison is mathematically correct.
|scheme
|character
|-
|has_scheme_modifier
|Is the scheme currently affected by the specified modifier?
| has_scheme_modifier = X
|
|scheme
|
|-
|is_hostile
|Is the scoped scheme a hostile scheme?
|is_hostile = bool
|yes/no
|scheme
|
|-
|is_scheme_agent_exposed
|Is the target character an exposed agent in the scope scheme?
|
|character target
|scheme
|
|-
|is_scheme_exposed
|Is the scheme exposed?
|
|yes/no
|scheme
|
|-
|scheme_duration_days
|The number of days since the scheme was started
|
|<, <=, =, !=, >, >=
|scheme
|
|-
|scheme_is_character_agent
|Is the target character part of this scheme?
|
|character target
|scheme
|
|-
|scheme_monthly_progress
|Monthly scheme progress in % (i.e. 50 equals 50%)
|
|<, <=, =, !=, >, >=
|scheme
|
|-
|scheme_number_of_agents
|The number of agents in a scheme
|
|<, <=, =, !=, >, >=
|scheme
|
|-
|scheme_number_of_exposed_agents
|The number of exposed agents in a scheme
|
|<, <=, =, !=, >, >=
|scheme
|
|-
|scheme_power
|Scheme power
|
|<, <=, =, !=, >, >=
|scheme
|
|-
|scheme_power_resistance_difference
|Scheme power minus scheme resistance
|
|<, <=, =, !=, >, >=
|scheme
|
|-
|scheme_power_resistance_ratio
|Scheme power/resistance ratio. Set to ±10000 if resistance is zero and power is positive/negative (0 if both power and resistance are 0)
|
|<, <=, =, !=, >, >=
|scheme
|
|-
|scheme_progress
|Scheme progress (0 - 10 (defined))
|
|<, <=, =, !=, >, >=
|scheme
|
|-
|scheme_resistance
|Scheme resistance
|
|<, <=, =, !=, >, >=
|scheme
|
|-
|scheme_secrecy
|Scheme secrecy
|
|<, <=, =, !=, >, >=
|scheme
|
|-
|scheme_skill
|Is the scheme currently affected by the specified modifier?
| has_scheme_modifier = X
|
|scheme
|
|-
|scheme_success_chance
|Scheme success chance
|
|<, <=, =, !=, >, >=
|scheme
|
|-
|scheme_type
|Is the scheme of the specified type?
| scheme_type = X
|
|scheme
|
|-
|active_de_jure_drift_progress
|
|task_current_value = scope:county.active_de_jure_drift_progress
|<, <=, =, !=, >, >=
|landed title
|
|-
|any_claimant
|Iterate through all claimants to title. parameters: explicit = yes/no/all - default yes
|any_claimant = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|landed title
|character
|-
|any_connected_county
|Iterate through all counties connected to this one. Is based on top liege
|any/every/whatever_connected_county = {
max_naval_distance = 500
allow_one_county_land_gap = yes
any_connected_county = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|landed title
|landed title
|-
|any_county_province
|Iterate through all baronies in a county
|any_county_province = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|landed title
|province
|-
|any_de_jure_county_holder
|Iterate through all characters directly holding counties within this de jure title
|any_de_jure_county_holder = { <count=num/all> / <percent=fixed_point> <triggers> }


|
Numerical values in a value comparison can be:
|landed title
* a number
|character
* a named value
|-
* a [[script_value]]
|any_de_jure_top_liege
* a saved scope value
|Iterate through all top lieges of the counts within this de jure title
* a [[variable]] storing a number
|any_de_jure_top_liege = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|landed title
|character
|-
|any_dejure_vassal_title_holder
|Iterate through all the vassal holders of the title
|any_dejure_vassal_title_holder = { <count=num/all> / <percent=fixed_point> <triggers> }


|
Ex: this trigger checks whether the current character scope's gold is strictly greater than 1000.
|landed title
<pre>gold > 1000</pre>
|character
|-
|any_election_candidate
|Iterate through all characters who are valid candidates in an election for a title
|any_election_candidate = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|landed title
|character
|-
|any_elector
|Iterate through all characters who are valid electors in an election for a title
|any_elector = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|landed title
|character
|-
|any_in_de_facto_hierarchy
|Iterate through the title itself, all de facto vassals, and below. The continue trigger specifies whether to recursively iterate through the vassal's vassals
|continue is unrelated to the limit; if the limit is met it is added to the list, but its vassals will get checked even if the limit isn't met as long as the 'continue' trigger is
..._de_jure_vassal_and_below = { continue = { conditions } }
any_in_de_facto_hierarchy = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|landed title
|landed title
|-
|any_in_de_jure_hierarchy
|Iterate through the title itself, all de jure vassals, and below. The continue trigger specifies whether to recursively iterate through the vassal's vassal
|This is unrelated to the limit; if the limit is met it is added to the list, but its vassals will get checked even if the limit isn't met as long as the 'continue' trigger is
..._de_jure_vassal_and_below = { continue = { conditions } }
any_in_de_jure_hierarchy = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|landed title
|landed title
|-
|any_neighboring_county
|Iterate through all neighboring counties. Can only be used in county scope
|any_neighboring_county = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|landed title
|landed title
|-
|any_this_title_or_de_jure_above
|Iterate through this title and all its de jure liege titles
|any_this_title_or_de_jure_above = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|landed title
|landed title
|-
|any_title_heir
|Line of succession for the scoped title
|any_title_heir = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|landed title
|character
|-
|any_title_joined_faction
|Iterate through all factions joined the scope landed title
|any_title_joined_faction = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|landed title
|faction
|-
|any_title_to_title_neighboring_and_across_water_barony
|Scopes from a title to a neighboring barony (incl. across water, looking through the de jure lieges)
|any_title_to_title_neighboring_and_across_water_barony = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|landed title
|landed title
|-
|any_title_to_title_neighboring_and_across_water_county
|Scopes from a title to a neighboring county (incl. across water, looking through the de jure lieges)
|any_title_to_title_neighboring_and_across_water_county = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|landed title
|landed title
|-
|any_title_to_title_neighboring_and_across_water_duchy
|Scopes from a title to a neighboring duchy (incl. across water, looking through the de jure lieges)
|any_title_to_title_neighboring_and_across_water_duchy = { <count=num/all> / <percent=fixed_point> <triggers> }


|
=== Code triggers ===
|landed title
|landed title
|-
|any_title_to_title_neighboring_and_across_water_empire
|Scopes from a title to a neighboring empire (incl. across water, looking through the de jure lieges)
|any_title_to_title_neighboring_and_across_water_empire = { <count=num/all> / <percent=fixed_point> <triggers> }


|
Code triggers have a predetermined syntax. They usually require a specific scope type context to work.
|landed title
|landed title
|-
|any_title_to_title_neighboring_and_across_water_kingdom
|Scopes from a title to a neighboring kingdom (incl. across water, looking through the de jure lieges)
|any_title_to_title_neighboring_and_across_water_kingdom = { <count=num/all> / <percent=fixed_point> <triggers> }


|
Code triggers can take several forms:
|landed title
|landed title
|-
|any_title_to_title_neighboring_barony
|Scopes from a title to a neighboring barony (looking through the de jure lieges)
|any_title_to_title_neighboring_barony = { <count=num/all> / <percent=fixed_point> <triggers> }


|
==== Basic triggers ====
|landed title
|landed title
|-
|any_title_to_title_neighboring_county
|Scopes from a title to a neighboring county (looking through the de jure lieges)
|any_title_to_title_neighboring_county = { <count=num/all> / <percent=fixed_point> <triggers> }


|
Basic triggers check whether the statement has the expected positive or negative result.
|landed title
|landed title
|-
|any_title_to_title_neighboring_duchy
|Scopes from a title to a neighboring duchy (looking through the de jure lieges)
|any_title_to_title_neighboring_duchy = { <count=num/all> / <percent=fixed_point> <triggers> }


|
Ex: this trigger is true if the current character scope is ''not'' an AI.
|landed title
<code>is_ai = no</code>
|landed title
|-
|any_title_to_title_neighboring_empire
|Scopes from a title to a neighboring empire (looking through the de jure lieges)
|any_title_to_title_neighboring_empire = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|landed title
|landed title
|-
|any_title_to_title_neighboring_kingdom
|Scopes from a title to a neighboring kingdom (looking through the de jure lieges)
|any_title_to_title_neighboring_kingdom = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|landed title
|landed title
|-
|can_be_leased_out
|Can the scoped title be leased out?
|
|yes/no
|landed title
|
|-
|can_title_create_faction
|Can the title create the faction of the specified type against the specified character?
|can_title_create_faction = { type = X target = Y }
|
|landed title
|
|-
|can_title_join_faction
|Can the the scoped title join the faction?
|can_title_join_faction = faction
|
|landed title
|
|-
|county_control
|Does the county title have the required county control?
|
|<, <=, =, !=, >, >=
|landed title
|
|-
|county_control_rate
|How much county control is the county gaining each month?
|
|<, <=, =, !=, >, >=
|landed title
|
|-
|county_control_rate_modifier
|What's the multiplier to the control gain rate? E.g., if there's just a +20% modifier, this would return 1.2
|
|<, <=, =, !=, >, >=
|landed title
|
|-
|county_holder_opinion
|Compares the county's opinion of its holder
|
|<, <=, =, !=, >, >=
|landed title
|
|-
|county_opinion
|Compares the county's opinion of the current count
|
|<, <=, =, !=, >, >=
|landed title
|
|-
|county_opinion_target
|Compares the county's opinion of the target character to the specified value
| county_opinion_target = { target = X value >/</= Y }
|
|landed title
|
|-
|de_jure_drift_progress
|Compare drift progress towards target with value
|<drifting_title> = { de_jure_drift_progress = {   target = <drift_target_title>   value > 50 } }
|
|landed title
|
|-
|de_jure_drifting_towards
|Is the scoped landed title de jure drifting toward another title?
|<drifting_title> = { de_jure_drifting_towards = <drift_target_title> }
|landed title scope
|landed title
|landed title
|-
|development_level
|Does the county title have the required county development level?
|
|<, <=, =, !=, >, >=
|landed title
|
|-
|development_rate
|How much development progress is the county gaining each month?
|
|<, <=, =, !=, >, >=
|landed title
|
|-
|development_rate_modifier
|What's the multiplier to the development progress?
|
|<, <=, =, !=, >, >=
|landed title
|
|-
|development_towards_level_increase
|Does the county title have the required progress towards the next level of development? E.g., if level 1 is 100, level 2 is 300 (these are set in defines), and current total is 150, this would return 50
|
|<, <=, =, !=, >, >=
|landed title
|
|-
|has_character_nominiated
|Has the target character nominated a successor for the scoped title?
|
|character target
|landed title
|
|-
|has_county_modifier
|Does the scoped county have a given modifier?
|has_county_modifier = name
|
|landed title
|
|-
|has_county_modifier_duration_remaining
|Does the scoped county have the duration remaining on a given modifier?
|has_county_modifier_duration_remaining = name
|
|landed title
|
|-
|has_disabled_building
|Is the scoped landed title connected to a holding that contains at least one disabled building?
|
|yes/no
|landed title
|
|-
|has_holy_site_flag
|Does the barony have a holy site with the given flag?
| has_holy_site_flag = some_flag
|
|landed title
|
|-
|has_order_of_succession
|Does the scoped title have a given succession type?
|has_order_of_succession = election
|
|landed title
|
|-
|has_revokable_lease
|Is the title under a lease that can be revoked manually?
|
|yes/no
|landed title
|
|-
|has_title_law
|Does the scoped title have the given title-specific law?
|
|
|landed title
|
|-
|has_title_law_flag
|Does the scoped title have a title-specific law with the given flag?
|
|
|landed title
|
|-
|has_wrong_holding_type
|Is the scope landed title connected to a holding that cannot be governed by the current lessee or holder?
|
|yes/no
|landed title
|
|-
|is_capital_barony
|Is title in the scope a capital barony?
|
|yes/no
|landed title
|
|-
|is_coastal_county
|Is the county coastal?
|
|yes/no
|landed title
|
|-
|is_connected_to
|Is the county connected to the other county? Is based on top liege
|is_connected_to = {
max_naval_distance = 500
allow_one_county_land_gap = yes
target = some other county
}
|
|landed title
|
|-
|is_contested
|Is the scope landed title contested in any war?
|
|yes/no
|landed title
|
|-
|is_de_facto_liege_or_above_target
|Is the title de facto liege or above the target title?
|
|landed title target
|landed title
|
|-
|is_de_jure_liege_or_above_target
|Is the title de jure liege or above the target title?
|
|landed title target
|landed title
|
|-
|is_holy_order
|Is the scope landed title a holy order?
|
|yes/no
|landed title
|
|-
|is_holy_site
|Is the barony a holy site of any faith?
|is_holy_site = yes
|yes/no
|landed title
|
|-
|is_holy_site_controlled_by
|Does the target character control a holy site of the scoped object?
|is_holy_site_controlled_by = root
|character scope
|landed title
|character
|-
|is_holy_site_of
|Is the barony a holy site of the given faith?
|is_holy_site_of = catholic
|
|landed title
|
|-
|is_landless_type_title
|Is this title considered a landless type title?
|
|yes/no
|landed title
|
|-
|is_leased_out
|Is the scoped title leased out?
|
|yes/no
|landed title
|
|-
|is_mercenary_company
|Is the scope landed title a mercenary company?
|
|yes/no
|landed title
|
|-
|is_neighbor_to_realm
|Is this landed title adjacent to the character's realm?
|is_neighbor_to_realm = character
|character scope
|landed title
|character
|-
|is_target_of_council_task
|Is the county currently affected by the specified council task? Needs to be in a county title scope
|
|
|landed title
|
|-
|is_title_created
|Is title in the scope created?
|
|yes/no
|landed title
|
|-
|is_titular
|Is this title titular (has no de jure counties in it, and is not a barony/county)?
|
|yes/no
|landed title
|
|-
|is_under_holy_order_lease
|Is the scoped title leased out to any holy order?
|
|yes/no
|landed title
|
|-
|place_in_line_of_succession
|What place in line of succession does the character hold?
|
|
|landed title
|
|-
|recent_history
|Does the scope title have a history entry of the specified type in recent history?
|recent_history = { type = X days/months/years = Y }
The type can be omitted, all history types are considered then
Possible types:
*conquest
*conquest_holy_war
*conquest_claim
*conquest_populist
*election
*inheritance
*abdication
*created
*destroyed
*usurped
*granted
*revoked
*independency
*leased_out
*lease_revoked
*returned
*faction_demand
|
|landed title
|
|-
|target_is_de_facto_liege_or_above
|Is the target title de facto liege or above?
|
|landed title target
|landed title
|
|-
|target_is_de_jure_liege_or_above
|Is the target title de jure liege or above?
|
|landed title target
|landed title
|
|-
|tier
|What tier is the scoped title? Use the script values please, not raw numbers
|The tiers are
#tier_barony
#tier_county
#tier_duchy
#tier_kingdom
#tier_empire
|<, <=, =, !=, >, >=
|landed title
|
|-
|title_create_faction_type_chance
|Check if the chance to create a faction against a target of the scope landed title is is true against the scripted value
|title_create_faction_type_chance = {
   type = faction_type #An ongoing faction
   target = target_character
   value <|<=|>=|> 0
}
|
|landed title
|
|-
|title_is_a_faction_member
|Is the scope title a member of a faction?
|
|yes/no
|landed title
|
|-
|title_join_faction_chance
|Check if the chance of the scope landed title to join the faction against the scripted value
|title_join_faction_chance = {
   faction = faction_target #An ongoing faction
   value <|<=|>=|> 0
}


|
==== Simple triggers ====
|landed title
|
|-
|title_will_leave_sub_realm_on_succession
|Will the title leave the sub-realm of the character on the right-hand-side upon succession? That is, is the first heir in someone outside the sub-realm, and the highest tier title they'll inherit from the person holding the title is not higher than their current tier
|
|character target
|landed title
|
|-
|story_type
|Is the story in scope of this type?
|
|
|story cycle
|
|-
|can_get_innovation_from
|Get random applicable innovation from another culture
|
|
|culture
|
|-
|has_all_innovations
|Has the culture discovered all innovations matching the filter?
|has_all_innovations = {
with_flag = flag_name # innovation matches if it has the flag; optional
without_flag = flag_name # innovation matches if it does not have the flag; optional
culture_era = era_key # innovation matches if it is from the era; optional
}
|
|culture
|
|-
|has_cultural_era_or_later
|Has this culture achieved specified era?
|<culture> = { has_cultural_era_or_later = culture_era_early_medieval }
|
|culture
|
|-
|has_graphical_culture
|Does the culture (or its culture group) have this graphical culture?
|<culture> = { has_graphical_culture = celticgfx }
|
|culture
|
|-
|has_innovation
|Have the culture discovered this innovation?
|
|
|culture
|
|-
|mercenary_company_expiration_days
|How many days are left in the mercenary contract. 0 if not hired.
|
|<, <=, =, !=, >, >=
|mercenary company
|
|-
|age
|Compare character age
|
|<, <=, =, !=, >, >=
|character
|
|-
|ai_boldness
|AI boldness
|
|<, <=, =, !=, >, >=
|character
|
|-
|ai_compassion
|AI compassion
|
|<, <=, =, !=, >, >=
|character
|
|-
|ai_diplomacy_stance
|The AI's diplomatic view of the target character
|ai_diplomacy_stance = {
   target = target_character
   stance = neutral/threat/enemy/friend
}
|
|character
|
|-
|ai_energy
|AI energy
|
|<, <=, =, !=, >, >=
|character
|
|-
|ai_greed
|AI greed
|
|<, <=, =, !=, >, >=
|character
|
|-
|ai_honor
|AI honor
|
|<, <=, =, !=, >, >=
|character
|
|-
|ai_rationality
|AI rationality
|
|<, <=, =, !=, >, >=
|character
|
|-
|ai_sociability
|AI sociability
|
|<, <=, =, !=, >, >=
|character
|
|-
|ai_values_divergence
|Compare AI values between characters
|target = other character value >/</= sum of differences in ai values
|
|character
|
|-
|ai_vengefulness
|AI vengefulness
|
|<, <=, =, !=, >, >=
|character
|
|-
|ai_zeal
|AI zeal
|
|<, <=, =, !=, >, >=
|character
|
|-
|allowed_concubines
|Can the scope owner have concubines?
|
|yes/no
|character
|
|-
|allowed_more_concubines
|Can the scope owner have more concubines?
|
|yes/no
|character
|
|-
|allowed_more_spouses
|Can the scope owner have more spouses?
|
|yes/no
|character
|
|-
|any_alert_creatable_title
|Iterate through all titles that can be created by the character. (only for alerts)
|any_alert_creatable_title = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|landed title
|-
|any_alert_usurpable_title
|Iterate through all titles that can be usurped by the character. (only for alerts)
|any_alert_usurpable_title = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|landed title
|-
|any_ally
|Iterate through all allies
|any_ally = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_ancestor
|Iterate through all the ancestors of the scope character up to 5 generations
|any_ancestor = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_army
|Iterate through all armies
|any_army = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|army
|-
|any_character_to_title_neighboring_and_across_water_barony
|Scopes from a character to a neighboring barony (incl. across water, looking through the de jure lieges)
|any_character_to_title_neighboring_and_across_water_barony = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|landed title
|-
|any_character_to_title_neighboring_and_across_water_county
|Scopes from a character to a neighboring county (incl. across water, looking through the de jure lieges)
|any_character_to_title_neighboring_and_across_water_county = { <count=num/all> / <percent=fixed_point> <triggers> }


|
Simple triggers check whether they are true depending on the argument provided on the right hand side of the <code>=</code> sign.
|character
|landed title
|-
|any_character_to_title_neighboring_and_across_water_duchy
|Scopes from a character to a neighboring duchy (incl. across water, looking through the de jure lieges)
|any_character_to_title_neighboring_and_across_water_duchy = { <count=num/all> / <percent=fixed_point> <triggers> }


|
The argument is either:
|character
|landed title
|-
|any_character_to_title_neighboring_and_across_water_empire
|Scopes from a character to a neighboring empire (incl. across water, looking through the de jure lieges)
|any_character_to_title_neighboring_and_across_water_empire = { <count=num/all> / <percent=fixed_point> <triggers> }


|
* a scope
|character
Ex: this trigger checks whether the current character scope is a vassal of the saved scope <code>scope:actor</code>.
|landed title
<pre>is_vassal_of = scope:actor</pre>
|-
|any_character_to_title_neighboring_and_across_water_kingdom
|Scopes from a character to a neighboring kingdom (incl. across water, looking through the de jure lieges)
|any_character_to_title_neighboring_and_across_water_kingdom = { <count=num/all> / <percent=fixed_point> <triggers> }


|
* a database key
|character
Ex: this trigger checks whether the current character scope has the trait defined with the <code>infirm</code> key.
|landed title
<pre>has_trait = infirm</pre>
|-
|any_character_to_title_neighboring_barony
|Scopes from a character to a neighboring barony (looking through the de jure lieges)
|any_character_to_title_neighboring_barony = { <count=num/all> / <percent=fixed_point> <triggers> }


|
==== Complex triggers ====
|character
|landed title
|-
|any_character_to_title_neighboring_county
|Scopes from a character to a neighboring county (looking through the de jure lieges)
|any_character_to_title_neighboring_county = { <count=num/all> / <percent=fixed_point> <triggers> }


|
Complex triggers use several parameters in a script block. Those parameters can be a scope, a database key, a numerical value or a flag value.
|character
|landed title
|-
|any_character_to_title_neighboring_duchy
|Scopes from a character to a neighboring duchy (looking through the de jure lieges)
|any_character_to_title_neighboring_duchy = { <count=num/all> / <percent=fixed_point> <triggers> }


|
Ex: this trigger checks whether the current character scope has an active scheme of the murder type targeting their liege.
|character
<pre>is_scheming_against = {
|landed title
  target = liege
|-
  type = murder
|any_character_to_title_neighboring_empire
}</pre>
|Scopes from a character to a neighboring empire (looking through the de jure lieges)
|any_character_to_title_neighboring_empire = { <count=num/all> / <percent=fixed_point> <triggers> }


|
Some code triggers have both a simple form and a complex form.
|character
|landed title
|-
|any_character_to_title_neighboring_kingdom
|Scopes from a character to a neighboring kingdom (looking through the de jure lieges)
|any_character_to_title_neighboring_kingdom = { <count=num/all> / <percent=fixed_point> <triggers> }


|
==== In-line complex triggers ====
|character
|landed title
|-
|any_character_war
|Wars of the scoped character
|any_character_war = { <count=num/all> / <percent=fixed_point> <triggers> }


|
Some complex triggers can be written in one line to return a value.
|character
|war
|-
|any_child
|Iterate through all children
|any_child = { <count=num/all> / <percent=fixed_point> <triggers> }


|
It is written in quotation marks, with the additional argument in brackets.
|character
|character
|-
|any_claim
|Iterate through the titles of all claims held by a character; parameters: explicit = yes/no/all pressed = yes/no/all
|any_claim = { <count=num/all> / <percent=fixed_point> <triggers> }


|
For example, a script value would look like this:<syntaxhighlight lang="c">
|character
distance_to_liege_sval = {
|landed title
  value = "realm_to_title_distance_squared(liege.capital_county)"
|-
|any_close_family_member
|Iterate through all the close family [father, mother, siblings, children, grandparents]
|any_close_family_member = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_close_or_extended_family_member
|Iterate through all the close and extended relatives [father, mother, siblings, children, grandparents, uncles/aunts, nephew/niece, cousins]
|any_close_or_extended_family_member = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_concubine
|Iterate through all concubines
|any_concubine = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_consort
|Iterate through all consorts (concubines and spouses)
|any_consort = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_councillor
|Iterate through all councillors
|any_councillor = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_courtier
|Iterate through all courtiers
|any_courtier = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_courtier_away
|Iterate through all courtiers that are away
|any_courtier_away = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_courtier_or_guest
|Iterate through all courtiers and guests (pool and foreign court guests)
|any_courtier_or_guest = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_de_jure_claim
|Iterate through all de jure claims for a character
|any_de_jure_claim = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|landed title
|-
|any_diplomacy_councillor
|Iterate through all diplomacy-based councillors
|any_diplomacy_councillor = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_directly_owned_province
|Iterate through all directly owned provinces
|any_directly_owned_province = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|province
|-
|any_election_title
|Iterate through all titles the scoped character can vote on
|any_election_title = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|landed title
|-
|any_extended_family_member
|Iterate through all the extended family [uncles/aunts, nephew/niece, cousins]
|any_extended_family_member = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_foreign_court_guest
|Iterate through all guests visiting from another court (in contrast to pool_guest they have a liege)
|any_foreign_court_guest = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_former_concubine
|Iterate through all former concubines. Not persisted past death
|any_former_concubine = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_former_concubinist
|Iterate through all former concubinists. Not persisted past death
|any_former_concubinist = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_former_spouse
|Iterate through all former spouses
|any_former_spouse = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_general_councillor
|Iterate through all councillors that are not related to a skill
|any_general_councillor = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_heir
|Heirs of the scoped character
|any_heir = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_heir_title
|Iterate through all landed titles character is heir to
|any_heir_title = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|landed title
|-
|any_heir_to_title
|Iterate through all titles the scoped character is heir to
|any_heir_to_title = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|landed title
|-
|any_held_title
|Iterate through all held landed titles
|any_held_title = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|landed title
|-
|any_hired_mercenary
|Iterate through all hired mercenary companies
|any_hired_mercenary = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|mercenary company
|-
|any_hooked_character
|Iterate through all characters this character has a hook on
|any_hooked_character = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_hostile_raider
|Iterate through anyone the character is hostile to due to their top liege's realm having been raided
|any_hostile_raider = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_intrigue_councillor
|Iterate through all intrigue-based councillors
|any_intrigue_councillor = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_knight
|Iterate through all knights
|any_knight = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_known_secret
|Iterate through all secrets known by the character
|any_known_secret = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|secret
|-
|any_learning_councillor
|Iterate through all learning-based councillors
|any_learning_councillor = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_liege_or_above
|Iterate through all lieges above a character (skipping the character themselves)
|any_liege_or_above = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_martial_councillor
|Iterate through all martial-based councillors
|any_martial_councillor = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_neighboring_and_across_water_realm_same_rank_owner
|A sub-realm or realm bordering the scope character's realm (including across water) that has the same rank as the scoped character (look for lieges of the owner of the land if necessary)
|any_neighboring_and_across_water_realm_same_rank_owner = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_neighboring_and_across_water_top_liege_realm
|A realm with a different top liege neighboring the realm of the scoped character's top liege (including across water); switches to the realm's top title. Can be based on borders a day or two out of date
|any_neighboring_and_across_water_top_liege_realm = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|landed title
|-
|any_neighboring_and_across_water_top_liege_realm_owner
|A realm with a different top liege neighboring the realm of the scope character's top liege (including across water); switches to the holder of the realm. Can be based on borders a day or two out of date
|any_neighboring_and_across_water_top_liege_realm_owner = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_neighboring_realm_same_rank_owner
|A sub-realm or realm bordering the scope character's realm and has the same rank as the scope character (look for lieges of he owner of the land if necessary)
|any_neighboring_realm_same_rank_owner = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_neighboring_top_liege_realm
|A realm with a different top liege neighboring the realm of the scope character's top liege; switches to the realm's top title. Can be based on borders a day or two out of date
|any_neighboring_top_liege_realm = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|landed title
|-
|any_neighboring_top_liege_realm_owner
|A realm with a different top liege neighboring the realm of the scope character's top liege; switches to the holder of the realm. Can be based on borders a day or two out of date
|any_neighboring_top_liege_realm_owner = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_owned_story
|Iterate through all owned stories for a character
|any_owned_story = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|story cycle
|-
|any_parent
|Iterate through all (both) parents
|any_parent = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_patroned_holy_order
|Iterate through all holy orders that the scoped character is a patron of
|any_patroned_holy_order = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|holy order
|-
|any_pinned_character
|Iterate through characters this player has pinned
|any_pinned_character = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_pinning_character
|Iterate through characters whose player has this character pinned
|any_pinning_character = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_player_heir
|Iterate through player heirs, capped at the first 10
|any_player_heir = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_pool_guest
|Iterate through all guests visiting the court from the pool (in contrast to foreign_court_guest they don't have a liege)
|any_pool_guest = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_potential_marriage_option
|Iterate through all potential selectable marriage or betrothal options
|any_potential_marriage_option = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_pretender_title
|Iterate through all landed titles character is pretender to
|any_pretender_title = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|landed title
|-
|any_primary_war_enemy
|Iterate through all primary war enemies
|any_primary_war_enemy = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_prisoner
|Iterate through all prisoners in the scoped character's dungeon
|any_prisoner = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_prowess_councillor
|Iterate through all prowess-based councillors
|any_prowess_councillor = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_raid_target
|Iterate through anyone the character is hostile to due to having raided them. Only returns top lieges
|any_raid_target = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_realm_county
|Iterate through all counties in the realm. Based on top liege
|any_realm_county = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|landed title
|-
|any_realm_de_jure_duchy
|Iterate through all de jure duchies that have at least one county in the realm. Based on top liege
|any_realm_de_jure_duchy = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|landed title
|-
|any_realm_de_jure_empire
|Iterate through all de jures empire that have at least one county in the realm. Based on top liege
|any_realm_de_jure_empire = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|landed title
|-
|any_realm_de_jure_kingdom
|Iterate through all de jure kingdom that have at least one county in the realm. Based on top liege
|any_realm_de_jure_kingdom = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|landed title
|-
|any_realm_province
|Iterate through all realm provinces [baronies?] of a character
|any_realm_province = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|province
|-
|any_relation
|Iterate through scripted relations of a given type or multiple types. If someone is multiple relations they will only be in the list once
|any_relation = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_scheme
|Iterate through all schemes owned by the character
|any_scheme = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|scheme
|-
|any_secret
|Iterate through all secrets of the character
|any_secret = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|secret
|-
|any_sibling
|Iterate through all siblings
|any_sibling = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_spouse
|Iterate through all spouses
|any_spouse = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_spouse_candidate
|Iterate through all the spouse candidates of a character. WARNING: THIS IS VERY SLOW DO NOT DO IT OFTEN.
|any_spouse_candidate = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_stewardship_councillor
|Iterate through all stewardship-based councillors
|any_stewardship_councillor = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_sub_realm_barony
|Iterate through all baronies in sub-realm
|any_sub_realm_barony = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|landed title
|-
|any_sub_realm_county
|Iterate through all counties in sub-realm
|any_sub_realm_county = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|landed title
|-
|any_sub_realm_duchy
|Iterate through all duchies in sub-realm
|any_sub_realm_duchy = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|landed title
|-
|any_sub_realm_empire
|Iterate through all empires in sub-realm
|any_sub_realm_empire = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|landed title
|-
|any_sub_realm_kingdom
|Iterate through all kingdoms in sub-realm
|any_sub_realm_kingdom = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|landed title
|-
|any_sub_realm_title
|Iterate through all titles in sub-realm
|any_sub_realm_title = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|landed title
|-
|any_targeting_faction
|Iterate through all factions targeting the scoped character
|any_targeting_faction = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|faction
|-
|any_targeting_scheme
|Iterate through all schemes targeting the character
|any_targeting_scheme = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|scheme
|-
|any_targeting_secret
|Iterate through all secrets that target the specified scope
|any_targeting_secret = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|secret
|-
|any_traveling_family_member
|Iterate though all characters that should travel with the scoped one (when moving between courts for instance); includes the scoped character
|any_traveling_family_member = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_truce_holder
|Iterate through all characters that have a truce with this character
|any_truce_holder = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_truce_target
|Iterate through all characters this character has a truce with
|any_truce_target = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_unspent_known_secret
|Iterate through all unspent (not revealed/blackmailed) secrets known by the character
|any_unspent_known_secret = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|secret
|-
|any_vassal
|Iterate through all DIRECT vassals
|any_vassal = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_vassal_or_below
|Iterate through ALL vassals, not just direct vassals
|any_vassal_or_below = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_war_ally
|Iterate through all direct war allies
|any_war_ally = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|any_war_enemy
|Iterate through all direct war enemies
|any_war_enemy = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|character
|character
|-
|attraction
|Attraction value for the scoped character
|
|<, <=, =, !=, >, >=
|character
|
|-
|base_weight
|Base weight of the scoped character
|base_weight > 10
|<, <=, =, !=, >, >=
|character
|
|-
|can_add_hook
|Will trying to hook the target character override the current hook? (if no current hook, always returns true)
|can_add_hook = {
target = <character>
type = <hook type>
days/months/year = whatever (optional; will use the duration from the type if not provided)
}
}
|
</syntaxhighlight>This feature is not documented and doesn't work with all triggers. From testing, it seems to only support triggers with this line in their description: <code>Traits: <, <=, =, !=, >, >=</code>
|character
 
|
If a trigger has multiple arguments, like <code>has_trait_xp</code> which requires trait and track, they are added with a |
|-
 
|can_attack_in_hierarchy
<code>value = "has_trait_xp(lifestyle_traveler|danger)"</code>
|Can the scope character attack the given character based on their liege-vassal relations?
 
|
So far, this is the only known trigger with this multi-argument syntax.
|character target
 
|character
=== scripted_triggers ===
|
 
|-
Scripted_triggers are macros that enable replacing a set of triggers with a single statement, to make script more legible and avoid repetition.
|can_be_child_of
 
|Would the target character have been able to have children at the time of the scoped character's birth? Only age is taken into account
They are usually defined in <code>common/scripted_triggers</code>, and can then be used anywhere triggers are allowed.
|
|character target
|character
|
|-
|can_be_parent_of
|Would the scoped character have been able to have children at the time of the target character's birth? Only age is taken into account
|
|character target
|character
|
|-
|can_create_faction
|Can the character create the faction of the specified type against the specified character?
|can_create_faction = { type = X target = Y }
|
|character
|
|-
|can_execute_decision
|Is the scoped character able to execute the given decision?
|
|
|character
|
|-
|can_have_children
|Can the character have children? Only checks hard blocks from traits, not fertility
|can_have_children = yes/no
|yes/no
|character
|
|-
|can_join_activities
|Can the character join activities?
|
|yes/no
|character
|
|-
|can_join_faction
|Can the scope character join the faction?
|can_join_faction = faction
|
|character
|
|-
|can_join_or_create_faction_against
|Can the scope character create if join a faction against the target?
|can_join_or_create_faction_against = scope:faction_target
can_join_or_create_faction_against = {
who = scope:faction_target
faction = faction_key # optional
check_in_a_faction = no # default: yes
}
|character target
|character
|
|-
|can_start_scheme
|Can the character start the given scheme against the given character?
|can_start_scheme = { type = X target = Y }
|
|character
|
|-
|character_has_commander_trait_scope_does_not
|Does the character have a commander trait that the scope does not?
|
|character target
|character
|
|-
|character_is_land_realm_neighbor
|Is the scoped character a realm neighbor of the target? Meaning they're independent or have the same liege, and border your realm.
|
|character target
|character
|
|-
|character_is_realm_neighbor
|Is the scoped character a realm neighbor of the target? Meaning they're independent or has the same liege, and border your realm. Including across two sea zones
|
|character target
|character
|
|-
|completely_controls
|Coes the character control all counties and baronies inside de jure title (no hostile occupation either)?
|
|landed title scope
|character
|landed title
|-
|completely_controls_region
|Does the character control all counties and baronies inside the specified region (no hostile occupation either)?
|
|
|character
|
|-
|council_task_monthly_progress
|Is the scoped character's monthly progress on their assigned council task this big?
|
|<, <=, =, !=, >, >=
|character
|
|-
|create_faction_type_chance
|Check if the chance to create a faction against a target of the scope character is is true against the scripted value
|create_faction_type_chance = {
   type = faction_type #An ongoing faction
   target = target_character
   value <|<=|>=|> 0
}
|
|character
|
|-
|current_weight
|Current weight of the scoped character
|current_weight > 10
|<, <=, =, !=, >, >=
|character
|
|-
|current_weight_for_portrait
|Current weight of the scoped character as a value for portraits scaled between 0.0 and 1.0
|current_weight_for_portrait > 0.1
|<, <=, =, !=, >, >=
|character
|
|-
|days_in_prison
|Number of days the character has been imprisoned for (0 if not imprisoned)
|
|<, <=, =, !=, >, >=
|character
|
|-
|days_of_continuous_peace
|Number of days the character has been at peace (0 if at war). Raids count as 'not peace'
|
|<, <=, =, !=, >, >=
|character
|
|-
|days_of_continuous_war
|Number of days the character has been at war (0 if at peace)
|
|<, <=, =, !=, >, >=
|character
|
|-
|death_reason
|Does the scoped character have the given death reason?
|death_reason = death_natural_causes
|character
|
|-
|diplomacy
|Does the character have the required diplomacy skill level?
|
|<, <=, =, !=, >, >=
|character
|
|-
|diplomacy_diff
|Does the character have the required diplomacy skill level difference against target?
|diplomacy = { target = character value <= script_value abs = yes/no(optional, default no) }
|<, <=, =, !=, >, >=
|character
|
|-
|diplomacy_for_portrait
|Diplomacy skill scaled between 0.0 and 1.0 for portraits
|
|<, <=, =, !=, >, >=
|character
|
|-
|diplomacy_lifestyle_perk_points
|How many diplomacy perk points does the character have available?
|
|<, <=, =, !=, >, >=
|character
|
|-
|diplomacy_lifestyle_perks
|How many diplomacy perks does the character have?
|
|<, <=, =, !=, >, >=
|character
|
|-
|diplomacy_lifestyle_xp
|How much diplomacy lifestyle experience does the character have?
|
|<, <=, =, !=, >, >=
|character
|
|-
|does_ai_liege_in_vassal_contract_desire_obligation_change
|Does the AI liege in a vassal contract desire changing an obligation level?
|
|yes/no
|character
|
|-
|does_ai_vassal_in_vassal_contract_desire_obligation_change
|Does the AI vassal in a vassal contract desire changing an obligation level?
|
|yes/no
|character
|
|-
|domain_limit
|Is the scoped character's domain limit this big?
|
|<, <=, =, !=, >, >=
|character
|
|-
|domain_limit_available
|Is there this much space left in the character's domain limit? Negative values also work for checking characters that are above their limit
|
|<, <=, =, !=, >, >=
|character
|
|-
|domain_limit_percentage
|Is the scoped character's domain this big in comparison to their limit?
|
|<, <=, =, !=, >, >=
|character
|
|-
|domain_size
|Is the scoped character's domain this big?
|
|<, <=, =, !=, >, >=
|character
|
|-
|dread
|Does the character have the required dread?
|
|<, <=, =, !=, >, >=
|character
|
|-
|dread_modified_ai_boldness
|AI boldness modified by the dread of the specified character
|dread_modified_ai_boldness = {
character = root # the character whose dread is affecting the target character
value >= 5
}
|
|character
|
|-
|effective_age
|Age of character. If immortal, age they became immortal at
|
|<, <=, =, !=, >, >=
|character
|
|-
|fertility
|Does the character have the required fertility?
|
|<, <=, =, !=, >, >=
|character
|
|-
|focus_progress
|Does the character have this much focus progress?
|
|<, <=, =, !=, >, >=
|character
|
|-
|gold
|GHoes the character have the required gold?
|
|<, <=, =, !=, >, >=
|character
|
|-
|government_allows
|Checks if the government of the character allows something
|
|
|character
|
|-
|government_disallows
|Checks if the government of the character disallows something
|
|
|character
|
|-
|government_has_flag
|Checks if the government of the character has a specific flag
|
|
|character
|
|-
|has_any_cb_on
|Does the scope character have any casus belli on the target character?
|
|character target
|character
|
|-
|has_any_display_cb_on
|Does the scope character have any casus belli on the target character that should be displayed? (Allowed to fail valid_to_start_display_regardless)
|
|character target
|character
|
|-
|has_any_focus
|Does the character have any focus set?
|
|yes/no
|character
|
|-
|has_any_nickname
|Does the scope character have a nickname?
|
|yes/no
|character
|
|-
|has_any_scripted_relation
|Does the scope character have any scripted relation with the target character?
|
|character target
|character
|
|-
|has_any_secret_relation
|Does the scope character have any secret relationship with the target character?
|
|character target
|character
|
|-
|has_any_secrets
|Does the character have any secrets?
|
|yes/no
|character
|
|-
|has_bad_nickname
|Does the scope character have a bad nickname?
|
|yes/no
|character
|
|-
|has_banish_reason
|Does the character have the banish reason towards the target?
|
|character target
|character
|
|-
|has_cb_on
|Does the scoped character have the specified casus belli on the taget character? Invalid target returns false
|has_cb_on = { target = X casus_belli/cb = Y }
|
|character
|
|-
|has_character_flag
|Does the character have this flag?
|
|
|character
|
|-
|has_character_modifier
|Does the scoped character have a given modifier?
|has_character_modifier = name
|
|character
|
|-
|has_character_modifier_duration_remaining
|Does the scoped character have the duration remaining on a given modifier?
|has_character_modifier_duration_remaining = name
|
|character
|
|-
|has_claim_on
|Does the character have a claim on the target title?
|
|landed title target
|character
|
|-
|has_council_position
|Does the scoped character have the given position?
|
|
|character
|
|-
|has_councillor_for_skill
|Does the scoped character have a councillor for the specified skill?
| has_councillor_for_skill = X, where X is a skill name or 'general'
|
|character
|
|-
|has_culture
|Does the character have this culture?
|
|
|character
|
|-
|has_culture_group
|Is the character's culture in this culture group?
|has_culture_group = culture_group:east_slavic_group
|culture group scope
|character
|culture group
|-
|has_de_jure_claim_on
|Does the scope character have a de jure claim against the target?
|
|character target
|character
|
|-
|has_disable_non_aggression_pacts
|Does the character have disabled non-aggression pacts with the target?
|
|character target
|character
|
|-
|has_divorce_reason
|Does the character have the divorce reason towards the target?
|
|character target
|character
|
|-
|has_dread_level_towards
|How scared is the scope character of the target? 0 = not intimidated, 1 = intimidated, 2 = terrified.
|has_dread_level_towards = {
target = X
level >/</>=/<=/= Y
}
|
|character
|
|-
|has_dynasty
|Does the character have a valid dynasty?
|
|yes/no
|character
|
|-
|has_election_vote_of
|Is the target character voting for the scoped character in the election of the target title
|has_election_vote_of = { who = scope:actor title = primary_title }
|
|character
|
|-
|has_execute_reason
|Does the character have the execute reason towards the target?
|
|character target
|character
|
|-
|has_faith
|Does the character have this faith?
|has_faith = faith:baltic_pagan
|faith scope
|character
|faith
|-
|has_father
|does the character have a valid living father?
|
|yes/no
|character
|
|-
|has_focus
|Does the character have this focus?
|
|
|character
|
|-
|has_free_council_slot
|Does the scope character have a council position to fill? (ignoring automatically filled positions)
|
|yes/no
|character
|
|-
|has_gene
|Does the character have the specified gene template? Only works for morph genes. An interface trigger, can only be used in specific places
| has_gene = { category = X template = Y }
|
|character
|
|-
|has_government
|Checks if the character has a specific government type
| has_government = X
Where X is any government type (e.g. feudal_government, clan_government, tribal_government, etc.)
|
|character
|
|-
|has_had_focus_for_days
|Has the character had a focus for the given amount of time?
|
|<, <=, =, !=, >, >=
|character
|
|-
|has_hook
|Does the character have a hook on the target?
| has_hook = <character>
|character scope
|character
|character
|-
|has_hook_from_secret
|Does the character have a hook based on the target's secret?
|has_hook_from_secret = scope:saved_secret
|
|character
|
|-
|has_hook_of_type
|Does the character have a hook on the target of the given type?
|has_hook_of_type = { target = X type = Y }
|
|character
|
|-
|has_imprisonment_reason
|Does the character have an imprisonment reason towards the target?
|
|character target
|character
|
|-
|has_inactive_trait
|Does the character have this trait or a trait of this trait group amongst their inactive traits?
|
|
|character
|
|-
|has_lifestyle
|Does the character have this lifestyle?
|
|
|character
|
|-
|has_mother
|Does the character have a valid living mother?
|
|yes/no
|character
|
|-
|has_nickname
|Does the character have this nickname?
|
|
|character
|
|-
|has_non_aggression_pact
|Does the character have a non-aggression pact with the target?
|
|character target
|character
|
|-
|has_non_interference
|Does the character have the non-interference reason towards the target?
|
|character target
|character
|
|-
|has_opinion_modifier
|Does the character have the specified opinion modifier on the target? (optional *value <|<=|=|>=|> X* or *value = { MIN MAX }* inclusive)
|
|
|character
|
|-
|has_opposite_relation
|Does the scoped character have an opposite relationship of the relation value with the target character? target = , relation =
|
|
|character
|
|-
|has_owned_scheme
|Does this character own a scheme?
|
|yes/no
|character
|
|-
|has_pending_interaction_of_type
|Does the character have a pending interaction of the type? Only works if the scope is player-controlled.
|Example: has_pending_interaction = interaction_key
|
|character
|
|-
|has_perk
|Does the character have this perk?
|
|
|character
|
|-
|has_primary_title
|Does the character has specific title as his primary title?
|
|landed title scope
|character
|landed title
|-
|has_raid_immunity_against
|Is the scoped character's (top-liege) realm immune to raiding by the target due to having defeated their raid army?
|has_raid_immunity_against = scope:character
|character scope
|character
|character
|-
|has_raised_armies
|Does the character have raised or gathering armies?
|
|yes/no
|character
|
|-
|has_realm_law
|Does the scoped character have the given realm law?
|
|
|character
|
|-
|has_realm_law_flag
|Does the scoped character have a law with the given flag?
|
|
|character
|
|-
|has_relation_best_friend
|Checks for a scripted relationship with a target character
|
|character target
|character
|
|-
|has_relation_bully
|Checks for a scripted relationship with a target character
|
|character target
|character
|
|-
|has_relation_court_physician
|Checks for a scripted relationship with a target character
|
|character target
|character
|
|-
|has_relation_crush
|Checks for a scripted relationship with a target character
|
|character target
|character
|
|-
|has_relation_flag
|Does the scope character have a specific flag on a relation with the target character? target = , relation = , flag =
|
|
|character
|
|-
|has_relation_friend
|Checks for a scripted relationship with a target character
|
|character target
|character
|
|-
|has_relation_guardian
|Checks for a scripted relationship with a target character
|
|character target
|character
|
|-
|has_relation_intrigue_mentor
|Checks for a scripted relationship with a target character
|
|character target
|character
|
|-
|has_relation_intrigue_student
|Checks for a scripted relationship with a target character
|
|character target
|character
|
|-
|has_relation_lover
|Checks for a scripted relationship with a target character
|
|character target
|character
|
|-
|has_relation_mentor
|Checks for a scripted relationship with a target character
|
|character target
|character
|
|-
|has_relation_nemesis
|Checks for a scripted relationship with a target character
|
|character target
|character
|
|-
|has_relation_oaf
|Checks for a scripted relationship with a target character
|
|character target
|character
|
|-
|has_relation_potential_friend
|Checks for a scripted relationship with a target character
|
|character target
|character
|
|-
|has_relation_potential_lover
|Checks for a scripted relationship with a target character
|
|character target
|character
|
|-
|has_relation_potential_rival
|Checks for a scripted relationship with a target character
|
|character target
|character
|
|-
|has_relation_rival
|Checks for a scripted relationship with a target character
|
|character target
|character
|
|-
|has_relation_soldier_friend
|Checks for a scripted relationship with a target character
|
|character target
|character
|
|-
|has_relation_soulmate
|Checks for a scripted relationship with a target character
|
|character target
|character
|
|-
|has_relation_student
|Checks for a scripted relationship with a target character
|
|character target
|character
|
|-
|has_relation_victim
|Checks for a scripted relationship with a target character
|
|character target
|character
|
|-
|has_relation_ward
|Checks for a scripted relationship with a target character
|
|character target
|character
|
|-
|has_religion
|Does the character have this religion?
|has_religion = religion:buddhism_religion


|religion scope
They are sometimes defined locally in event files (see [[events]]), in which case they can only be used in events from the same file.
|character
|religion
|-
|has_revoke_title_reason
|Does the character have the revoke title reason towards the target?
|
|character target
|character
|
|-
|has_same_culture_as
|Does the character have the same culture as the target?
|
|character target
|character
|
|-
|has_same_culture_group_as
|Does the character have the same culture group as the target?
|
|character target
|character
|
|-
|has_same_focus_as
|Does the character have the same focus as the other?
|
|character target
|character
|
|-
|has_same_government
|Checks if the character has the same government type as another character
|
|character target
|character
|
|-
|has_secret_relation_best_friend
|Checks for a secret scripted relationship with a target character
|
|character target
|character
|
|-
|has_secret_relation_bully
|Checks for a secret scripted relationship with a target character
|
|character target
|character
|
|-
|has_secret_relation_court_physician
|Checks for a secret scripted relationship with a target character
|
|character target
|character
|
|-
|has_secret_relation_crush
|Checks for a secret scripted relationship with a target character
|
|character target
|character
|
|-
|has_secret_relation_friend
|Checks for a secret scripted relationship with a target character
|
|character target
|character
|
|-
|has_secret_relation_guardian
|Checks for a secret scripted relationship with a target character
|
|character target
|character
|
|-
|has_secret_relation_intrigue_mentor
|Checks for a secret scripted relationship with a target character
|
|character target
|character
|
|-
|has_secret_relation_intrigue_student
|Checks for a secret scripted relationship with a target character
|
|character target
|character
|
|-
|has_secret_relation_lover
|Checks for a secret scripted relationship with a target character
|
|character target
|character
|
|-
|has_secret_relation_mentor
|Checks for a secret scripted relationship with a target character
|
|character target
|character
|
|-
|has_secret_relation_nemesis
|Checks for a secret scripted relationship with a target character
|
|character target
|character
|
|-
|has_secret_relation_oaf
|Checks for a secret scripted relationship with a target character
|
|character target
|character
|
|-
|has_secret_relation_potential_friend
|Checks for a secret scripted relationship with a target character
|
|character target
|character
|
|-
|has_secret_relation_potential_lover
|Checks for a secret scripted relationship with a target character
|
|character target
|character
|
|-
|has_secret_relation_potential_rival
|Checks for a secret scripted relationship with a target character
|
|character target
|character
|
|-
|has_secret_relation_rival
|Checks for a secret scripted relationship with a target character
|
|character target
|character
|
|-
|has_secret_relation_soldier_friend
|Checks for a secret scripted relationship with a target character
|
|character target
|character
|
|-
|has_secret_relation_soulmate
|Checks for a secret scripted relationship with a target character
|
|character target
|character
|
|-
|has_secret_relation_student
|Checks for a secret scripted relationship with a target character
|
|character target
|character
|
|-
|has_secret_relation_victim
|Checks for a secret scripted relationship with a target character
|
|character target
|character
|
|-
|has_secret_relation_ward
|Checks for a secret scripted relationship with a target character
|
|character target
|character
|
|-
|has_sexuality
|Does the character's sexuality match the scripted? (heterosexual, homosexual, bisexual, asexual, none). Characters that have yet to get a sexuality (children) have none set.
|
|
|character
|
|-
|has_strong_claim_on
|Does the character have a pressed claim on the target title?
|
|landed title target
|character
|
|-
|has_strong_hook
|Does the character have a strong hook on the target?
|has_strong_hook = <character>
|character scope
|character
|character
|-
|has_strong_usable_hook
|Does the character have a strong hook on the target that is not on cooldown?
|has_strong_usable_hook = <character>
|character scope
|character
|character
|-
|has_targeting_faction
|Is there a faction targeting the scoped character?
|
|yes/no
|character
|
|-
|has_title
|Does the character hold the title?
|
|landed title scope
|character
|landed title
|-
|has_trait
|Does the character have this trait or a trait of this trait group?
|
|
|character
|
|-
|has_trait_rank
|Compare the trait rank of a character to a value or other character.
|has_trait_rank = {
  trait = TRAIT_GROUP
  rank <=> number (can be script value) # need only one of rank or character
  character <=> character target # need only one of rank or character
}
Note that not having the trait and having rank 0 count as the same thing. rank < X on its own will therefore return true for a character that does not have the trait.
|
|character
|
|-
|has_trait_with_flag
|Does the scope character have a trait with a certain flag?
|has_trait_with_flag = can_not_marry
|
|character
|
|-
|has_truce
|Does the scope character have a truce with the target character? Truces are one way, which means we ask if the scope character can't attack the target character
|
|character target
|character
|
|-
|has_usable_hook
|Does the character have a hook on the target that isn't on cooldown
|has_usable_hook = <character>
|character scope
|character
|character
|-
|has_weak_claim_on
|Does the character have an unpressed claim on the target title?
|
|landed title target
|character
|
|-
|has_weak_hook
|Does the character have a weak hook on the target? A strong hook will *not* count.
|has_weak_hook = <character>
|character scope
|character
|character
|-
|health
|Does the character have the required health?
|
|<, <=, =, !=, >, >=
|character
|
|-
|highest_held_title_tier
|What is the highest held landed title tier of the character?
|
|<, <=, =, !=, >, >=
|character
|
|-
|highest_skill
|Is the skill the highest skill (excluding prowess) of the character? True if tied for highest
|
|
|character
|
|-
|holds_landed_title
|Is the scope character landed (holds a county or barony)?
|
|yes/no
|character
|
|-
|important_action_is_valid_but_invisible
|Is there an important action available to the character, but they dismissed it?
|important_action_is_valid_but_invisible = important_action_key
|
|character
|
|-
|important_action_is_visible
|Is there an important action shown to the character?
|important_action_is_visible = important_action_key
|
|character
|
|-
|in_activity_type
|Is the character in an activity of the specified type?
|
|
|character
|
|-
|in_activity_with
|Is the character in the same activity?
|
|character target
|character
|
|-
|in_diplomatic_range
|Are the scoped character and the target character within each other's diplomatic range?
|
|character target
|character
|
|-
|intrigue
|Does the character have the required intrigue skill level?
|
|<, <=, =, !=, >, >=
|character
|
|-
|intrigue_diff
|Does the character have the required intrigue skill level difference against target?
|intrigue = { target = character value <= script_value abs = yes/no(optional, default no) }


|<, <=, =, !=, >, >=
==== Basic scripted_triggers ====
|character
|
|-
|intrigue_for_portrait
|Intrigue skill scaled between 0.0 and 1.0 for portraits
|
|<, <=, =, !=, >, >=
|character
|
|-
|intrigue_lifestyle_perk_points
|How many intrigue perk points does the character have available?
|
|<, <=, =, !=, >, >=
|character
|
|-
|intrigue_lifestyle_perks
|How many intrigue perks does the character have?
|
|<, <=, =, !=, >, >=
|character
|
|-
|intrigue_lifestyle_xp
|How much intrigue lifestyle experience does the character have?
|
|<, <=, =, !=, >, >=
|character
|
|-
|is_a_faction_leader
|Is the scoped character a leader of a faction?
|
|yes/no
|character
|
|-
|is_a_faction_member
|Is the scoped character a member of a faction?
|
|yes/no
|character
|
|-
|is_adult
|Is the scoped character adult?
|
|yes/no
|character
|
|-
|is_agent_exposed_in_scheme
|Is the scoped character an exposed agent in the target scheme?
|
|
|character
|
|-
|is_ai
|Is the character played by AI?
|
|yes/no
|character
|
|-
|is_alive
|Is the character alive?
|
|yes/no
|character
|
|-
|is_allied_in_war
|Is the scoped character allied to the target character in a war?
|
|character target
|character
|
|-
|is_allied_to
|Is the scoped character allied to the target character?
|
|character target
|character
|
|-
|is_at_home
|Is the character at home?
|
|yes/no
|character
|
|-
|is_at_location
|Is the character currently in the target province?
|
|province target
|character
|
|-
|is_at_same_location
|Is the character currently in the same province as the target character?
|
|character target
|character
|
|-
|is_at_war
|Is the character at war? Does not consider lieges' wars
|
|yes/no
|character
|
|-
|is_at_war_as_attacker
|Is the character at war as an attacker? Does not consider lieges' wars
|
|yes/no
|character
|
|-
|is_at_war_as_defender
|Is the character at war as a defender? Does not consider lieges' wars
|
|yes/no
|character
|
|-
|is_at_war_with
|Is the character at war with the target? Does not consider lieges' wars
|
|character target
|character
|
|-
|is_at_war_with_liege
|Is the character at war with their liege?
|
|yes/no
|character
|
|-
|is_attacker_in_war
|Is the scope character in the target war as an attacker?
|
|
|character
|
|-
|is_attracted_to_gender_of
|Does the sexuality of the scope character make them attracted to the target character?
|
|character target
|character
|
|-
|is_attracted_to_men
|Is the character attracted to men?
|
|yes/no
|character
|
|-
|is_attracted_to_women
|Is the character attracted to women?
|
|yes/no
|character
|
|-
|is_away_from_court
|Is the character away from the court?
|
|yes/no
|character
|
|-
|is_betrothed
|Is the scope character betrothed?
|
|yes/no
|character
|
|-
|is_causing_raid_hostility_towards
|Is the scoped character making the target hostile due to having raided their (top-liege's) realm?
|is_causing_raid_hostility_towards = scope:character
|character scope
|character
|character
|-
|is_character_interaction_potentially_accepted
|Is the character interaction specified available and potentially accepted for the target character?
|is_character_interaction_potentially_accepted = {
   recipient = character
   interaction = interaction_name
}
|
|character
|
|-
|is_character_interaction_shown
|Is the character interaction specified shown for the target character?
|is_character_interaction_shown = {
   recipient = character
   interaction = interaction_name
}
|
|character
|
|-
|is_character_interaction_valid
|Is the character interaction specified valid (shown and usable) for the target character?
|is_character_interaction_valid = {
   recipient = character
   interaction = interaction_name
}
|
|character
|
|-
|is_character_window_main_character
|Does the local player have knowledge about the secret?
|An interface trigger, can only be used in specific places
|yes/no
|character
|
|-
|is_child_of
|Is the character a child of the target character?
|
|character target
|character
|
|-
|is_claimant
|Is the character a claimant to any landed titles?
|
|yes/no
|character
|
|-
|is_clergy
|Is the scoped character clergy?
|
|yes/no
|character
|
|-
|is_close_family_of
|Is the character a close family [parents, children, siblings, grandparents, grandchildren] of the target character?
|
|character target
|character
|
|-
|is_close_or_extended_family_of
|Is the character a close or extended family [parents, children, siblings, grandparents, grandchildren, cousins, uncles, aunts, nephews, nieces] of the target character?
|
|character target
|character
|
|-
|is_commanding_army
|Is the character commanding an army?
|
|yes/no
|character
|
|-
|is_concubine
|Is the scoped character a concubine?
|
|yes/no
|character
|
|-
|is_concubine_of
|Is the target character a concubine of the scoped character?
|
|character target
|character
|
|-
|is_consort_of
|Is the character a spouse or concubine of the target character?
|
|character target
|character
|
|-
|is_councillor
|Is the scoped character a councillor?
|
|yes/no
|character
|
|-
|is_councillor_of
|Is the scoped character a councillor for the specified character?
|
|character target
|character
|
|-
|is_courtier
|Is the scope character a courtier?
|
|yes/no
|character
|
|-
|is_courtier_of
|Is the scoped character a courtier of the target character?
|
|character target
|character
|
|-
|is_cousin_of
|Is the character a cousin of the target character?
|
|character target
|character
|
|-
|is_defender_in_war
|Is the scoped character in the target war as a defender?
|
|
|character
|
|-
|is_employer_of
|Is the target character a courtier of the scope character?
|
|character target
|character
|
|-
|is_extended_family_of
|Is the character extended family [cousins, uncles, aunts, nephews, nieces] of the target character?
|
|character target
|character
|
|-
|is_female
|Is the scoped character female?
|
|yes/no
|character
|
|-
|is_forbidden_from_scheme
|Is the scoped character forbidden from joining the target scheme?
|
|
|character
|
|-
|is_forced_into_faction
|Is the scope character forced to be part of a faction?
|
|yes/no
|character
|
|-
|is_forced_into_scheme
|Checks if the scope character is forced into the target scheme
|
|
|character
|
|-
|is_foreign_court_guest
|Is the character a guest from another a court? In contrast to is_pool_guest the character has a liege
|
|yes/no
|character
|
|-
|is_foreign_court_guest_of
|Is the character a guest from another a court, visiting the target character's court? In contrast to is_pool_guest_of the character has a liege
|
|character target
|character
|
|-
|is_foreign_court_or_pool_guest
|Is the character a guest? (is_pool_guest or is_foreign_court_guest)
|
|yes/no
|character
|
|-
|is_foreign_court_or_pool_guest_of
|Is the character a guest? (is_pool_guest_of or is_foreign_court_guest_of)
|
|character target
|character
|
|-
|is_grandchild_of
|Is the character a grandchild of the target character?
|
|character target
|character
|
|-
|is_grandparent_of
|Is the character a grandparent of the target character?
|
|character target
|character
|
|-
|is_great_grandchild_of
|Is the character a great grandchild of the target character?
|
|character target
|character
|
|-
|is_great_grandparent_of
|Is the character a great grandparent of the target character?
|
|character target
|character
|
|-
|is_heir_of
|Is the character an heir of the target [placeholder]?
|
|character target
|character
|
|-
|is_immortal
|Is the character immortal?
|
|yes/no
|character
|
|-
|is_imprisoned
|is the character imprisoned?
|
|yes/no
|character
|
|-
|is_imprisoned_by
|Is the scope character imprisoned by the target character?
|is_imprisoned_by = TARGET
|character target
|character
|
|-
|is_in_an_activity
|Checks whether the character is currently in, or has joined an activity
|
|yes/no
|character
|
|-
|is_in_army
|Is the character in an army (a commander or a knight)?
|
|yes/no
|character
|
|-
|is_in_civil_war
|Is the character at war with their liege, or one or more of their vassals?
|
|yes/no
|character
|
|-
|is_in_ongoing_great_holy_war
|Is the character in an ongoing (i.e. the war has started) great holy war?
|
|yes/no
|character
|
|-
|is_in_pool_at
|Is the character in the pool the target province is a part of
|
|province target
|character
|
|-
|is_in_prison_type
|Is the character imprisoned in a prison of the specified type? Accepts any static modifier (see also imprison effect).
|is_in_prison_type = house_arrest
|
|character
|
|-
|is_in_target_activity
|Is the scope character participating in the target activity?
|
|
|character
|
|-
|is_in_the_same_court_as
|Is the character in the same court as the target character (they have the same court owner or one is a courtier of the other)?
|
|character target
|character
|
|-
|is_in_the_same_court_as_or_guest
|Is the character in the same court as the target character (they have the same court owner or one is a courtier of the other)? Includes guests in the court.
|
|character target
|character
|
|-
|is_incapable
|Is the character incapable?
|
|yes/no
|character
|
|-
|is_independent_ruler
|Is the character an independent ruler?
|
|yes/no
|character
|
|-
|is_knight
|Is the scoped character a knight?
|
|yes/no
|character
|
|-
|is_knight_of
|Is the scoped character a knight of the target character?
|
|character target
|character
|
|-
|is_landed
|Is the scoped character landed (holds a county or barony)?
|
|yes/no
|character
|
|-
|is_leader_in_war
|Is the scoped character leading one of the sides in the target war?
|
|
|character
|
|-
|is_leading_faction_type
|Is the character leading a faction of the specified type?
|
|
|character
|
|-
|is_liege_or_above_of
|Is the scope character a liege or above of the target character?
|
|character target
|character
|
|-
|is_local_player
|Is the character the local player?
|An interface trigger, can only be used in specific places
|yes/no
|character
|
|-
|is_lowborn
|Is the character lowborn?
|
|yes/no
|character
|
|-
|is_male
|Is the scope character male?
|
|yes/no
|character
|
|-
|is_married
|Is the scope character married?
|
|yes/no
|character
|
|-
|is_nibling_of
|Is the character a nibling (niece/nephew) of the target character?
|
|character target
|character
|
|-
|is_normal_councillor
|Is the scoped character a regular councillor?
|
|yes/no
|character
|
|-
|is_obedient
|Is the character obedient towards the target?
|
|character target
|character
|
|-
|is_overriding_designated_winner
|Is the scoped character overriding the winner in the GHW they're pledged to (will put their beneficiary on the throne if they're top participant)?
|
|yes/no
|character
|
|-
|is_parent_of
|Is the character a parent of the target character?
|
|character target
|character
|
|-
|is_participant_in_war
|Is the scope character participating in the target war as an attacker or defender?
|
|
|character
|
|-
|is_performing_council_task
|Is the scoped character performing the given task?
|
|
|character
|
|-
|is_player_heir_of
|Is the scope character the player heir of the target character?
|
|character target
|character
|
|-
|is_pledged_ghw_attacker
|Is the scoped character a pledged attacker in the current GHW? (it's an error to check this if there's no GHW around)
|
|yes/no
|character
|
|-
|is_pool_character
|Is the character in the pool? (not a ruler, courtier or guest at any court)
|
|yes/no
|character
|
|-
|is_pool_guest
|Is the character a guest from the pool? In contrast to is_foreign_court_guest the character has no liege
|
|yes/no
|character
|
|-
|is_pool_guest_of
|Is the character a guest from the pool, visiting the target character's court? In contrast to is_foreign_court_guest_of the character has no liege
|
|character target
|character
|
|-
|is_powerful_vassal
|Is the character a powerful vassal?
|
|yes/no
|character
|
|-
|is_powerful_vassal_of
|Is the character a powerful vassal of the target?
|
|character target
|character
|
|-
|is_pregnant
|Is the character pregnant?
|
|yes/no
|character
|
|-
|is_primary_heir_of
|Is the character the heir of the target's primary title?
|
|character target
|character
|
|-
|is_ruler
|Is the scope character a ruler (holds any title)?
|
|yes/no
|character
|
|-
|is_scheming_against
|Checks whether the scope character is an owner or an owner agent in a scheme against the target. There are 3 possible ways to use it:
|
*is_scheming_against = { target = X type = Y } limits to schemes of type Y
*is_scheming_against = { target = X scheme_skill = Y } limits to schemes of Y skill category
*is_scheming_against = { target = X } considers all schemes
|
|character
|
|-
|is_sibling_of
|Is the character a sibling of the target character?
|
|character target
|character
|
|-
|is_special_councillor
|Is the scoped character a special councillor?
|
|yes/no
|character
|
|-
|is_spouse_of
|Is the character a spouse of the target character, and are both alive?
|
|character target
|character
|
|-
|is_spouse_of_even_if_dead
|Is the character a spouse of the target character, even if one or both are dead?
|
|character target
|character
|
|-
|is_theocratic_lessee
|Is the scope character a theocratic lessee (bishop)?
|
|yes/no
|character
|
|-
|is_twin_of
|Is the character a twin of the target character?
|
|character target
|character
|
|-
|is_unborn_child_of_concubine
|Is the unborn a child of a concubine?
|
|yes/no
|character
|
|-
|is_unborn_known_bastard
|Is the unborn a known bastard?
|
|yes/no
|character
|
|-
|is_uncle_or_aunt_of
|Is the character an uncle or aunt of the target character?
|
|character target
|character
|
|-
|is_valid_as_agent_in_scheme
|Is the scope character suitable as an agent for the target scheme?
|
|
|character
|
|-
|is_vassal_of
|Is the character a direct vassal of the target character?
|
|character target
|character
|
|-
|is_vassal_or_below_of
|Is the scoped character a vassal or below of the target character?
|
|character target
|character
|
|-
|is_visibly_fertile
|Is the scoped character visibly fertile, that is: not too old if a woman, not too young and has no traits blocking having children
|
|yes/no
|character
|
|-
|join_faction_chance
|Check the chance of the scope character to join the faction against the scripted value
|join_faction_chance = {
   faction = faction_target #An ongoing faction
   value <|<=|>=|> 0
}


|
Simple scripted_triggers check whether a predetermined set of triggers is evaluated as a whole as true (<code>= yes</code>) or false (<code>= no</code>).
|character
|
|-
|join_scheme_chance
|Check if the chance of the scope character to join the scheme is between the given range (being min and max exclusive)
|join_scheme_chance = {
   scheme = scheme_target #An ongoing scheme
   max = 0
   min = -10
}
|
|character
|
|-
|learning
|Does the character have the required learning skill level?
|
|<, <=, =, !=, >, >=
|character
|
|-
|learning_diff
|Does the character have the required learning skill level difference against target?
|learning = { target = character value <= script_value abs = yes/no(optional, default no) }


|<, <=, =, !=, >, >=
Ex: if the following set of triggers is repeatedly used to check whether a character is a rich adult independent ruler:
|character
<pre>is_independent_ruler = yes
|
is_adult = yes
|-
gold > 1000</pre>
|learning_for_portrait
instead of repeating the same set of triggers in different places, they can be defined as a scripted_trigger:
|Learning skill scaled between 0.0 and 1.0 for portraits
<pre>is_rich_adult_independent_ruler = {
|
  is_adult = yes
|<, <=, =, !=, >, >=
  is_independent_ruler = yes
|character
  gold > 1000
|
}</pre>
|-
|learning_lifestyle_perk_points
|How many learning lifestyle perk points does the character have available?
|
|<, <=, =, !=, >, >=
|character
|
|-
|learning_lifestyle_perks
|How many learning lifestyle perks does the character have?
|
|<, <=, =, !=, >, >=
|character
|
|-
|learning_lifestyle_xp
|How much learning lifestyle experience does the character have?
|
|<, <=, =, !=, >, >=
|character
|
|-
|long_term_gold
|Does the character have the required gold? (AI category long term)
|
|<, <=, =, !=, >, >=
|character
|
|-
|martial
|Does the character have the required martial skill level?
|
|<, <=, =, !=, >, >=
|character
|
|-
|martial_diff
|Does the character have the required martial skill level difference against target?
|martial = { target = character value <= script_value abs = yes/no(optional, default no) }


|<, <=, =, !=, >, >=
and anywhere that set of triggers needs to be checked, it can be replaced by the following statement:
|character
<code>is_rich_adult_independent_ruler = yes</code>
|
|-
|martial_for_portrait
|Martial skill scaled between 0.0 and 1.0 for portraits
|
|<, <=, =, !=, >, >=
|character
|
|-
|martial_lifestyle_perk_points
|How many martial perk points does the character have available?
|
|<, <=, =, !=, >, >=
|character
|
|-
|martial_lifestyle_perks
|How many martial lifestyle perks does the character have?
|
|<, <=, =, !=, >, >=
|character
|
|-
|martial_lifestyle_xp
|How much martial lifestyle experience does the character have?
|
|<, <=, =, !=, >, >=
|character
|
|-
|matrilinear_betrothal
|Is this character's betrothal matrilinear? False if there's no betrothal.
|
|yes/no
|character
|
|-
|matrilinear_marriage
|Is the marriage with the spouse matrilinear?
|
|yes/no
|character
|
|-
|max_military_strength
|Is the scoped character's max military strength this big?
|
|<, <=, =, !=, >, >=
|character
|
|-
|max_number_maa_soldiers_of_base_type
|Does the scope character have value amount of max soldiers of men at arms of the base type?
|
|<, <=, =, !=, >, >=
|character
|
|-
|max_number_maa_soldiers_of_type
|Does the scope character have value amount of max soldiers of men at arms of the type?
|
|<, <=, =, !=, >, >=
|character
|
|-
|max_number_of_concubines
|The maximum number of concubines a character can have
|max_number_of_concubines > 2
|<, <=, =, !=, >, >=
|character
|
|-
|max_number_of_knights
|Check how many knights the scoped character can potentially have
|
|<, <=, =, !=, >, >=
|character
|
|-
|missing_unique_ancestors
|The amount of missing unique ancestors from the character's real father and mother
|Traverses the family tree for NDefines::NChildbirth::INBREEDING_ANCESTOR_GENERATIONS amount of generations. By default this means that we're traversing 62 ancestors and report the number of duplicates we find.
calc_missing_unique_ancestors > 10
|<, <=, =, !=, >, >=
|character
|
|-
|monthly_character_balance
|Is the scoped character's monthly balance this big?
|
|<, <=, =, !=, >, >=
|character
|
|-
|monthly_character_expenses
|Is the scoped character's monthly expenses this big?
|
|<, <=, =, !=, >, >=
|character
|
|-
|monthly_character_income
|Is the scoped character's monthly income this big?
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_bad_genetic_traits
|Compare the number of bad genetic traits
|<charater> = { num_of_bad_genetic_traits = 0 }
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_good_genetic_traits
|Compare the number of good genetic traits
|<charater> = { num_of_good_genetic_traits >= 2 }
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_relation_best_friend
|Compares the number of scripted relations a character has of the type
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_relation_bully
|Compares the number of scripted relations a character has of the type
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_relation_court_physician
|Compares the number of scripted relations a character has of the type
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_relation_crush
|Compares the number of scripted relations a character has of the type
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_relation_friend
|Compares the number of scripted relations a character has of the type
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_relation_guardian
|Compares the number of scripted relations a character has of the type
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_relation_intrigue_mentor
|Compares the number of scripted relations a character has of the type
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_relation_intrigue_student
|Compares the number of scripted relations a character has of the type
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_relation_lover
|Compares the number of scripted relations a character has of the type
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_relation_mentor
|Compares the number of scripted relations a character has of the type
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_relation_nemesis
|Compares the number of scripted relations a character has of the type
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_relation_oaf
|Compares the number of scripted relations a character has of the type
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_relation_potential_friend
|Compares the number of scripted relations a character has of the type
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_relation_potential_lover
|Compares the number of scripted relations a character has of the type
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_relation_potential_rival
|Compares the number of scripted relations a character has of the type
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_relation_rival
|Compares the number of scripted relations a character has of the type
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_relation_soldier_friend
|Compares the number of scripted relations a character has of the type
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_relation_soulmate
|Compares the number of scripted relations a character has of the type
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_relation_student
|Compares the number of scripted relations a character has of the type
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_relation_victim
|Compares the number of scripted relations a character has of the type
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_of_relation_ward
|Compares the number of scripted relations a character has of the type
|
|<, <=, =, !=, >, >=
|character
|
|-
|num_sinful_traits
|Does the scoped character have this many virtuous traits?
|
*num_virtous_traits > 5
*num_virtous_traits = { value > 5 faith = scope:faith } to base it on what a specific faith considers virtuous
|<, <=, =, !=, >, >=
|character
|
|-
|num_virtuous_traits
|Does the scoped character have this many virtuous traits?
|
*num_virtous_traits > 5
*num_virtous_traits = { value > 5 faith = scope:faith } to base it on what a specific faith considers virtuous
|<, <=, =, !=, >, >=
|character
|
|-
|number_maa_regiments_of_base_type
|Does the scoped character have value amount of men at arms of the base type?
|
|<, <=, =, !=, >, >=
|character
|
|-
|number_maa_regiments_of_type
|Does the scoped character have value amount of men at arms of the type?
|
|<, <=, =, !=, >, >=
|character
|
|-
|number_maa_soldiers_of_base_type
|Does the scoped character have value amount of soldiers of men at arms of the base type?
|
|<, <=, =, !=, >, >=
|character
|
|-
|number_maa_soldiers_of_type
|Does the scoped character have value amount of soldiers of men at arms of the type?
|
|<, <=, =, !=, >, >=
|character
|
|-
|number_of_commander_traits
|Does the character have this many commander traits?
|
|<, <=, =, !=, >, >=
|character
|
|-
|number_of_commander_traits_in_common
|Does the character and the target have a number of commander traits in common?
|number_of_personality_traits_in_common = { target = X value >/</>=/<= Y }


|
Using the negative version
|character
<pre>is_rich_adult_independent_ruler = no</pre>
|
is the same as using a <code>NOT</code> logic block
|-
<pre>NOT = { is_rich_adult_independent_ruler = yes }</pre>
|number_of_concubines
|The number of concubines the scoped character has
|number_of_concubines > 2
|<, <=, =, !=, >, >=
|character
|
|-
|number_of_desired_concubines
|The number of fertile concubines the scoped character should have to not get penalties
|number_of_desired_concubines > 2
|<, <=, =, !=, >, >=
|character
|
|-
|number_of_election_votes
|Check the number of votes the scoped character has in the target title
|number_of_election_votes = { title = scope:actor.primary_title value = 0 }
|<, <=, =, !=, >, >=
|character
|
|-
|number_of_fertile_concubines
|The number of visibly fertile concubines the scoped character has
|number_of_fertile_concubines > 2
|<, <=, =, !=, >, >=
|character
|
|-
|number_of_knights
|Check how many knights the scoped character has at the moment
|
|<, <=, =, !=, >, >=
|character
|
|-
|number_of_lifestyle_traits
|Does the character have this many lifestyle traits?
|
|<, <=, =, !=, >, >=
|character
|
|-
|number_of_maa_regiments
|The number of men at arms the scoped character has
|
|<, <=, =, !=, >, >=
|character
|
|-
|number_of_opposing_personality_traits
|Does the character and the target have a number of opposing personality traits?
|number_of_opposing_personality_traits = { target = X value >/</>=/<= Y }
|
|character
|
|-
|number_of_opposing_traits
|Does the character and the target have a number of opposing traits?
|number_of_opposing_traits = { target = X value >/</>=/<= Y }
|
|character
|
|-
|number_of_personality_traits
|Does the character have this many personality traits?
|
|<, <=, =, !=, >, >=
|character
|
|-
|number_of_personality_traits_in_common
|Does the character and the target have a number of personality traits in common?
|number_of_personality_traits_in_common = { target = X value >/</>=/<= Y }
|
|character
|
|-
|number_of_powerful_vassals
|Does the character have a specified number of powerful vassals?
|
|<, <=, =, !=, >, >=
|character
|
|-
|number_of_traits
|Does the character have this many traits?
|
|<, <=, =, !=, >, >=
|character
|
|-
|number_of_traits_in_common
|Does the character and the target have a number of traits in common?
|number_of_traits_in_common = { target = X value >/</>=/<= Y }


|
Because scripted_triggers can be used in a variety of different contexts, it is advised not to use in their definition ambiguous event targets such as <code>root</code> or <code>prev</code>.
|character
|
|-
|opinion
|Is the character's opinion of the target greater or equal than the value?
| opinion = { target = X [*value >/</>=/<= Y* or *value = { min max }*  }
|
|character
|
|-
|owns_a_story
|Ćhecks whether the scope character is the owner of any currently active story
|
|yes/no
|character
|
|-
|owns_an_activity
|Checks whether the scope character is the owner of any currently active activity
|
|yes/no
|character
|
|-
|owns_story_of_type
|Does the character own a story of this type?
|
|
|character
|
|-
|patrilinear_betrothal
|Is this character's betrothal patrilinear? False if there's no betrothal.
|
|yes/no
|character
|
|-
|patrilinear_marriage
|Is the marriage with the spouse patrilinear?
|
|yes/no
|character
|
|-
|perk_points
|Does the character have this many perk points across all lifestyles combined?
|
|<, <=, =, !=, >, >=
|character
|
|-
|perk_points_assigned
|Does the character have this many perks across all lifestyles combined?
|
|<, <=, =, !=, >, >=
|character
|
|-
|perks_in_tree
|Does the character have this many perk points assigned to this tree? perks_in_tree = { tree = tree_key value > 5 }
|
|<, <=, =, !=, >, >=
|character
|
|-
|piety
|Does the character have the required piety?
|
|<, <=, =, !=, >, >=
|character
|
|-
|piety_level
|Does the character have the required devotion level?
|
|<, <=, =, !=, >, >=
|character
|
|-
|player_heir_position
|Check where the target character is in the scoped character's player heir list.
|player_heir_position = { target = scope:actor position = 0 }
|<, <=, =, !=, >, >=
|character
|
|-
|pregnancy_days
|How long has the character been pregnant? Counts from impregnation, not reveal
|
|<, <=, =, !=, >, >=
|character
|
|-
|prestige
|Does the character have the required prestige?
|
|<, <=, =, !=, >, >=
|character
|
|-
|prestige_level
|Does the character have the required fame level?
|
|<, <=, =, !=, >, >=
|character
|
|-
|prowess
|Does the character have the required prowess skill level?
|
|<, <=, =, !=, >, >=
|character
|
|-
|prowess_diff
|Does the character have the required prowess skill level difference against target?
|prowess = { target = character value <= script_value abs = yes/no(optional, default no) }


|<, <=, =, !=, >, >=
==== Complex scripted_triggers ====
|character
|
|-
|prowess_for_portrait
|Prowess skill scaled between 0.0 and 1.0 for portraits
|
|<, <=, =, !=, >, >=
|character
|
|-
|ransom_cost
|What is the ransom cost of the character?
|
|<, <=, =, !=, >, >=
|character
|
|-
|realm_size
|Is the scoped character's top liege's realm this big (# of counties)?
|
|<, <=, =, !=, >, >=
|character
|
|-
|realm_to_title_distance_squared
|Is the character's realm within this distance of the title? Distance is in pixels, squared for performance reasons.
|realm_to_title_distance_squared = { title = some_title value > 10000 }
|<, <=, =, !=, >, >=
|character
|
|-
|reverse_has_opinion_modifier
|Does the target have the specified opinion modifier on the character? (optional *value <|<=|=|>=|> X* or *value = { MIN MAX }* inclusive)
|
|
|character
|
|-
|reverse_opinion
|What is the target character's opinion of the scope character? opinion = { target = X value >/</>=/<= Y }
|
|
|character
|
|-
|scriptedtests_can_marry_character
|Can the character marry the target character?
|
|character target
|character
|
|-
|scriptedtests_dread_base
|Does the character have the specified natural dread?
|
|<, <=, =, !=, >, >=
|character
|
|-
|scriptedtests_gold_income
|Does the character have the specified tax income?
|
|<, <=, =, !=, >, >=
|character
|
|-
|scriptedtests_piety_income
|does the character have the specified piety income?
|
|<, <=, =, !=, >, >=
|character
|
|-
|sex_opposite_of
|Are the scope character and the target character of opposite sex?
|
|character target
|character
|
|-
|sex_same_as
|Are the scope character and the target character of the same sex?
|
|character target
|character
|
|-
|short_term_gold
|Does the character have the required gold? (AI category short term)
|
|<, <=, =, !=, >, >=
|character
|
|-
|should_show_disturbing_portrait_modifiers
|Is the character the local player?
|An interface trigger, can only be used in specific places
|yes/no
|character
|
|-
|stewardship
|Does the character have the required stewardship skill level?
|
|<, <=, =, !=, >, >=
|character
|
|-
|stewardship_diff
|Does the character have the required stewardship skill level difference against target?
|stewardship = { target = character value <= script_value abs = yes/no(optional, default no) }
|<, <=, =, !=, >, >=
|character
|
|-
|stewardship_for_portrait
|Stewardship skill scaled between 0.0 and 1.0 for portraits
|
|<, <=, =, !=, >, >=
|character
|
|-
|stewardship_lifestyle_perk_points
|How many perk points available does the character have?
|
|<, <=, =, !=, >, >=
|character
|
|-
|stewardship_lifestyle_perks
|How many perks from this lifestyle does the character have?
|
|<, <=, =, !=, >, >=
|character
|
|-
|stewardship_lifestyle_xp
|How many stewardship perk points does the character have available?
|
|<, <=, =, !=, >, >=
|character
|
|-
|stress
|Does the character have the required stress?
|
|<, <=, =, !=, >, >=
|character
|
|-
|stress_level
|Does the character have the required stress level?
|
|<, <=, =, !=, >, >=
|character
|
|-
|sub_realm_size
|Is the scoped character's sub-realm this big (# of counties)?
|
|<, <=, =, !=, >, >=
|character
|
|-
|target_is_liege_or_above
|Is the target character the liege or above the scoped character?
|
|character target
|character
|
|-
|target_is_same_character_or_above
|Is the target character the scoped character or above them in the vassal hierarchy?
|
|character target
|character
|
|-
|target_is_vassal_or_below
|Is the target character a vassal or below of the scope character?
|
|character target
|character
|
|-
|target_weight
|Target weight of the scoped character
|target_weight > 10
|<, <=, =, !=, >, >=
|character
|
|-
|tier_difference
|What is the difference in highest held title tier between the scoped character and the target character? (-5 to 5)
|For example, this is true:
scope:a_baron = {
   tier_difference = {
     target = scope:a_king
     value = -3
   }
}
|
|character
|
|-
|time_in_prison
|How long has the character been imprisoned? time_in_prison = { days/months/years =,>,< X }
|
|
|character
|
|-
|time_in_prison_type
|How long has the character been imprisoned with the current imprisonment type? time_in_prison_type = { days/months/years =,>,< X }
|
|
|character
|
|-
|trait_compatibility
|target = other character value >/</= sum of trait compatibility values
|
|
|character
|
|-
|tyranny
|Does the character have the required tyranny?
|
|<, <=, =, !=, >, >=
|character
|
|-
|vassal_contract_has_flag
|Do any of the current active obligations in the scoped character's vassal contract have the given flag?
|
|
|character
|
|-
|vassal_contract_has_modifiable_obligations
|Can the scoped character's contract be modified at all? That is: they have one, they use obligation levels, and are count or above
|
|yes/no
|character
|
|-
|vassal_contract_is_blocked_from_modification
|Has the scoped character's contract been blocked from modification by script via 'set_vassal_contract_modification_blocked'?
|
|yes/no
|character
|
|-
|vassal_contract_obligation_level_can_be_decreased
|Can the obligation level of the scoped character's vassal contract be decreased?
|
|
|character
|
|-
|vassal_contract_obligation_level_can_be_increased
|Can the obligation level of the scoped character's vassal contract be increased?
|
|
|character
|
|-
|vassal_count
|Does the scoped character have this many vassals (excluding barons)?
|
|<, <=, =, !=, >, >=
|character
|
|-
|vassal_limit
|Is the scoped character's vassal limit this big?
|
|<, <=, =, !=, >, >=
|character
|
|-
|vassal_limit_available
|Is there this much space left in the character's vassal limit? Negative values also work for checking characters that are above their limit
|
|<, <=, =, !=, >, >=
|character
|
|-
|vassal_limit_percentage
|Is the scoped character's vassal count this big in comparison to their limit?
|
|<, <=, =, !=, >, >=
|character
|
|-
|yearly_character_balance
|Is the scoped character's yearly balance this big?
|
|<, <=, =, !=, >, >=
|character
|
|-
|yearly_character_expenses
|Is the scoped character's yearly expenses this big?
|
|<, <=, =, !=, >, >=
|character
|
|-
|yearly_character_income
|Is the scoped character's yearly income this big?
|
|<, <=, =, !=, >, >=
|character
|
|-
|yields_alliance
|Checks if the character would get an alliance with the target character through such a marriage.
|
|
|character
|
|-
|any_faction_county_member
|Iterate through all faction county members
|any_faction_county_member = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|faction
|landed title
|-
|any_faction_member
|Iterate through all faction character members
|any_faction_member = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|faction
|character
|-
|average_faction_opinion
|Average opinion of all the characters of the faction scope target
|
|<, <=, =, !=, >, >=
|faction
|
|-
|average_faction_opinion_not_powerful_vassal
|Average opinion of the character that are ''not'' powerful vassals of the faction scope target
|
|<, <=, =, !=, >, >=
|faction
|
|-
|average_faction_opinion_powerful_vassal
|Average opinion of the character that are powerful vassals of the faction scope target
|
|<, <=, =, !=, >, >=
|faction
|
|-
|faction_can_press_demands
|Can the scoped faction press demands?
|
|yes/no
|faction
|
|-
|faction_discontent
|Current discontent of the faction
|
|<, <=, =, !=, >, >=
|faction
|
|-
|faction_is_at_war
|Is the scoped faction at war?
|
|yes/no
|faction
|
|-
|faction_is_type
|Is the faction of this type?
|
|
|faction
|
|-
|faction_power
|Current power of the faction
|
|<, <=, =, !=, >, >=
|faction
|
|-
|faction_power_threshold
|Current power threshold of the faction
|
|<, <=, =, !=, >, >=
|faction
|
|-
|has_special_character
|Does the faction have a special character assigned?
|
|yes/no
|faction
|
|-
|has_special_title
|Does the faction have a special title assigned?
|
|yes/no
|faction
|
|-
|number_of_faction_members_in_council
|Current number of faction members in faction
|
|<, <=, =, !=, >, >=
|faction
|
|-
|any_war_attacker
|Iterate through all attackers in the war
|any_war_attacker = { <count=num/all> / <percent=fixed_point> <triggers> }


|
Scripted_triggers can also have a complex form that handles literal text replacement, allowing to pass arguments.
|war
|character
|-
|any_war_defender
|Iterate through all defenders in the war
|any_war_defender = { <count=num/all> / <percent=fixed_point> <triggers> }


|
For example, if the following set of triggers are used to check that the current character scope is a vassal of the King of France and related to them:
|war
|character
|-
|any_war_participant
|Iterate through all participants in the war
|any_war_participant = { <count=num/all> / <percent=fixed_point> <triggers> }


|
<pre>is_vassal_of = title:k_france.holder
|war
is_close_family_of = title:k_france.holder</pre>
|character
that set of triggers can be defined as a scripted_trigger, but instead of referencing <code>title:k_france.holder</code> specifically, the scripted_trigger uses an argument defined in uppercase letters wrapped in two <code>$</code> signs:
|-
<pre>is_related_vassal_of = {
|attacker_war_score
  is_vassal_of = $TARGET$
|Compares the attacker war score
  is_close_family_of = $TARGET$
|
}</pre>
|<, <=, =, !=, >, >=
When used, the complex form of the scripted_trigger specifies what the expected argument is, by using the same name but without the <code>$</code> signs:
|war
<pre>is_related_vassal_of = {
|
  TARGET = title:k_france.holder
|-
}</pre>
|days_since_max_war_score
|Number of days since the war score has been at max (+100 or −100). Returns -1 if the war score is not +100 or −100
|
|<, <=, =, !=, >, >=
|war
|
|-
|defender_war_score
|Compares the defender war score
|
|<, <=, =, !=, >, >=
|war
|
|-
|has_valid_casus_belli
|Does the war interaction still have a valid casus belli? (Those should be automatically removed on daily tick, but can exist for a tick)
|
|yes/no
|war
|
|-
|is_attacker
|Is the target character in the scope war as an attacker?
|
|character target
|war
|
|-
|is_civil_war
|Check if the scope war is a civil war or not
|
|yes/no
|war
|
|-
|is_defender
|Is the target character in the scoped war as a defender?
|
|character target
|war
|
|-
|is_participant
|Is the target character participating in the scope war as either an attacker or defender?
|
|character target
|war
|
|-
|is_war_leader
|Is the target character leading one of the sides in the scoped war?
|
|character target
|war
|
|-
|is_white_peace_possible
|Check if the scoped war's CB allows white peace (is_white_peace_possible = yes)
|
|yes/no
|war
|
|-
|using_cb
|Is the scope war using the specified CB?
|using_cb = religious_war
|
|war
|
|-
|war_contribution
|Checks how much a character has contributed to the scoped war
|war_contribution = {
target = some character
value > 5
}


|
With that form, every occurrence of <code>$TARGET$</code> in the scripted_trigger  will be ''literally'' replaced with the argument provided: the text replacement happens ''before'' the scripted_trigger is evaluated.
|war
|
|-
|war_days
|Compares the number of days the war has gone on for
|
|<, <=, =, !=, >, >=
|war
|
|-
|was_called
|Has the target character been called to the scope war already?
|
|character target
|war
|
|-
|any_defensive_great_holy_wars
|Iterate through all great holy wars this faith is defending against
|any_defensive_great_holy_wars = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|faith
|great holy war
|-
|any_faith_holy_order
|Iterate through all holy orders of the faith
|any_faith_holy_order = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|faith
|holy order
|-
|any_holy_site
|Iterate through all holy site baronies of a faith
|any_holy_site = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|faith
|landed title
|-
|controls_holy_site
|Does the faith control a holy site? controls_holy_site = key_of_holy_site
|
|
|faith
|
|-
|controls_holy_site_with_flag
|Does the faith control a holy site with the given flag? controls_holy_site_with_flag = some flag
|
|
|faith
|
|-
|estimated_faith_strength
|How strong is the scoped faith? *Expensive*, if you're gonna use the value repeatedly, save it to a scope first! This is scaled by a factor of 1000, so '1' means 1000 men. This is due to the cap of ~2 million, which would be too low in many cases
|
|<, <=, =, !=, >, >=
|faith
|
|-
|faith_hostility_level
|What is the faith's hostility level towards the target faith?
|faith_hostility_level { target = scope:some_faith value > 1 }


The levels are
== Logical Operators/Triggers ==
*0 righteous
These triggers provide basic logical functionality.
*1 astray
{| class="wikitable sortable" width="100%"
*2 hostile
   ! width="15%" | Name
*3 evil
   ! width="15%" | Description
|<, <=, =, !=, >, >=
   ! width="40%" | Usage
|faith
   ! width="10%" | Traits
   ! width="10%" | Supported Scopes
   ! width="10%" | Supported Targets
|-
|-
|faith_hostility_level_comparison
|always
|Compares the scoped faith's hostility level towards two other faiths.
|Always the same value
|faith_hostility_level_comparison { faith1 > faith2 }
|always = yes
|yes/no
|faith
|
|-
|fervor
|What is the faith's fervor?
|
|
|<, <=, =, !=, >, >=
|faith
|
|-
|has_allowed_gender_for_clergy
|Is the target character of the allowed gender to be clergy of the faith?
|
|
|character target
|faith
|
|-
|has_doctrine
|Does the given faith have the given doctrine?
|has_doctrine = doctrine_key
|
|faith
|
|-
|-
|has_doctrine_parameter
|AND
|Does the given faith have the given doctrine parameter? Can only check for bool parameters.
|All inside trigger must be true
|has_doctrine_parameter = parameter_key
|AND = { <triggers> }
|
|faith
|-
|has_dominant_ruling_gender
|Is the target character's gender of the dominant gender of the faith? True if there's no dominant gender
|
|
|character target
|faith
|
|-
|has_graphical_faith
|Does the faith have this graphical faith?
|<faith> = { has_graphical_faith = orthodoxgfx }
|
|faith
|
|-
|has_icon
|Does the faith have the given icon?
|has_icon = some_cool_custom_icon
|
|faith
|
|-
|has_preferred_gender_for_clergy
|Is the target character of the preferred gender to be clergy of the faith?
|
|character target
|faith
|
|-
|holy_sites_controlled
|How many holy sites does the faith control?
|holy_sites_controlled > 1
|<, <=, =, !=, >, >=
|faith
|
|-
|num_character_followers
|How many characters follow the scoped faith?
|num_character_followers > 0
|<, <=, =, !=, >, >=
|faith
|
|-
|num_county_followers
|How many counties follow the scoped faith?
|num_county_followers > 0
|<, <=, =, !=, >, >=
|faith
|
|-
|religion_tag
|Checks the tag of the religion of the current faith
|religion_tag = christianity_religion
|
|faith
|
|-
|trait_is_sin
|Does the scoped faith consider the given trait sinful?
|trait_is_sin = lustful
|
|faith
|
|-
|trait_is_virtue
|Does the scoped faith consider the given trait virtuous?
|trait_is_virtue = lustful
|
|faith
|
|-
|any_secret_knower
|Iterate through all characters who know the scoped secret
|any_secret_knower = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|secret
|character
|-
|any_secret_participant
|Iterate through participants in a secret
|any_secret_participant = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|secret
|character
|-
|can_be_exposed_by
|Can the scope secret be exposed by the target character?
|can_be_exposed_by = target
|character target
|secret
|
|-
|is_criminal_for
|Is this secret criminal for the target participant?
|is_criminal_for = <character>
|character scope
|secret
|character
|-
|is_known_by
|Is the scoped secret known by the target character?
|
|
|character target
|secret
|
|-
|is_shunned_for
|Is this secret shunned for the target participant?
|is_shunned_for = <character>
|character scope
|secret
|character
|-
|is_shunned_or_criminal_for
|Is this secret shunned or criminal for the target participant?
|is_shunned_or_illegal_for = <character>
|character scope
|secret
|character
|-
|is_spent_by
|Has the scoped secret been spent by the target character?
|is_spent_by = target
|character target
|secret
|
|-
|-
|local_player_knows_this_secret
|OR
|Does the local player know about the secret?
|At least one entry inside trigger must be true
|An interface trigger, can only be used in specific places
|OR = { <triggers> }
|yes/no
|secret
|
|-
|same_secret_type_as
|Is the scoped secret of the same type as the target secret?
|same_secret_type_as = scope:some_secret
|
|secret
|
|-
|secret_type
|Is the scoped secret of the specified type?
|
|
|
|secret
|
|-
|available_loot
|How much gold is available to loot for raiding armies?
|available_loot >= 7
|<, <=, =, !=, >, >=
|province
|
|-
|building_slots
|How many building slots exist (including occupied ones)?
|building_slots > 3
|<, <=, =, !=, >, >=
|province
|
|-
|combined_building_level
|How many levels of normal buildings are there? Duchy and such buildings do not count. Building under construction does not count. The capital building does count
|combined_building_level > 10
|<, <=, =, !=, >, >=
|province
|
|-
|fort_level
|Compares the fort level of a province
|
|
|<, <=, =, !=, >, >=
|province
|
|-
|free_building_slots
|How many free building slots exist? A building under construction is considered to be taking a slot
|free_building_slots > 3
|<, <=, =, !=, >, >=
|province
|
|-
|geographical_region
|Checks if a province is in a certain geographical region
|
|
|
|province
|
|-
|-
|has_building
|NOT
|Does the scoped province have a particular building?
|Negates content of trigger
| has_building = temple_01
|NOT = { <triggers> }
|
|province
|
|-
|has_building_or_higher
|Does the scoped province have a particular building or one of its upgrades?
| has_building_or_higher = temple_01
|
|province
|
|-
|has_building_with_flag
|Does the scoped province have a building with a certain flag?
|
*has_building_with_flag = { flag = temple count >= 2 }
*has_building_with_flag = temple # count >= 1
|
|province
|
|-
|has_construction_with_flag
|Does the scoped province have a construction of a building with the specified flag?
|has_construction_with_flag = temple
|
|province
|
|-
|has_free_building_slot
|Does the scoped province have a free building slot?
|has_free_building_slot = yes
|yes/no
|province
|
|-
|has_holding_type
|Does the scope province have a holding of particular type?
|has_holding_type = castle_holding
|
|province
|
|-
|has_ongoing_construction
|Does the scoped province have a construction ongoing?
|has_ongoing_construction = yes
|yes/no
|province
|
|-
|has_province_modifier
|Does the scoped province have a given modifier?
|has_province_modifier = name
|
|province
|
|-
|has_province_modifier_duration_remaining
|Does the scoped province have the duration remaining on a given modifier?
|has_province_modifier_duration_remaining = name
|
|province
|
|-
|has_special_building
|Does the province (holding) have a special building?
|
|yes/no
|province
|
|-
|has_special_building_slot
|Does the province (holding) have a special building slot?
|
|yes/no
|province
|
|-
|is_coastal
|is the province a coastal province?
|
|yes/no
|province
|
|-
|is_county_capital
|Is the province the county capital?
|
|yes/no
|province
|
|-
|monthly_income
|Check the income of the scoped province
|monthly_income > 10
|<, <=, =, !=, >, >=
|province
|
|-
|num_buildings
|How many normal buildings are there? Duchy and such buildings do not count. A building under construction does count
|num_buildings > 3
|<, <=, =, !=, >, >=
|province
|
|-
|number_of_characters_in_pool
|Check the number of characters in the pool the scoped province is a part of
|
|
|<, <=, =, !=, >, >=
|province
|
|-
|terrain
|Checks if a province is of a specific terrain type
|
|
|province
|
|-
|any_leased_title
|Iterate through all titles leased to the scoped holy order
|any_leased_title = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|holy order
|landed title
|-
|num_leased_titles
|How many holdings the holy order has under lease
|
|
|<, <=, =, !=, >, >=
|holy order
|
|-
|activity_has_been_activated
|Is the activity activated?
|
|
|yes/no
|activity
|
|-
|any_activity_declined
|Iterate through all characters who declined an activity invite to a specific activity
|any_activity_declined = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|activity
|character
|-
|any_activity_invited
|Iterate through all characters who have unanswered invites to a specific activity
|any_activity_invited = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|activity
|character
|-
|-
|any_participant
|NOR
|Iterate through all participants in an activity
|A negated OR trigger
|any_participant = { <count=num/all> / <percent=fixed_point> <triggers> }
|NOR = { <triggers> }
|
|activity
|character
|-
|is_target_participating
|Is the target character participating in the scoped activity?
|
|
|character target
|activity
|
|-
|number_of_participants
|The number of activity participants (including the owner)
|
|
|<, <=, =, !=, >, >=
|activity
|
|-
|any_target_title
|Iterate through all casus belli's target titles
|any_target_title = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|casus belli
|landed title
|-
|army_is_moving
|Is this army moving?
|
|yes/no
|army
|
|-
|army_max_size
|What is this army's max size?
|
|<, <=, =, !=, >, >=
|army
|
|-
|army_size
|what size is this army?
|
|<, <=, =, !=, >, >=
|army
|
|-
|is_army_in_combat
|Is the scoped army in combat?
|
|yes/no
|army
|
|-
|is_army_in_raid
|Is the scoped army in a raid (this includes a raid interrupted by combat)?
|
|yes/no
|army
|
|-
|is_army_in_siege
|Is the scoped army in a siege (this includes a siege interrupted by combat)?
|
|
|yes/no
|army
|
|-
|-
|is_army_in_siege_relevant_for
|NAND
|Is the scoped army in a siege that is relevant to the target character?
|A negated AND trigger
|is_army_in_siege_relevant_for = scope:character
|NAND = { <triggers> }
|character scope
|army
|character
|-
|is_raid_army
|Is the scoped army a raid army?
|
|
|yes/no
|army
|
|-
|raid_loot
|How much raid loot is the army carrying?
|
|
|<, <=, =, !=, >, >=
|army
|
|-
|building_garrison
|The amount of garrison in a county or province from buildings
|levies > 100
|<, <=, =, !=, >, >=
|landed title, province
|
|-
|building_levies
|The amount of levies in a county or province from buildings
|levies > 100
|<, <=, =, !=, >, >=
|landed title, province
|
|-
|squared_distance
|How far away is the province/barony/county from the target? Measured in map pixels. Squared for performance reasons (square root is expensive). squared_distance = { target = some province/barony/county value > 10000 }
|
|
|<, <=, =, !=, >, >=
|landed title, province
|
|-
|add_to_temporary_list
|Saves a temporary target for use during the trigger execution
|This is used to build lists in triggers.
If used within an any-trigger, placement within the trigger is quite important. The game will iterate through every instance of the any-trigger until it finds a single instance that fulfills the requirements, and then it will stop.
In order to add every instance of a scope that fulfills certain conditions, use "count = all" while also placing this "effect" at the very end of the any-trigger (so that every condition is evaluated for every iteration).
|
|none
|
|-
|-
|all_false
|all_false
|True if all children are false (equivalent to NOR)
|True if all children are false (equivalent to NOR)
|all_false = { <triggers> }
|
|
|
|
|none
|
|-
|always
|Always the same value
|always = yes is true, always = no is false
|yes/no
|none
|
|-
|and
|True if all children are true (this is the default for most lists of triggers).
|
|
|
|none
|
|-
|any_barony
|Iterate through all baronies in the game
|any_barony = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|none
|landed title
|-
|any_county
|Iterate through all counties in the game
|any_county = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|none
|landed title
|-
|any_county_in_region
|Iterate through all counties in the region. Put 'region = region_name' inside it
|any_county_in_region = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|none
|landed title
|-
|any_duchy
|Iterate through all duchies in the game
|any_duchy = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|none
|landed title
|-
|any_empire
|Iterate through all empires in the game
|any_empire = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|none
|landed title
|-
|-
|any_false
|any_false
|True if any child is false (equivalent to NAND)
|True if any child is false (equivalent to NAND)
|any_false = { <triggers> }
|
|
|
|none
|
|-
|any_in_global_list
|Iterate through all items in global list. list = name or variable = name
|any_in_global_list = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|none
|
|-
|any_in_list
|Iterate through all items in list. list = name or variable = name
|any_in_list = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|none
|
|-
|any_in_local_list
|Iterate through all items in local list. list = name or variable = name
|any_in_local_list = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|none
|
|-
|any_independent_ruler
|Iterate through independent rulers of count tier or above
|any_independent_ruler = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|none
|character
|-
|any_kingdom
|Iterate through all kingdoms in the game
|any_kingdom = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|none
|landed title
|-
|any_living_character
|Iterate through all living characters
|any_living_character = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|none
|character
|-
|any_player
|Iterate through all player characters
|any_player = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|none
|character
|-
|any_pool_character
|Iterate through all characters in the pool of the given province
|any_pool_character = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|none
|character
|-
|any_province
|Iterate through all provinces (skips non-land and impassable provinces)
|any_province = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|none
|province
|-
|any_religion_global
|Iterate through all religions in the game
|any_religion_global = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|none
|religion
|-
|any_ruler
|Iterate through all rulers of count tier or above
|any_ruler = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|none
|character
|-
|assert_if
|Conditionally cause an assert during run time
|assert_if = { limit = { X } text = Y }, where X is a trigger and Y is an optional string
|
|none
|
|-
|assert_read
|Conditionally cause an assert during read time
|assert_read = X, where X is yes or the string to be printed in the assert
|
|none
|
|-
|calc_true_if
|Returns true if the specified number of sub-triggers return true
|calc_true_if = { amount = 2 <trigger> <trigger> <trigger> }
|
|none
|
|-
|can_start_tutorial_lesson
|Can the specified tutorial lesson be started?
|can_start_tutorial_lesson = reactive_advice_succession
An interface trigger, can only be used in specific places
|
|none
|
|-
|current_computer_date
|Compare the current computer date.
|An interface trigger, can only be used in specific places
|<, =, > valid date
|none
|
|-
|current_computer_date_day
|Compare the current computer day.
|An interface trigger, can only be used in specific places
|<, <=, =, !=, >, >=
|none
|
|-
|current_computer_date_month
|Compare the current computer month.
|An interface trigger, can only be used in specific places
|<, <=, =, !=, >, >=
|none
|
|-
|current_computer_date_year
|Compare the current computer year.
|An interface trigger, can only be used in specific places
|<, <=, =, !=, >, >=
|none
|
|-
|current_date
|Compare the current ingame date.
|
|<, =, > valid date
|none
|
|-
|current_month
|Compare the current ingame month (1..12)
|
|
|<, <=, =, !=, >, >=
|none
|
|-
|current_tooltip_depth
|What is number of tooltips open rigth now?
|An interface trigger, can only be used in specific places
|<, <=, =, !=, >, >=
|none
|
|-
|custom_description
|Wraps triggers that get a custom description instead of the auto-generated one
|custom_description = {
text = <trigger_localization_key>
subject = <optional subject scope> #defaults to current scope
object = <optional object scope>
value = <optional script value>
... triggers ...
}
|
|none
|
|-
|custom_tooltip
|Replaces the tooltips for the enclosed triggers with a custom text
|custom_tooltip = {
text = <text>
<trigger>
}
|
|none
|
|-
|debug_only
|Checks if the game is in debug mode or not.
|
|
|yes/no
|none
|
|-
|-
|exists
|switch
|Checks whether the specified socope target exists (check for not being the null object)
|Switch on a trigger for the evaluation of another trigger with an optional fallback trigger
|exists = from.owner.var:cool_var.mother
|switch = {
|
trigger = simple_assign_trigger
|none
|
|-
|game_start_date
|Compare the date of the bookmarked game launched.
|
|<, =, > valid date
|none
|
|-
|global_variable_list_size
|Checks the size of a variable list
|variable_list_size = { name = X value >= Y }
* X is the name of the variable
* Y is a script value or number
|
|none
|
|-
|has_dlc
|Does the host have this DLC?
|
|
|none
|
|-
|has_game_rule
|Is the given game rule setting enabled?
|has_game_rule = faster_conversion
|
|none
|
|-
|has_global_variable
|Checks whether the current scope has the specified variable set
|has_variable = name
|
|none
|
|-
|has_global_variable_list
|Checks whether the current scope has the specified variable list set
|has_variable_list = name
|
|none
|
|-
|has_local_variable
|Checks whether the current scope has the specified variable set
|has_variable = name
|
|none
|
|-
|has_local_variable_list
|Checks whether the current scope has the specified variable list set
|has_variable_list = name
|
|none
|
|-
|has_map_mode
|Checks if the current map mode is the specified one
|has_map_mode = realms


An interface trigger, can only be used in specific places
case_1 = { <triggers> }
|
|none
|
|-
|has_multiple_players
|Does the game have at least two players currently connected?
|
|yes/no
|none
|
|-
|has_variable
|Checks whether the current scope has the specified variable set
|has_variable = name
|
|none
|
|-
|has_variable_list
|Checks whether the current scope has the specified variable list set
|has_variable_list = name
|
|none
|
|-
|has_war_result_message_with_outcome
|Is there a war result message with the specified outcome?
|has_war_result_message_with_outcome = victory/defeat/white_peace/invalidated/any


An interface trigger, can only be used in specific places
case_2 = { <triggers> }
|
|none
|
|-
|is_bad_nickname
|Is the nickname bad?
|
|
|none
|
|-
|is_frontend_character_selected
|is the specified front end character selected (also can be used with "= yes" and "= no")?
|An interface trigger, can only be used in specific places
|
|none
|
|-
|is_game_view_open
|is the specified in-game view open?
|An interface trigger, can only be used in specific places
|
|none
|
|-
|is_gamestate_tutorial_active
|Is the gamestate tutorial active? See save_progress_in_gamestate in tutorial_lesson_chains documentation.
|An interface trigger, can only be used in specific places
|yes/no
|none
|
|-
|is_in_list
|Checks if a target in in a list
|
|
|none
|
|-
|is_player_selected
|is the player playing a character?
|An interface trigger, can only be used in specific places
|yes/no
|none
|
|-
|is_target_in_global_variable_list
|Checks if a target is in a variable list
|is_target_in_variable_list = { name = X target = Y }
* X is the name of the variable
* Y is an event target
|
|none
|
|-
|is_target_in_local_variable_list
|Checks if a target is in a variable list
|is_target_in_variable_list = { name = X target = Y }
* X is the name of the variable
* Y is an event target
|
|none
|
|-
|is_target_in_variable_list
|Checks if a target is in a variable list
|is_target_in_variable_list = { name = X target = Y }
* X is the name of the variable
* Y is an event target
|
|none
|
|-
|is_tooltip_with_name_open
|Is the tooltip with the specified name open?
|An interface trigger, can only be used in specific places
|
|none
|
|-
|is_tutorial_active
|Is the tutorial active?
|An interface trigger, can only be used in specific places
|yes/no
|none
|
|-
|is_tutorial_lesson_active
|Is this the current tutorial lesson?
|is_tutorial_lesson_active = reactive_advice_succession


An interface trigger, can only be used in specific places
case_n = { <triggers> }
|
|none
|
|-
|is_tutorial_lesson_chain_completed
|Has the tutorial lesson chain with the specified key been finished?
|An interface trigger, can only be used in specific places
|
|none
|
|-
|is_tutorial_lesson_completed
|has the tutorial lesson with the specified name been finished?
|An interface trigger, can only be used in specific places
|
|none
|
|-
|is_tutorial_lesson_step_completed
|Has the tutorial lesson step been finished?
|is_tutorial_lesson_step_completed = lesson_key:step_key


An interface trigger, can only be used in specific places
fallback = { <triggers> }
|
|none
|
|-
|is_war_overview_tab_open
|is the war overview open at a specified tab (victory, defeat, white_peace)?
|An interface trigger, can only be used in specific places
|
|none
|
|-
|is_widget_open
|is the widget with the specified name open?
|Separting strings with dots will search for specific children of children e.g. appa.foo vs baz.foo


An interface trigger, can only be used in specific places
}
|
|none
|
|-
|list_size
|Checks the size of a list
|list_size = { name = X value >= Y }
* X is the name of the list
* Y is a script value
|<, <=, =, !=, >, >=
|none
|
|-
|local_variable_list_size
|Checks the size of a variable list
|variable_list_size = { name = X value >= Y }
* X is the name of the variable
* Y is a script value or number
|
|none
|
|-
|monarchs_journey_unlock
|
|An interface trigger, can only be used in specific places
|
|none
|
|-
|nand
|a negated AND trigger
|
|
|none
|
|-
|nor
|a negated OR trigger
|
|
|
|none
|
|-
|not
|Negates content of trigger
|
|
|
|none
|
|-
|or
|True if any of the children is true
|
|
|
|none
|
|-
|release_only
|Checks if the game is in release mode or not.
|
|yes/no
|none
|
|-
|save_temporary_scope_as
|Saves a temporary target for use during the trigger execution
|
|
|none
|
|-
|save_temporary_scope_value_as
|Saves a numerical or bool value as an arbitrarily-named temporary target to be referenced later in the same effect
|save_temporary_scope_value_as = { name = <string> value = x }
|
|none
|
|-
|scripted_tests
|Checks if the game is currently running scripted tests.
|
|yes/no
|none
|
|-
|switch
|Switch on a trigger for the evaluation of another trigger with an optional fallback trigger.
|switch = {
trigger = simple_assign_trigger
case_1 = { <triggers> }
case_2 = { <triggers> }
case_n = { <triggers> }
fallback = { <triggers> }
|
|none
|
|-
|time_of_year
|Check if the current date is within the bounds
|time_of_year = {
   min = 11.1 # default: beginning of year
   max = 2.29 # default: end of year
}
Dates are formatted as "<month>.<day>" or just "<month>".
The check includes the min and max dates.
min can be larger than max, in this case we wrap around to the next year (i.e., February is between October and March).
|
|none
|
|-
|trigger_else
|Evaluates the triggers if the display_triggers of preceding 'trigger_if' or 'trigger_else_if' is not mettrigger_if = { limit = { <display_triggers> } <triggers> }
| trigger_else = { <triggers> }
|
|none
|
|-
|trigger_else_if
|Evaluates the enclosed triggers if the display_triggers of the preceding `trigger_if` or `trigger_else_if` is not met and its own display_trigger of the limit is mettrigger_if = { limit = { <display_triggers> } <triggers> }
|trigger_else_if = { limit = { <display_triggers> } <triggers> }
|
|none
|
|-
|-
|trigger_if
|trigger_if
|Evaluates the triggers if the display_triggers of the limit are met
|Evaluates the triggers if the display_triggers of the limit are met
|trigger_if = { limit = { <display_triggers> } <triggers> }
|trigger_if = { limit = { <display_triggers> } <triggers> }
|
|none
|
|-
|variable_list_size
|Checks the size of a variable list
|variable_list_size = { name = X value >= Y }
* X is the name of the variable
* Y is a script value or number
|
|none
|
|-
|weighted_calc_true_if
|Returns true if the sum of weights of fulfilled sub-triggers amount to the specified sum
|weighted_calc_true_if = { amount = 10 5 = { <trigger> } 15 = { <trigger> } 7 = { <trigger> } }
|
|none
|
|-
|years_from_game_start
|How many years it has been since the start of the game
|years_from_game_start > 5
|<, <=, =, !=, >, >=
|none
|
|-
|in_color_list
|Check if the scoped color is part of the given color list
|
|
|
|color
|
|-
|is_color
|Check if the scoped color is the same as another color. The right hand side can be either a hex, rgb, or hsv color,  or a named color, or another color scope.
|
|
|
|color
|
|-
|any_side_commander
|Iterate through all commanders (the commanders of every army on the side, not just the one leading the battle)
|any_side_commander = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|combat side
|character
|-
|any_side_knight
|Iterate through all knights
|any_side_knight = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|combat side
|character
|-
|has_maa_of_type
|Does this combat side have at least one regiment of men at arms of the given type?
|has_maa_of_type = onager
|
|combat side
|
|-
|is_combat_side_attacker
|Was the combat side the attacker?
|
|
|yes/no
|combat side
|
|-
|-
|is_combat_side_pursuing
|trigger_else_if
|Is this side the winner of the combat?
|Evaluates the enclosed triggers if the display_triggers of the preceding `trigger_if` or `trigger_else_if` is not met and its own display_trigger of the limit is met
|trigger_if = { limit = { <display_triggers> } <triggers> }
trigger_else_if = { limit = { <display_triggers> } <triggers> }
|
|
|yes/no
|combat side
|
|-
|is_combat_side_retreating
|Is this side defeated in the combat?
|
|
|yes/no
|combat side
|
|-
|side_soldiers
|How many soldiers does this side have still fighting?
|
|
|<, <=, =, !=, >, >=
|combat side
|
|-
|-
|side_strength
|trigger_else
|How strong is this side (based on soldiers still fighting)? Scaled down by a factor of 1000 so it doesn't get too large to do math on
|Evaluates the triggers if the display_triggers of preceding 'trigger_if' or 'trigger_else_if' is not met
|
|trigger_if = { limit = { <display_triggers> } <triggers> }
|<, <=, =, !=, >, >=
trigger_else = { <triggers> }
|combat side
|
|-
|any_pledged_attacker
|Iterate through all pledged attackers within a great holy war
|any_pledged_attacker = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|great holy war
|character
|-
|any_pledged_defender
|Iterate through all pledged defenders within a great holy war
|any_pledged_defender = { <count=num/all> / <percent=fixed_point> <triggers> }
|
|great holy war
|character
|-
|days_until_ghw_launch
|How many days is it until the given GHW launches?
|
|
|<, <=, =, !=, >, >=
|great holy war
|
|-
|ghw_attackers_strength
|What is the max (if all levies were fully reinforced) military strength of the pledged attackers in the given hreat holy war?
|
|
|<, <=, =, !=, >, >=
|great holy war
|
|-
|ghw_defenders_strength
|What is the max (if all levies were fully reinforced) military strength of the pledged defenders in the given great holy war?
|
|<, <=, =, !=, >, >=
|great holy war
|
|-
|has_forced_defender
|Is the target character forced to be a defender in the given great holy war?
|
|character scope
|great holy war
|character
|-
|has_pledged_attacker
|Is the target character pledged as an attacker in the given great holy war?
|
|character scope
|great holy war
|character
|-
|has_pledged_defender
|Is the target character pledged as a defender in the given great holy war?
|
|character scope
|great holy war
|character
|-
|is_directed_ghw
|Is the scoped GHW a directed GHW?
|
|yes/no
|great holy war
|
|-
|war_chest_gold
|How much gold is in the great holy war's war chest?
|
|<, <=, =, !=, >, >=
|great holy war
|
|-
|war_chest_piety
|How much piety is in the great holy war's war chest?
|
|<, <=, =, !=, >, >=
|great holy war
|
|-
|war_chest_prestige
|How much prestige is in the great holy war's war chest?
|
|<, <=, =, !=, >, >=
|great holy war
|
|
|}
|}
== References ==


{{Modding navbox}}
{{Modding navbox}}
[[Category: 模组制作]]
[[Category:Modding]]
[[en:Triggers]]

2025年7月26日 (六) 16:57的最新版本

A trigger is a check that returns true or false for the scope where it's used.

For example, is_ai = yes would return true for an AI character, and false for a player.

This could be used to disable an event for a player, by using it in a trigger block of an event.

Triggers that compare values can also return the value itself.

For example, add_gold = gold would add the same amount of gold that the character currently has.

The full list of available code triggers can be found in triggers.log.

Run script_docs console command in the game and find the log in Documents\Paradox Interactive\Crusader Kings III\logs.

Trigger blocks[编辑 | 编辑源代码]

Triggers are used in trigger script blocks.

Those usually are either explicitly named so, like an event's trigger = { } block, or their name are questions which can be answered by yes or no, like a decision's is_shown = { } and is_valid = { }.

In some cases, triggers are used in hybrid script blocks that accept triggers amongst other things.

Ex: weight modifier

modifier = {
   is_ai = yes
   factor = 0
}

In this block, is_ai = no is a trigger, but factor = 0 is an operator.

Early out[编辑 | 编辑源代码]

Unless they are being tooltipped, trigger blocks operate on the so-called "early out" principle.

For a trigger block to be true, all triggers within must be true. "early out" means that as soon as a trigger in the block is evaluated as false, the rest of the triggers in that block are not evaluated.

This is useful to avoid errors.

Ex: the following trigger block checks that the current character scope's primary spouse has the same culture as them. To avoid errors, it first checks that the character `has` a spouse to begin with.

trigger = {
   exists = primary_spouse
   culture = primary_spouse.culture
}

If exists = primary_spouse is false, the second trigger is not evaluated.

It is also useful for performance optimization. In a trigger block containing multiple triggers, putting the ones most likely to fail first can significantly reduce the number of triggers checked overall.

Ex: this trigger block checks that the current character scope is a player and an independent ruler.

trigger = {
   is_ai = no
   is_independent_ruler = yes
}

If this trigger block is evaluated once a year for each character in the game, since most characters in the game are not players, is_ai = no will almost always be false, and the 2nd trigger will almost never be evaluated at all.

Logic blocks[编辑 | 编辑源代码]

Trigger blocks can contain several triggers. By default, if all of them are true, the trigger block as a whole is true, but some logic blocks can manipulate that logic.

AND[编辑 | 编辑源代码]

AND = {
   is_ai = no
   is_independent_ruler = yes
}

The AND block is true if the current character both is a player and an independent ruler.

OR[编辑 | 编辑源代码]

OR = {
   is_ai = no
   is_independent_ruler = yes
}

The OR block is true if the current character scope is either a player `or` an independent ruler.

NOT/NOR/NAND[编辑 | 编辑源代码]

NOT = { has_title = title:k_france }

The NOT block is true if the current character scope does not hold the Kingdom of France.

To avoid ambiguity, NOT should only contain a single trigger. For multiple triggers, using NOR or NAND makes the intent clear.

NAND = {
   has_title = title:k_france
   has_title = title:k_aquitaine
}

The NAND block is true if the current character scope holds either the Kingdom of France or the Kingdom of Aquitaine or neither of the two. It is false if they hold both titles.

NOR = {
   has_title = title:k_france
   has_title = title:k_aquitaine
}

The NOR block is true if the current character scope holds neither the Kingdom of France nor the Kingdom of Aquitaine. It is false if they hold either of the titles.

Limit blocks[编辑 | 编辑源代码]

The limit block is used for conditional effects and triggers.

if/else_if[编辑 | 编辑源代码]

The most common use of the limit block is with the if/else_if effects, to execute effects only if the limit block is true.

Ex: this effect adds gold to the current character scope if they are a player.

if = {
   limit = { is_ai = no }
   add_gold = 100
}

effect list-builders[编辑 | 编辑源代码]

Limit blocks are also commonly used to restrict effect list builders.

Ex: this effect adds gold to the current character scope's children if they are male

every_child = {
   limit = { is_male = yes }
   add_gold = 100
}

Note: the any_X list-builder does not use a limit block.

trigger_if/trigger_else_if/trigger_else[编辑 | 编辑源代码]

trigger_if can be used to check a trigger only if the limit block is true.

Ex: if the current character scope is not an ai, this trigger checks whether they are an independent ruler

trigger_if = {
   limit = { is_ai = no }
   is_independent_ruler = yes
}

Conditional triggers are often used in tooltipped trigger blocks both for legibility and to avoid errors, because when tooltipped, early-out does not apply.

Ex: this trigger, when tooltipped, would throw an error when primary_spouse does not exist.

trigger = {
   exists = primary_spouse
   culture = primary_spouse.culture
}

but this would not throw an error, because if the limit block is false, the trigger is not evaluated.

trigger_if = {
   limit = { exists = primary_spouse }
   culture = primary_spouse.culture
}

Trigger syntax[编辑 | 编辑源代码]

Scope comparison[编辑 | 编辑源代码]

A scope comparison is a statement with two scopes on either side of an = sign. It is true if both objects are the same, and false otherwise.

Scopes in a scope comparison can be database scopes, event targets, saved scopes or variables.

Note: even if both scopes are not the same objects, they do need to be of the same scope type.

Ex: this trigger checks whether whoever holds the kingdom of France is the same character as the father of the current character scope.

title:k_france.holder = father

In a scope comparison, both sides need to be valid. In this example, the current character must have a father, and the Kingdom of France must be created, otherwise the scope comparison throws an error in the error log, so the existence of both scopes needs to be checked at some point before the comparison is made.

The existence of the scope on the left-hand side of the comparison itself by using ?=:

title:k_france.holder ?= father

Value comparison[编辑 | 编辑源代码]

A value comparison is a statement with two numerical values on either side of either

  • an equal sign =
  • a comparison symbol
    • strictly greater than >
    • greater than or equal to >=
    • lower than <
    • lower than or equal to <=

It is true if the comparison is mathematically correct.

Numerical values in a value comparison can be:

Ex: this trigger checks whether the current character scope's gold is strictly greater than 1000.

gold > 1000

Code triggers[编辑 | 编辑源代码]

Code triggers have a predetermined syntax. They usually require a specific scope type context to work.

Code triggers can take several forms:

Basic triggers[编辑 | 编辑源代码]

Basic triggers check whether the statement has the expected positive or negative result.

Ex: this trigger is true if the current character scope is not an AI. is_ai = no

Simple triggers[编辑 | 编辑源代码]

Simple triggers check whether they are true depending on the argument provided on the right hand side of the = sign.

The argument is either:

  • a scope

Ex: this trigger checks whether the current character scope is a vassal of the saved scope scope:actor.

is_vassal_of = scope:actor
  • a database key

Ex: this trigger checks whether the current character scope has the trait defined with the infirm key.

has_trait = infirm

Complex triggers[编辑 | 编辑源代码]

Complex triggers use several parameters in a script block. Those parameters can be a scope, a database key, a numerical value or a flag value.

Ex: this trigger checks whether the current character scope has an active scheme of the murder type targeting their liege.

is_scheming_against = {
  target = liege
  type = murder
}

Some code triggers have both a simple form and a complex form.

In-line complex triggers[编辑 | 编辑源代码]

Some complex triggers can be written in one line to return a value.

It is written in quotation marks, with the additional argument in brackets.

For example, a script value would look like this:

distance_to_liege_sval = {
  value = "realm_to_title_distance_squared(liege.capital_county)"
}

This feature is not documented and doesn't work with all triggers. From testing, it seems to only support triggers with this line in their description: Traits: <, <=, =, !=, >, >=

If a trigger has multiple arguments, like has_trait_xp which requires trait and track, they are added with a |

value = "has_trait_xp(lifestyle_traveler|danger)"

So far, this is the only known trigger with this multi-argument syntax.

scripted_triggers[编辑 | 编辑源代码]

Scripted_triggers are macros that enable replacing a set of triggers with a single statement, to make script more legible and avoid repetition.

They are usually defined in common/scripted_triggers, and can then be used anywhere triggers are allowed.

They are sometimes defined locally in event files (see events), in which case they can only be used in events from the same file.

Basic scripted_triggers[编辑 | 编辑源代码]

Simple scripted_triggers check whether a predetermined set of triggers is evaluated as a whole as true (= yes) or false (= no).

Ex: if the following set of triggers is repeatedly used to check whether a character is a rich adult independent ruler:

is_independent_ruler = yes
is_adult = yes
gold > 1000

instead of repeating the same set of triggers in different places, they can be defined as a scripted_trigger:

is_rich_adult_independent_ruler = {
   is_adult = yes
   is_independent_ruler = yes
   gold > 1000
}

and anywhere that set of triggers needs to be checked, it can be replaced by the following statement: is_rich_adult_independent_ruler = yes

Using the negative version

is_rich_adult_independent_ruler = no

is the same as using a NOT logic block

NOT = { is_rich_adult_independent_ruler = yes }

Because scripted_triggers can be used in a variety of different contexts, it is advised not to use in their definition ambiguous event targets such as root or prev.

Complex scripted_triggers[编辑 | 编辑源代码]

Scripted_triggers can also have a complex form that handles literal text replacement, allowing to pass arguments.

For example, if the following set of triggers are used to check that the current character scope is a vassal of the King of France and related to them:

is_vassal_of = title:k_france.holder
is_close_family_of = title:k_france.holder

that set of triggers can be defined as a scripted_trigger, but instead of referencing title:k_france.holder specifically, the scripted_trigger uses an argument defined in uppercase letters wrapped in two $ signs:

is_related_vassal_of = {
   is_vassal_of = $TARGET$
   is_close_family_of = $TARGET$
}

When used, the complex form of the scripted_trigger specifies what the expected argument is, by using the same name but without the $ signs:

is_related_vassal_of = {
   TARGET = title:k_france.holder
}

With that form, every occurrence of $TARGET$ in the scripted_trigger will be literally replaced with the argument provided: the text replacement happens before the scripted_trigger is evaluated.

Logical Operators/Triggers[编辑 | 编辑源代码]

These triggers provide basic logical functionality.

Name Description Usage Traits Supported Scopes Supported Targets
always Always the same value always = yes yes/no
AND All inside trigger must be true AND = { <triggers> }
OR At least one entry inside trigger must be true OR = { <triggers> }
NOT Negates content of trigger NOT = { <triggers> }
NOR A negated OR trigger NOR = { <triggers> }
NAND A negated AND trigger NAND = { <triggers> }
all_false True if all children are false (equivalent to NOR) all_false = { <triggers> }
any_false True if any child is false (equivalent to NAND) any_false = { <triggers> }
switch Switch on a trigger for the evaluation of another trigger with an optional fallback trigger switch = {

trigger = simple_assign_trigger

case_1 = { <triggers> }

case_2 = { <triggers> }

case_n = { <triggers> }

fallback = { <triggers> }

}

trigger_if Evaluates the triggers if the display_triggers of the limit are met trigger_if = { limit = { <display_triggers> } <triggers> }
trigger_else_if Evaluates the enclosed triggers if the display_triggers of the preceding `trigger_if` or `trigger_else_if` is not met and its own display_trigger of the limit is met trigger_if = { limit = { <display_triggers> } <triggers> }

trigger_else_if = { limit = { <display_triggers> } <triggers> }

trigger_else Evaluates the triggers if the display_triggers of preceding 'trigger_if' or 'trigger_else_if' is not met trigger_if = { limit = { <display_triggers> } <triggers> }

trigger_else = { <triggers> }

References[编辑 | 编辑源代码]