执行:修订间差异

本页面所适用的版本可能已经过时,最后更新于1.12
无编辑摘要
无编辑摘要
第1行: 第1行:
{{Version|1.12}}
{{Version|1.12}}


On actions are blocks that are executed when a certain action occurs, such as a country declaring war on a different country or a state changing control. On actions are stored in {{path|common/on_actions/*.txt}} files.
代码在一个特定的行动发生后被执行,例如当一个国家向另一个国家宣战或者当一个省份变更控制权时触发某种效果。On actions 被定义在 {{path|common/on_actions/*.txt}} 文件中。


__TOC__
__TOC__


Each on action is a separate block within the <code>on_actions = { ... }</code> block, which is the root block of the on actions file. Each on_action has up to 2 arguments:
每一个on action 都是一个被包含在<code>on_actions = { ... }</code> 代码中,也就是on actions 文件的根代码块中的独立代码块。每一个on_action最多有2个参数:
* <code>effect = { ... }</code> is present for every single on action, being an effect block the insides of which are executed when needed.
* <code>effect = { ... }</code> 存在于每一个单独的on action 中,在需要时作为一个效果执行内效果代码。
* <code>random_events = { ... }</code> is present for on_actions where the default scope (Same as ROOT, if not specified otherwise) is a country, such as on_new_term_election. This instantly fires a random one of the specified events within with the given weights being applied. This is done with a [[wp:Sampling_(statistics)#Probability-proportional-to-size_sampling|probability-proportional-to-size sampling]] approach.
* <code>random_events = { ... }</code> 用于on_actions中,其默认作用域(如果没有另行指定,则与ROOT相同)是一个国家,例如<code>on_new_term_election</code>。这将立即随机触发给定权重的指定事件中的事件之一。这是通过概率与权重成正比的随机方法完成的。
: Putting <code>0</code> instead of an event ID will ensure that nothing will happen if the chance lands on this.
: <code>0</code> 代替事件ID将确保如果随机到该事件时不会有任何事情发生。
: Additionally, an event cannot be fired using <code>random_events = { ... }</code> if the event's <code>trigger = { ... }</code> block evaluates as false. In this case, each scope is treated the same as on action's: on action's FROM is treated as the event's FROM, same with FROM.FROM.
: 另外,当一个事件的<code>trigger = { ... }</code> 代码块计算结果为false(即不满足触发条件)时,该事件不会被<code>random_events = { ... }</code> 触发。在这种情况下,每个作用域的处理方式与on action 的相同:on action 的FROM被视为该事件的FROM,对于<code>FROM.FROM</code>也是一样(注:FROM与上文的ROOT相同,都是指代码的[[Scopes|作用域]],但是在大部分情况下意义不同)。
: If there are multiple random_events blocks, one event will be picked from each.
: 如果存在多个<code>random_events</code>代码,将从每个块中选择一个事件。


Note that in terms of [[Scopes]], ROOT is the default assumed scope unless specified otherwise (in on_actions that have THIS as a separate entity from ROOT), while FROM and FROM.FROM can serve as secondary blocks that are provided in addition.
请注意,就[[Scopes|作用域]] 而言,ROOT是默认的假定作用域,除非另有指定( 在<code>on_actions</code>中,THIS作为一个独立于ROOT的实体) ,而FROM和FROM.FROM 可以作为另外提供的辅助块。


Each on action can only be executed after the game's start, ignoring any effects done within history files or the bookmark's <code>effects = { ... }</code> section that normally would trigger one, such as [[Effect#set_politics|set_politics]].
每个on action 只能在游戏开始后执行,不受任何通常会触发一次的来自历史文件或剧本的<code>effects = { ... }</code> 部分的效果所影响,例如[[Effect#set_politics|set_politics]].
== File example ==
== 文件示例 ==
<pre>on_actions = {
<pre>on_actions = {
    on_startup = {
    on_startup = {
第63行: 第63行:
}</pre>
}</pre>


== General on actions ==
== 常见的on_actions代码 ==
{| class="wikitable sortable" width="100%"
{| class="wikitable sortable" width="100%"
! width="10%" | Name
! width="10%" | 名字
! width="20%" | Description
! width="20%" | 描述
! width="25%" | Examples
! width="25%" | 示例
! width="15%" | Notes
! width="15%" | 提示
! width="5%" | Version Added
! width="5%" | 版本
|-id="on_startup"
|-id="on_startup"
|on_startup
|on_startup
|Trigger the following commands at the first day of a new game, after country selection. Doesn't work with save loading.
| 在游戏开局(新的一局开始的时候)时触发一次效果。'''但是加载存档时不触发该效果。'''
|<pre>on_startup = { 
|<pre>on_startup = { 
    effect = {
    effect = {
第80行: 第80行:
    }    # Scoping into ENG is necessary, since
    }    # Scoping into ENG is necessary, since
}      # news_event is a country-scoped effect</pre>
}      # news_event is a country-scoped effect</pre>
|'''Has a default scope of <code>none</code>''', instead of firing for each country individually as in other Paradox games such as Europa Universalis IV. Many effects that usually can be used in any scope will not work, without manual [[scopes|scoping]] into countries, states, or elsewhere.
|''' 默认作用域为<code>none</code>''' ,而不是像其他P社游戏(如《欧陆风云4》)那样针对每个国家单独触发。如果没有手动将作用域划分到国家、省份或其他地方,许多通常可以在任何[[scopes| 作用域]] 内使用的效果将无法工作。
|1.3.3
|1.3.3
|-id="on_daily"
|-id="on_daily"
|on_daily
|on_daily
|Triggers each day for '''every country separately''' (performance heavy, use carefully)
| 在每一天为每个国家分别触发效果'''(对性能的影响大,请谨慎使用)。'''
|<pre>on_daily = {
|<pre>on_daily = {
    effect = {
    effect = {
第93行: 第93行:
    }
    }
}</pre>
}</pre>
|Useful for scripted guis and mods adding new mechanics (can increment a variable daily e.g.). '''Only use scoping if you're careful to avoid duplicate effects'''. This being executed for every country separately means that this is essentially equivalent to a single effect executed daily inside of every_country. e.g. <code>effect = { GER = { add_political_power = 1 } }</code> will add ~100 political power to {{flag|Germany}} daily, as there being ~100 countries on the world map means that this will get executed ~100 times per day.
| 对于scripted guis 和添加新机制的mod非常有用( 例如可以每天增加一个变量) ''' 只有在小心避免重复效果的情况下才使用该作用域。''' 在每个国家单独执行意味着本质上相当于在每个国家每一天执行一个单独的效果。例如 <code>effect = { GER = { add_political_power = 100 } }</code> 将每天增加约100政治点数到{{flag|Germany}} ,因为世界地图上有约100个国家,这意味着每天将执行约100次。
|1.5.2
|1.5.2
|-id="on_daily_TAG"
|-id="on_daily_TAG"
|on_daily_TAG
|on_daily_<TAG>
|Triggers each day for the specified country only
| 每天为指定国家触发效果'''(注:TAG就是你要指定的国家)'''
|<pre>on_daily_SOV = {
|<pre>on_daily_SOV = {
    effect = {  
    effect = {  
第106行: 第106行:
    }
    }
}</pre>
}</pre>
|Only runs the effects if the country exists.
| 只有在国家存在的前提条件下才能触发该效果,否则无效
|1.9
|1.9
|-id="on_weekly"
|-id="on_weekly"
|on_weekly
|on_weekly
|Triggers each week for every country separately
| 每周为每个国家触发一次效果
|<pre>on_weekly = {
|<pre>on_weekly = {
    effect = {
    effect = {
第123行: 第123行:
}
}
</pre>
</pre>
|Useful for ai scripting. Runs on the beginning of the day if the [[Game variables#num_days|num_days variable]] is divisible by 7.
| 对ai脚本很有用。如果<code>num_days_variable</code>能被7整除,则在这一天的开始运行。
|1.9
|1.9
|-id="on_weekly_TAG"
|-id="on_weekly_TAG"
|on_weekly_TAG
|on_weekly_<TAG>
|Triggers each week for the specified country only
| 每周为指定国家触发一次效果'''(注:TAG就是你要指定国家)'''
|<pre>on_weekly_BHR = {
|<pre>on_weekly_BHR = {
    if = {
    if = {
第141行: 第141行:
    }
    }
}</pre>
}</pre>
|Only runs the effects if the country exists. Runs on the beginning of the day if the [[Game variables#num_days|num_days variable]] is divisible by 7.
| 只有在该国家存在的情况下才执行效果。如果<code>num_days_variable</code>能被7整除,则在这一天的开始运行。
|1.9
|1.9
|-id="on_monthly"
|-id="on_monthly"
|on_monthly
|on_monthly
|Triggers each month for every country separately
| 在每月为每个国家分别触发效果。
|<pre>on_monthly = { 
|<pre>on_monthly = { 
    random_events = {
    random_events = {
第155行: 第155行:
|1.9
|1.9
|-id="on_monthly_TAG"
|-id="on_monthly_TAG"
|on_monthly_TAG
|on_monthly_<TAG>
|Triggers each month for the specified country only
| 在每月为指定国家触发一次效果'''(注:TAG就是你要指定的国家)'''。
|<pre>on_monthly_USA = {
|<pre>on_monthly_USA = {
    effect = {
    effect = {
第172行: 第172行:
    }
    }
}</pre>
}</pre>
|Only runs the effects if the country exists.
| 只有在该国家存在的前提条件下才能执行该效果,否则无效。
|1.9
|1.9
|}
|}


== Politics ==
== 政治相关 ==
{| class="wikitable sortable" width="100%"
{| class="wikitable sortable" width="100%"
! width="10%" | Name
! width="10%" | 名字
! width="20%" | Description
! width="20%" | 描述
! width="25%" | Examples
! width="25%" | 示例
! width="15%" | Notes
! width="15%" | 提示
! width="5%" | Version Added
! width="5%" | 版本
|-id="on_stage_coup"
|-id="on_stage_coup"
|on_stage_coup
|on_stage_coup
|For the non {{icon|lar|1}} stage coup. Trigger the following commands whenever a coup is stage.
| 对没有{{icon|lar|1}}DLC的国家策划政变使用,每当政变策划时,触发以下效果。
|<pre>on_stage_coup = { 
|<pre>on_stage_coup = { 
    effect = { 
    effect = { 
    }
    }
}</pre>
}</pre>
| ROOT is the country that stages the coup, FROM is the target country.
|ROOT 是策划政变的国家,FROM是目标国家。
|1.0
|1.0
|-id="on_coup_succeeded"
|-id="on_coup_succeeded"
|on_coup_succeeded
|on_coup_succeeded
|For the non {{icon|lar|1}} stage coup. Trigger the following commands whenever a coup succeeds.
| 对没有{{icon|lar|1}}DLC的国家策划政变使用,每当政变成功时,触发以下效果。
|<pre>on_coup_succeeded = { 
|<pre>on_coup_succeeded = { 
    effect = { 
    effect = { 
第206行: 第206行:
    }
    }
}</pre>
}</pre>
|ROOT is the country that coup succeeded in, FROM is the stager of the coup
|ROOT 是政变成功的国家,FROM是策划政变的国家。
|1.0
|1.0
|-id="on_government_change"
|-id="on_government_change"
|on_government_change
|on_government_change
|Trigger the following commands whenever a country switches its government.
| 每当一个国家更换政府时,触发以下效果。
|<pre>on_government_change = { effect = {  &hellip;  } }</pre>
|<pre>on_government_change = { effect = {  &hellip;  } }</pre>
|This includes <code>set_politics</code> and <code>start_civil_war</code> (always for both sides) and excludes being puppeted. Will always also trigger [[#on_ruling_party_change|on_ruling_party_change]].
| 这包括<code>set_politics</code> <code>start_civil_war</code> (总是为双方),不包括被傀儡的情况。总是同时触发[[#on_ruling_party_change|on_ruling_party_change]] 效果.
|1.0
|1.0
|-id="on_ruling_party_change"
|-id="on_ruling_party_change"
|on_ruling_party_change
|on_ruling_party_change
|Trigger the following commands whenever a country switches its ideology.
| 每当某个国家改变其意识形态时,触发以下命令。
|<pre>on_ruling_party_change = { effect = {  &hellip;  } }</pre>
|<pre>on_ruling_party_change = { effect = {  &hellip;  } }</pre>
|<code>old_ideology_token</code> is a [[Variables#Variable types|temporary variable]] that stores the old ideology as a token. Alongside what triggers [[#on_government_change|on_government_change]], also includes being puppeted or changing the ideology via a console command.
|<code>old_ideology_token</code> 是一个临时变量,,它将旧的意识形态存储为token。除了包括触发[[#on_government_change|on_government_change]] 的效果外,还包括被傀儡或通过[[Variables#Variable types| 控制台命令]] 改变意识形态的情况。
|1.9
|1.9
|-id="on_new_term_election"
|-id="on_new_term_election"
|on_new_term_election
|on_new_term_election
|Trigger the following commands whenever an election happens or is called by the '''hold_election''' command.
| 每当发生选举或被'''hold_election''' 命令调用时,触发效果。
|<pre>on_new_term_election = { random_events = { 100 = usa.6 } }</pre>
|<pre>on_new_term_election = { random_events = { 100 = usa.6 } }</pre>
|
|
第228行: 第228行:
|-id="on_peaceconference_ended"
|-id="on_peaceconference_ended"
|on_peaceconference_ended
|on_peaceconference_ended
|Trigger the following commands whenever a peace conference ends.
| 每当和平会议结束时,触发效果。
|<pre>on_peaceconference_ended = { effect = { &hellip; } }</pre>
|<pre>on_peaceconference_ended = { effect = { &hellip; } }</pre>
|ROOT is the winner, FROM is the loser. Is also triggered by the <pre>white_peace</pre> effect is used or when a conditional surrender is accepted.
|ROOT 是赢家(胜利者),FROM是输家(失败方)。也会在使用<pre>white_peace</pre> 效果或接受有条件投降时触发。
|1.5
|1.5
|-id="on_peaceconference_started"
|-id="on_peaceconference_started"
|on_peaceconference_started
|on_peaceconference_started
|Trigger the following commands whenever a peace conference starts.
| 每当和平会议开始时,触发以下命令。
|<pre>on_peaceconference_started = { effect = { &hellip; } }</pre>
|<pre>on_peaceconference_started = { effect = { &hellip; } }</pre>
|ROOT is the winner, FROM is the loser. Is also triggered by the <pre>white_peace</pre> effect is used or when a conditional surrender is accepted.
|ROOT 是赢家(胜利者),FROM是输家(失败方)。也会在使用<pre>white_peace</pre> 效果或接受有条件投降时触发。
|1.12.3
|1.12.3
|}
|}


== Diplomacy/War ==
== 外交/ 战争相关 ==
{| class="wikitable sortable" width="100%"
{| class="wikitable sortable" width="100%"
! width="10%" | Name
! width="10%" | 名字
! width="20%" | Description
! width="20%" | 描述
! width="25%" | Examples
! width="25%" | 示例
! width="15%" | Notes
! width="15%" | 提示
! width="5%" | Version Added
! width="5%" | 版本
|-id="on_send_volunteers"
|-id="on_send_volunteers"
|on_send_volunteers
|on_send_volunteers
|Trigger the following commands whenever a country send volunteers to another.
| 每当一个国家向另一个国家派遣志愿军时,触发该效果。
|<pre>on_send_volunteers = {
|<pre>on_send_volunteers = {
    effect = { &hellip; }
    effect = { &hellip; }
}</pre>
}</pre>
|ROOT is sender, FROM is receiver.
|ROOT 为派遣志愿军的国家,FROM为接收志愿军的国家。
|1.9
|1.9
<!--on_recall_volunteers isn't a real on action, despite the fact that it's listed in documentation. It's not in the binary file and trying to use it will do nothing. Note: Trying to use a non-existing on action doesn't throw an unexpected token error by itself.
<!--on_recall_volunteers isn't a real on action, despite the fact that it's listed in documentation. It's not in the binary file and trying to use it will do nothing. Note: Trying to use a non-existing on action doesn't throw an unexpected token error by itself.
第266行: 第266行:
|-id="on_border_war_lost"
|-id="on_border_war_lost"
|on_border_war_lost
|on_border_war_lost
|Trigger the following commands whenever a country loses a border war.
| 每当一个国家输掉边境战争时,触发该效果。
|<pre>on_border_war_lost = {
|<pre>on_border_war_lost = {
    effect = {
    effect = {
第274行: 第274行:
    }
    }
}</pre>
}</pre>
|"Border war" refers to the state-based border wars enabled with [[Effect#set_border_war|set_border_war]], represented with orange stripes over the state, rather than border wars that simulate combat between countries. The default scope is the state that lost the border war.
| “边境战争”是指通过[[Effect#set_border_war|set_border_war]] 效果(在省份上方用橙色条纹表示)启动的以省份为基础的边境战争,而不是模拟国与国之间战斗的边境战争。默认作用域是输掉边界战争的省份。
|1.0
|1.0
|-id="on_war_relation_added"
|-id="on_war_relation_added"
|on_war_relation_added
|on_war_relation_added
|fired when two countries end up at war with each other (on_war is fired when a country goes to war against anyone and is not fired again when it enters war against another country unless it went to peace first)
| 每当两个国家最终彼此开战时,触发该效果。(<code>on_war</code>条件效果是当一个国家将要与任意国家发生战争时触发,并且当该国家进入与另一个国家的战争时不会再次触发,除非该国家在再次进入战争前先进入和平状态)
|<pre>on_war_relation_added = {
|<pre>on_war_relation_added = {
    effect = { &hellip; }
    effect = { &hellip; }
}</pre>
}</pre>
|ROOT is attacker, FROM is defender
|ROOT 是宣战方,FROM是被宣战方。
|1.9.3
|1.9.3
|-id="on_declare_war"
|-id="on_declare_war"
|on_declare_war
|on_declare_war
|Trigger the following commands whenever a country declares war.
| 每当一个国家宣战时,触发该效果。
|<pre>on_declare_war = {
|<pre>on_declare_war = {
    effect = {
    effect = {
第298行: 第298行:
    }
    }
}</pre>
}</pre>
|FROM is war target.
|FROM 是战争目标,ROOT是宣战国。
ROOT is for the country who is declaring war
|1.0
|1.0
|-id="on_war"
|-id="on_war"
|on_war
|on_war
|Trigger the following commands whenever a country has just entered a state of war from initially being at peace.
| 每当一个国家从和平状态进入战争状态时,触发该命令。
|<pre>on_war = {
|<pre>on_war = {
    effect = { &hellip; }
    effect = { &hellip; }
}</pre>
}</pre>
|THIS is country that has just gotten into a war.
|THIS 是刚刚被卷入战争的国家。
|1.7
|1.7
|-id="on_peace"
|-id="on_peace"
|on_peace
|on_peace
|Trigger the following commands whenever a country is no longer at war.
| 每当一个国家不再处于战争状态时'''(即刚进入和平状态)''',触发该效果。
|<pre>on_peace = {
|<pre>on_peace = {
    effect = { &hellip; }
    effect = { &hellip; }
}</pre>
}</pre>
|THIS is country that is no longer at war.
|THIS 是不再处于战争状态的国家。
|1.7
|1.7
|-id="on_capitulation"
|-id="on_capitulation"
|on_capitulation
|on_capitulation
|Trigger the following commands whenever a country capitulates, in the middle of the process.
| 每当一个国家投降,在这个过程中,触发该效果。
|<pre>on_capitulation = {
|<pre>on_capitulation = {
    effect = { &hellip; }
    effect = { &hellip; }
}</pre>
}</pre>
|ROOT is capitulated country, FROM is winner. Several processes such as the deletion of units and transfer of equipment have already been executed by this point.
|ROOT 是投降方,FROM是胜利方。在这时,就已经执行了一些效果,例如删除投降方单位和转移设备。
|1.0
|1.0
|-id="on_capitulation_immediate"
|-id="on_capitulation_immediate"
|on_capitulation_immediate
|on_capitulation_immediate
|Trigger the following commands whenever a country capitulates, at the beginning of the process.
| 每当一个国家投降,在这个过程开始时,触发该效果。
|<pre>on_capitulation_immediate = {
|<pre>on_capitulation_immediate = {
    effect = { &hellip; }
    effect = { &hellip; }
}</pre>
}</pre>
|ROOT is capitulated country, FROM is winner.
|ROOT 是投降方,FROM是胜利方。
|1.11.5
|1.11.5
|-id="on_uncapitulation"
|-id="on_uncapitulation"
|on_uncapitulation
|on_uncapitulation
|Trigger the following commands whenever a country that was previously capitulated changes its status to no longer having capitulated.
| 每当一个先前投降的国家将其状态更改为不再投降时,触发该效果。
|<pre>on_uncapitulation = {
|<pre>on_uncapitulation = {
    effect = { &hellip; }
    effect = { &hellip; }
}</pre>
}</pre>
|ROOT is the country affected.
|ROOT 是受影响的国家。
|1.4
|1.4
|-id="on_annex"
|-id="on_annex"
|on_annex
|on_annex
|Trigger the following commands whenever a country is annexed.
| 每当一个国家被吞并时,触发该效果。
|<pre>on_annex = {
|<pre>on_annex = {
    effect = { &hellip; }
    effect = { &hellip; }
}</pre>
}</pre>
|ROOT is winner, FROM gets annexed. For civil wars '''on_civil_war_end''' is also fired.
|ROOT 是胜利方,FROM是被吞并方。对于在内战中的国家,<code>on_civil_war_end</code>效果将同时被触发。
|1.3.3
|1.3.3
|-id="on_civil_war_end_before_annexation"
|-id="on_civil_war_end_before_annexation"
|on_civil_war_end_before_annexation
|on_civil_war_end_before_annexation
|Trigger the following commands just before FROM gets annexed, meaning the country and everything it owns still exists.
| 在FROM被吞并之前效果,这意味着这个国家和它拥有的一切仍然存在。
|<pre>on_civil_war_end_before_annexation = {
|<pre>on_civil_war_end_before_annexation = {
    effect = { &hellip; }
    effect = { &hellip; }
}</pre>
}</pre>
|ROOT is winner, FROM gets annexed. It will also fire '''on_annex''' and '''on_civil_war_end'''.
|ROOT 是吞并方,FROM是被吞并方。总是同时触发<code>on_annex</code>和<code>on_civil_war_end</code>。
|1.6
|1.6
|-id="on_civil_war_end"
|-id="on_civil_war_end"
|on_civil_war_end
|on_civil_war_end
|Trigger the following commands whenever a civil war ends.
| 每当一场内战结束时,触发该效果。
|<pre>on_civil_war_end = {
|<pre>on_civil_war_end = {
    effect = { &hellip; }
    effect = { &hellip; }
}</pre>
}</pre>
|ROOT is civil war winner, FROM gets annexed. This will also fire '''on_annex'''.
|ROOT 是内战胜利方,FROM是被吞并方。总是同时触发<code>on_annex</code>。
|1.0
|1.0
|-id="on_puppet"
|-id="on_puppet"
|on_puppet
|on_puppet
|Trigger the following commands whenever a country is puppeted in a '''peace conference only'''.
| 每当一个国家在''' 和平会议''' 中被傀儡时,触发该效果。
|<pre>on_puppet = {
|<pre>on_puppet = {
    effect = { &hellip; }
    effect = { &hellip; }
}</pre>
}</pre>
|ROOT is the nation being puppeted, FROM is the overlord.
|ROOT 是被傀儡的国家,FROM是宗主国。
|1.0
|1.0
|-id="on_liberate"
|-id="on_liberate"
|on_liberate
|on_liberate
|Trigger the following commands whenever a country is liberated in a '''peace conference only'''.
| 每当一个国家在''' 和平会议''' 中被解放时,触发该效果。
|<pre>on_liberate = {
|<pre>on_liberate = {
    effect = { &hellip; }
    effect = { &hellip; }
}</pre>
}</pre>
|ROOT is the nation being liberated, FROM is the leader of the liberators.
|ROOT 是被解放的国家,FROM是解放它的国家。
|1.0
|1.0
|-id="on_release_as_free"
|-id="on_release_as_free"
|on_release_as_free
|on_release_as_free
|Trigger the following commands whenever a country is released.
| 每当一个国家被释放时,触发该效果。释放可以在各种效果下释放,并不局限于和平会议
|<pre>on_release_as_free = {
|<pre>on_release_as_free = {
    effect = { &hellip; }
    effect = { &hellip; }
}</pre>
}</pre>
|#ROOT is free nation FROM is releaser.
|ROOT 是被释放的国家,FROM是释放者。
|1.3
|1.3
|-id="on_release_as_puppet"
|-id="on_release_as_puppet"
|on_release_as_puppet
|on_release_as_puppet
|Trigger the following commands whenever puppeting through the occupied territories menu during peace time (or when releasing from non-core but owned territory).
| 每当在和平时期通过占领地区菜单释放傀儡( 或从非核心但占领的领土释放) 时,触发该效果。
|<pre>on_release_as_puppet = {
|<pre>on_release_as_puppet = {
    effect = { &hellip; }
    effect = { &hellip; }
}</pre>
}</pre>
|ROOT is the nation being released, FROM is the overlord.
|ROOT 是被释放的国家,FROM是宗主国。
|1.3
|1.3
|-id="on_guarantee"
|-id="on_guarantee"
|on_guarantee
|on_guarantee
|Trigger the following commands whenever a country guarantees independence of another country.
| 每当一个国家保障另一个国家的独立时,触发该效果。
|
|<pre>on_guarantee = {
|ROOT is the country which guarantees, FROM is the country that is guaranteed.
   effect = { &hellip; }
}</pre>
|ROOT 是保障的国家,FROM是被保障的国家。
|
|
|-id="on_military_access"
|-id="on_military_access"
|on_military_access
|on_military_access
|Trigger the following commands whenever a country accepts the request for military access.
| 每当一个国家'''接受军事通行权'''请求时,触发该效果。
|
|<pre>on_military_access = {
|ROOT is the country which requested, FROM is the country that accepted.
   effect = { &hellip; }
}</pre>
|ROOT 是请求军通的国家,FROM是接受军通的国家。
|
|
|-id="on_offer_military_access"
|-id="on_offer_military_access"
|on_offer_military_access
|on_offer_military_access
|Trigger the following commands whenever a country accepts the offer for military access.
| 每当一个国家接受'''提供军事通行权请求'''的提议时,触发该效果。{{red|(注意:这个和上面是两个不同的外交选项!)}}
|
|<pre>on_offer_military_access = {
|ROOT is the country which offered, FROM is the country that accepted.
   effect = { &hellip; }
}</pre>
|ROOT 是提供的国家,FROM是接受的国家。
|
|
|-id="on_call_allies"
|-id="on_call_allies"
|on_call_allies
|on_call_allies
|Trigger the following commands whenever a country accepts the call to war.
| 每当一个国家接受战争召唤时,触发该效果。
|
|<pre>on_call_allies = {
|ROOT is the country which called, FROM is the country that joined.
   effect = { &hellip; }
}</pre>
|ROOT 是发出召唤的国家,FROM是加入战争的国家。
|
|
|-id="on_join_allies"
|-id="on_join_allies"
|on_join_allies
|on_join_allies
|Trigger the following commands whenever a country joins a war of an ally.
| 每当一个国家加入盟友的战争时,触发该效果。
|
|<pre>on_join_allies = {
|ROOT is the country which joined, FROM is the country whose war was joined.
   effect = { &hellip; }
}</pre>
|ROOT 是加入战争的国家,FROM是战争被加入的国家。
|
|
|-id="on_lend_lease"
|-id="on_lend_lease"
|on_lend_lease
|on_lend_lease
|Trigger the following commands whenever a country has their lend lease accepted.
| 每当一个国家起草的租借法案被接受时,触发该效果。
|
|<pre>on_lend_lease = {
|ROOT is the country that sent the lend lease, FROM is the country that accepted.
   effect = { &hellip; }
}</pre>
|ROOT 是发出租借法案的国家,FROM是接受租借法案的国家。
|
|
|-id="on_incoming_lend_lease"
|-id="on_incoming_lend_lease"
|on_incoming_lend_lease
|on_incoming_lend_lease
|Trigger the following commands whenever a country accepts a requested lend lease.
| 每当一个国家接受请求租借时,触发该效果。
|
|<pre>on_incoming_lend_lease = {
|ROOT is the country that accepted, FROM is the country that requested.
   effect = { &hellip; }
}</pre>
|ROOT 是接受请求的国家,FROM是发出请求的国家。
|
|
|-id="on_send_expeditionary_force"
|-id="on_send_expeditionary_force"
|on_send_expeditionary_force
|on_send_expeditionary_force
|Trigger the following commands whenever a country accepts sent expeditionary forces.
| 每当一个国家接受派遣远征军时,触发该效果。
|
|<pre>on_send_expeditionary_force = {
|ROOT is the country that sent, FROM is the country that accepted.
   effect = { &hellip; }
}</pre>
|ROOT 是派遣远征军的国家,FROM是接受的国家。
|
|
|-id="on_return_expeditionary_forces"
|-id="on_return_expeditionary_forces"
|on_return_expeditionary_forces
|on_return_expeditionary_forces
|Trigger the following commands whenever a country returns their expeditionary forces.
| 每当一个国家撤回他们的远征军时,触发该效果。
|
|<pre>on_send_expeditionary_force = {
|ROOT is the owner of the forces, FROM is the country where the forces were sent.
   effect = { &hellip; }
}</pre>
|ROOT 是部队的所有者(派遣方),FROM是部队被派遣到的国家。
|
|
|-id="on_request_expeditionary_forces"
|-id="on_request_expeditionary_forces"
|on_request_expeditionary_forces
|on_request_expeditionary_forces
|Trigger the following commands whenever a country guarantees independence of another country.
| 每当一个国家要求军队指挥权时,触发该效果。
|
|<pre>on_request_expeditionary_forces = {
|ROOT is the country that requests, FROM is the target of the request.
   effect = { &hellip; }
}</pre>
|ROOT 是发出要求的国家,FROM是要求的目标国家。
|
|
|-id="on_ask_for_state_control"
|-id="on_ask_for_state_control"
|on_ask_for_state_control
|on_ask_for_state_control
|Trigger the following commands whenever a country accepts the request for control of a state.
| 每当一个国家接受要求接管占领区的请求时,触发该效果。
|
|<pre>on_ask_for_state_control = {
|ROOT is the requester, FROM is the country in control of the state.
   effect = { &hellip; }
}</pre>
|ROOT 是发出请求的国家,FROM是控制该占领区的国家。
|
|
|-id="on_give_state_control"
|-id="on_give_state_control"
|on_give_state_control
|on_give_state_control
|Trigger the following commands whenever a country accepts being given control of a state.
| 每当一个国家接受移交占领区的请求时,触发该效果。
|
|<pre>on_give_state_control = {
|ROOT is the giver, FROM is the receiver.
   effect = { &hellip; }
}</pre>
|ROOT 是移交占领区的国家,FROM是接受的国家。
|
|
|-id="on_peace_proposal"
|-id="on_peace_proposal"
|on_peace_proposal
|on_peace_proposal
|Trigger the following commands whenever a country accepts a conditional surrender.
| 每当一个国家接受有条件投降时,触发该效果。
|
|<pre>on_peace_proposal = {
|ROOT is sender of conditional surrender, FROM is the receiver.
   effect = { &hellip; }
}</pre>
|ROOT 是发起有条件投降的国家,FROM是接受的国家。
|
|
|-id="on_send_attache"
|-id="on_send_attache"
|on_send_attache
|on_send_attache
|Triggers actions on an attache being accepted. Default scope is sender, FROM = receiver
| 每当派遣军事顾问被接受时,触发该效果。
|
|<pre>on_send_attache = {
|Default scope is sender, FROM = receiver
   effect = { &hellip; }
}</pre>
| 默认作用域是派遣的国家,FROM是接受的国家。
|
|
|}
|}


== Faction ==
== 阵营相关 ==
{| class="wikitable sortable" width="100%"
{| class="wikitable sortable" width="100%"
! width="10%" | Name
! width="10%" | Name
第492行: 第519行:
|-id="on_create_faction"
|-id="on_create_faction"
|on_create_faction
|on_create_faction
|Trigger the following commands whenever a country create a faction.
| 每当一个国家创建一个阵营时,触发该效果。
|<pre>on_create_faction = { effect = { &hellip; } }</pre>
|<pre>on_create_faction = { effect = { &hellip; } }</pre>
|FROM is the one that joins the faction.
|FROM 是加入该阵营的国家。
|1.0
|1.0
|-id="on_faction_formed"
|-id="on_faction_formed"
|on_faction_formed
|on_faction_formed
|Trigger the following commands when a faction is formed.
| 每当一个阵营创建完成时,触发该效果。
|<pre>on_faction_formed = { effect = { news_event = { id = news.159 } } }</pre>
|<pre>on_faction_formed = { effect = { news_event = { id = news.159 } } }</pre>
|
|
第504行: 第531行:
|-id="on_offer_join_faction"
|-id="on_offer_join_faction"
|on_offer_join_faction
|on_offer_join_faction
|Trigger the following commands whenever a country joins a faction after being invited.
| 每当一个国家被邀请加入一个阵营时,触发该效果。
|<pre>on_offer_join_faction = { effect = { &hellip; } }</pre>
|<pre>on_offer_join_faction = { effect = { &hellip; } }</pre>
|FROM is the country invited, THIS and ROOT are the faction leader.
|FROM 是被邀请的国家,THIS和ROOT是阵营领袖。
|1.0
|1.0
|-id="on_join_faction"
|-id="on_join_faction"
|on_join_faction
|on_join_faction
|Trigger the following commands for a faction leader whenever a country joins after they ask to do so.
| 每当一个国家提出加入阵营并被接受时,触发该效果。
|<pre>on_join_faction = { effect = { &hellip; } }</pre>
|<pre>on_join_faction = { effect = { &hellip; } }</pre>
|FROM is faction leader, ROOT and THIS are the country that joins.
|FROM 是阵营领袖,ROOT和THIS是加入的国家。
|1.0
|1.0
|-id="on_assume_faction_leadership"
|-id="on_assume_faction_leadership"
|on_assume_faction_leadership
|on_assume_faction_leadership
|Trigger the following commands whenever a country assumes leadership of a faction.
| 每当一个国家接管一个阵营时,触发该效果。
|<pre>on_assume_faction_leadership = { effect = { &hellip; } }</pre>
|<pre>on_assume_faction_leadership = { effect = { &hellip; } }</pre>
| ROOT is the new faction leader FROM is the old faction leader
|ROOT 是新的阵营领袖,FROM是旧的阵营领袖。
|1.7
|1.7
|-id="on_leave_faction"
|-id="on_leave_faction"
|on_leave_faction
|on_leave_faction
|Trigger the following commands whenever a country leave a faction.
| 每当一个国家离开一个阵营时,触发该效果。
|<pre>on_leave_faction = { effect = { if = { limit = { AND = { tag = CAN NOT = { has_dlc = "Together for Victory" } } } drop_cosmetic_tag = yes } }</pre>
|<pre>on_leave_faction = { effect = { if = { limit = { AND = { tag = CAN NOT = { has_dlc = "Together for Victory" } } } drop_cosmetic_tag = yes } }</pre>
| FROM is the faction Leader, ROOT is the country leaving the faction
|FROM 是阵营领袖,ROOT是离开阵营的国家。
|1.0
|1.0
|}
|}


== Autonomy ==
== 附属国相关 ==
{| class="wikitable sortable" width="100%"
{| class="wikitable sortable" width="100%"
! width="10%" | Name
! width="10%" | 名字
! width="20%" | Description
! width="20%" | 描述
! width="25%" | Examples
! width="25%" | 例子
! width="15%" | Notes
! width="15%" | 提示
! width="5%" | Version Added
! width="5%" | 版本
|-id="on_subject_annexed"
|-id="on_subject_annexed"
|on_subject_annexed
|on_subject_annexed
|Trigger the following commands when a country annex a subject.
| 每当一个国家吞并一个傀儡时,触发该效果。
|<pre>on_subject_annexed = { effect = {  &hellip;  } }</pre>
|<pre>on_subject_annexed = { effect = {  &hellip;  } }</pre>
|ROOT is the subject, FROM is the overlord.
|ROOT 是傀儡国, FROM 是宗主国。
|1.0
|1.0
|-id="on_subject_free"
|-id="on_subject_free"
|on_subject_free
|on_subject_free
|Trigger the following commands when a country grants freedom to a puppet.
| 每当一个国家同意傀儡独立时,触发该效果。
|<pre>on_subject_free = { effect = {  &hellip;  } }</pre>
|<pre>on_subject_free = { effect = {  &hellip;  } }</pre>
|ROOT is the subject, FROM is the previous overlord.
|ROOT 是傀儡国, FROM 是宗主国。
|1.0
|1.0
|-id="on_subject_autonomy_level_change"
|-id="on_subject_autonomy_level_change"
|on_subject_autonomy_level_change
|on_subject_autonomy_level_change
|Trigger the following commands when the autonomy level of a puppet changes.
| 每当一个傀儡的自治级别发生变化时,触发该效果。
|<pre>on_subject_autonomy_level_change = { effect = {  &hellip;  } }</pre>
|<pre>on_subject_autonomy_level_change = { effect = {  &hellip;  } }</pre>
|ROOT is the subject, FROM is the overlord.
|ROOT 是傀儡国, FROM 是宗主国。
|1.0
|1.0
|}
|}


== Governments in Exile ==
== 流亡政府相关 ==
{| class="wikitable sortable" width="100%"
{| class="wikitable sortable" width="100%"
! width="10%" | Name
! width="10%" | 名字
! width="20%" | Description
! width="20%" | 描述
! width="25%" | Examples
! width="25%" | 例子
! width="15%" | Notes
! width="15%" | 提示
! width="5%" | Version Added
! width="5%" | 版本
|-id="on_government_exiled"
|-id="on_government_exiled"
|on_government_exiled
|on_government_exiled
|Trigger the following commands whenever a country becomes a government in exile.
| 每当一个国家成为流亡政府时,触发该效果。
|<pre>on_government_exiled = { effect = { = { &hellip; } }</pre>
|<pre>on_government_exiled = { effect = { = { &hellip; } }</pre>
|ROOT is the government in exile, FROM is the country that is hosting the government in exile.
|ROOT 是流亡政府,FROM是收容流亡政府的国家。
|1.6
|1.6
|-id="on_host_changed_from_capitulation"
|-id="on_host_changed_from_capitulation"
|on_host_changed_from_capitulation
|on_host_changed_from_capitulation
|Trigger the following commands whenever a country that is hosting a government in exile has capitulated.
| 每当一个流亡政府所在的国家投降时,触发该效果。
|<pre>on_host_changed_from_capitulation= { effect = { = { &hellip; } }</pre>
|<pre>on_host_changed_from_capitulation= { effect = { = { &hellip; } }</pre>
|ROOT is the government in exile, FROM is the new country hosting the government in exile, FROM:FROM is the old country that was hosting the government in exile.
|ROOT 是流亡政府,'''FROM'''是{{red|新}}的收容流亡政府的国家,'''FROM:FROM'''是{{red|之前}}收容流亡政府的国家。
|1.6
|1.6
|-id="on_exile_government_reinstated"
|-id="on_exile_government_reinstated"
|on_exile_government_reinstated
|on_exile_government_reinstated
|Trigger the following commands whenever a country has returned from governing in exile.
| 每当一个国家结束流亡状态时,触发该效果。
|<pre>on_exile_government_reinstated = { effect = { = { &hellip; } }</pre>
|<pre>on_exile_government_reinstated = { effect = { = { &hellip; } }</pre>
|ROOT is the government in exile, FROM is the country that was hosting the government in exile.
|ROOT 是流亡政府,FROM是之前收容流亡政府的国家。
|1.6
|1.6
|}
|}


== States ==
== 省份相关 ==
{| class="wikitable sortable" width="100%"
{| class="wikitable sortable" width="100%"
! width="10%" | Name
! width="10%" | 名字
! width="20%" | Description
! width="20%" | 描述
! width="25%" | Examples
! width="25%" | 示例
! width="15%" | Notes
! width="15%" | 提示
! width="5%" | Version Added
! width="5%" | 版本
|-id="on_state_control_changed"
|-id="on_state_control_changed"
|on_state_control_changed
|on_state_control_changed
|Trigger the following commands when a state's controller changes.
| 每当一个省份的控制权变更时,触发该效果。
|<pre>on_state_control_changed = {
|<pre>on_state_control_changed = {
    effect = {
    effect = {
第619行: 第646行:
    }
    }
}</pre>
}</pre>
|ROOT is new controller, FROM is old controller, FROM.FROM is state ID.
|ROOT 是该省份新的控制者,FROM该省份之前的控制者,FROM.FROM 是省份ID。
|1.4
|1.4
|}
|}


== Wargoals ==
== 战争目标相关 ==
{| class="wikitable sortable" width="100%"
{| class="wikitable sortable" width="100%"
! width="10%" | Name
! width="10%" | 名字
! width="20%" | Description
! width="20%" | 描述
! width="25%" | Examples
! width="25%" | 示例
! width="15%" | Notes
! width="15%" | 提示
! width="5%" | Version Added
! width="5%" | 版本
|-id="on_generate_wargoal"
|-id="on_generate_wargoal"
|on_generate_wargoal
|on_generate_wargoal
|Trigger the following commands whenever the country generates a wargoal.
| 每当一个国家生成一个战争目标时,触发该效果。
|<pre>on_generate_wargoal = {  }</pre>
|<pre>on_generate_wargoal = {  }</pre>
|ROOT is the wargoal owner, FROM is the wargoal target
|ROOT 是战争目标的拥有国家,FROM是战争目标的目标国家。
|
|
|-id="on_justifying_wargoal_pulse"
|-id="on_justifying_wargoal_pulse"
|on_justifying_wargoal_pulse
|on_justifying_wargoal_pulse
|Trigger the following commands whenever the country is targeted by a wargoal under justification.
| 每当一个国家被作为正当化战争的目标时,触发该效果。
|<pre>on_justifying_wargoal_pulse = { random_events = { 100 = war_justification.1 } }</pre>
|<pre>on_justifying_wargoal_pulse = { random_events = { 100 = war_justification.1 } }</pre>
|FROM = target nation. Checked every day.
|FROM 是战争目标的目标国家。'''每天进行检查'''。
|1.0
|1.0
|-id="on_wargoal_expire"
|-id="on_wargoal_expire"
|on_wargoal_expire
|on_wargoal_expire
|Trigger the following commands whenever a wargoal expire.
| 每当战争目标到期时,触发该效果。
|<pre>on_wargoal_expire = { random_events = { 100 = war_justification.301 } }</pre>
|<pre>on_wargoal_expire = { random_events = { 100 = war_justification.301 } }</pre>
|FROM is the wargoal owner.
|FROM 是战争目标的拥有国家。
|1.0
|1.0
|}
|}


== Unit Leader ==
== 将领相关 ==
{| class="wikitable sortable" width="100%"
{| class="wikitable sortable" width="100%"
! width="10%" | Name
! width="10%" | 名字
! width="20%" | Description
! width="20%" | 描述
! width="25%" | Examples
! width="25%" | 示例
! width="15%" | Notes
! width="15%" | 提示
! width="5%" | Version Added
! width="5%" | 版本
|-id="on_unit_leader_created"
|-id="on_unit_leader_created"
|on_unit_leader_created
|on_unit_leader_created
|Trigger the following commands when an army leader is created.
| 每当招募一名新将领时,触发该效果。
|<pre>on_unit_leader_created = { effect = { &hellip; } }</pre>
|<pre>on_unit_leader_created = { effect = { &hellip; } }</pre>
|FROM is owner country, ROOT is the unit leader.
|FROM 是该将领所在国家,ROOT是该将领。
|1.5
|1.5
|-id="on_army_leader_daily"
|-id="on_army_leader_daily"
|on_army_leader_daily
|on_army_leader_daily
|Trigger the following commands on an army leader each day.
| 在每一天为一名将领触发该效果。
|<pre>on_army_leader_daily = { effect = { &hellip; } }</pre>
|<pre>on_army_leader_daily = { effect = { &hellip; } }</pre>
|FROM is owner country, ROOT is the unit leader.
|FROM 是该将领所在国家,ROOT是该将领。
|1.0
|1.0
|-id="on_army_leader_won_combat"
|-id="on_army_leader_won_combat"
|on_army_leader_won_combat
|on_army_leader_won_combat
|Trigger the following commands whenever an army leader won a combat.
| 每当一名将领打赢一场战斗时,触发该效果。
|<pre>on_army_leader_won_combat = { effect = { &hellip; } }</pre>
|<pre>on_army_leader_won_combat = { effect = { &hellip; } }</pre>
|FROM is owner country, ROOT is the unit leader.
|FROM 是该将领所在国家,ROOT是该将领。
|1.0
|1.0
|-id="on_army_leader_lost_combat"
|-id="on_army_leader_lost_combat"
|on_army_leader_lost_combat
|on_army_leader_lost_combat
|Trigger the following commands whenever an army leader lost a combat.
| 每当一名将领打输一场战斗时,触发该效果。
|<pre>on_army_leader_lost_combat = { effect = { &hellip; } }</pre>
|<pre>on_army_leader_lost_combat = { effect = { &hellip; } }</pre>
|FROM is owner country, ROOT is the unit leader.
|FROM 是该将领所在国家,ROOT是该将领。
|1.0
|1.0
|-id="on_unit_leader_level_up"
|-id="on_unit_leader_level_up"
|on_unit_leader_level_up
|on_unit_leader_level_up
|Trigger the following commands when a leader gain a level.
| 每当一名将领获得升级时,触发该效果。
|<pre>on_unit_leader_level_up = { effect = { &hellip; } }</pre>
|<pre>on_unit_leader_level_up = { effect = { &hellip; } }</pre>
|FROM is owner country, ROOT is the unit leader.
|FROM 是该将领所在国家,ROOT是该将领。
|1.0
|1.0
|-id="on_army_leader_promoted"
|-id="on_army_leader_promoted"
|on_army_leader_promoted
|on_army_leader_promoted
|Trigger the following commands whenever a corps commander is promoted to a field marshal.
| 每当一名将领晋升为元帅时,触发该效果。
|<pre>on_army_leader_promoted = { effect = { add_timed_unit_leader_trait = { trait = recently_promoted days = 100 } } }</pre>
|<pre>on_army_leader_promoted = { effect = { add_timed_unit_leader_trait = { trait = recently_promoted days = 100 } } }</pre>
|FROM is owner country, ROOT is the unit leader.
|FROM 是该将领所在国家,ROOT是该将领。
|1.0
|1.0
|-id="on_unit_leader_promote_from_ranks_veteran"
|-id="on_unit_leader_promote_from_ranks_veteran"
|on_unit_leader_promote_from_ranks_veteran
|on_unit_leader_promote_from_ranks_veteran
|Triggers the following commands whenever an unit commander gets promoted to a general.
| 每当一名战地军官晋升为将军时,触发该效果。
|<pre>on_unit_leader_promote_from_ranks_veteran = { effect = { &hellip; } }</pre>
|<pre>on_unit_leader_promote_from_ranks_veteran = { effect = { &hellip; } }</pre>
|FROM is unit, OWNER is owner country, ROOT is the unit leader.
|FROM 是该战地军官所在的单位,OWNER是该战地军官所在的国家,ROOT是该战地军官。
|1.12
|1.12
|-id="on_unit_leader_promote_from_ranks_green"
|-id="on_unit_leader_promote_from_ranks_green"
|on_unit_leader_promote_from_ranks_green
|on_unit_leader_promote_from_ranks_green
|Triggers the following commands whenever an unit commander gets promoted to a general.
| 每当一名战地军官晋升为将军时,触发该效果。
|<pre>on_unit_leader_promote_from_ranks_green = { effect = { &hellip; } }</pre>
|<pre>on_unit_leader_promote_from_ranks_green = { effect = { &hellip; } }</pre>
|FROM is unit, OWNER is owner country, ROOT is the unit leader.
|FROM 是该战地军官所在的单位,OWNER是该战地军官所在的国家,ROOT是该战地军官。
|1.12
|1.12
|}
|}


== Military ==
== 军事相关 ==
{| class="wikitable sortable" width="100%"
{| class="wikitable sortable" width="100%"
! width="10%" | Name
! width="10%" | 名字
! width="20%" | Description
! width="20%" | 描述
! width="25%" | Examples
! width="25%" | 示例
! width="15%" | Notes
! width="15%" | 提示
! width="5%" | Version Added
! width="5%" | 版本
|-id="on_nuke_drop"
|-id="on_nuke_drop"
|on_nuke_drop
|on_nuke_drop
|Trigger the following commands whenever a country drops a nuke.
| 每当一个国家投掷核弹时,触发该效果。
|<pre>on_nuke_drop = {
|<pre>on_nuke_drop = {
    effect = {
    effect = {
第722行: 第749行:
    }
    }
}</pre>
}</pre>
|ROOT is the country that launched the nuke, FROM is the nuked state.
|ROOT 是发射核弹的国家,FROM是被核弹打击的省份。
|1.0
|1.0
|-id="on_pride_of_the_fleet_sunk"
|-id="on_pride_of_the_fleet_sunk"
|on_pride_of_the_fleet_sunk
|on_pride_of_the_fleet_sunk
|Triggers when a country's pride of the fleet is sunk
| 每当一个国家的舰队荣耀被击沉时,触发该效果。
|<pre>on_pride_of_the_fleet_sunk = {
|<pre>on_pride_of_the_fleet_sunk = {
    effect = {
    effect = {
第737行: 第764行:
    }
    }
}</pre>
}</pre>
|FROM is the killer country, ROOT is the country of that lost its pride of the fleet.
|FROM 是击沉舰队荣耀的国家,ROOT是被击沉舰队荣耀的国家。
|1.6
|1.6
|-id="on_naval_invasion"
|-id="on_naval_invasion"
|on_naval_invasion
|on_naval_invasion
|Triggers the following commands whenever a sea invasion is made.
| 每当海上入侵发生时,触发该效果。
|<pre>on_naval_invasion = {
|<pre>on_naval_invasion = {
    effect = { 
    effect = { 
第749行: 第776行:
    }
    }
}</pre>
}</pre>
|THIS (default scope) is the invaded state, ROOT is the country that invades, FROM is the state where the invasion started
|THIS( 默认作用域) 是被入侵的省份,ROOT是入侵的国家,FROM是入侵开始的省份。
|1.9
|1.9
|-id="on_paradrop"
|-id="on_paradrop"
|on_paradrop
|on_paradrop
|Triggers the following commands whenever a landing occurs.
| 每当空投发生时,触发该效果。
|<pre>on_paradrop = { 
|<pre>on_paradrop = { 
    effect = {
    effect = {
第763行: 第790行:
    }
    }
}</pre>
}</pre>
|THIS (default scope) is the invaded state, ROOT is the country that invades, FROM is the state where the invasion started
|THIS ( 默认作用域) 是未被空投的省份,ROOT是被空投的省份,FROM是进行空投的国家。
|1.9
|1.9
|-id="on_units_paradropped_in_state"
|-id="on_units_paradropped_in_state"
|on_units_paradropped_in_state
|on_units_paradropped_in_state
|This differs from on_paradrop in that it is run once per paradrop, not once per unit dropped.
| 这与on_paradrop的不同之处在于它对每一次空投运行一次,而不是对每个空投的单位运行一次。
|<pre>on_paradrop = { 
|<pre>on_paradrop = { 
    effect = {
    effect = {
第777行: 第804行:
    }
    }
}</pre>
}</pre>
|ROOT is the state that was dropped into, FROM is the dropping country.
|ROOT 是被空投的省份,FROM是进行空投的国家。
|
|
|-id="on_add_history"
|-id="on_add_history"
|on_add_history
|on_add_history
|Triggers the following commands whenever receiving a history entry.
| 每当接收到单位的战斗历史记录时,触发该效果。
|<pre>on_add_history = { effect = { &hellip; } }</pre>
|<pre>on_add_history = { effect = { &hellip; } }</pre>
|ROOT is the unit.
|ROOT 是该单位。
|1.12
|1.12
|}
|}


== Aces ==
== 王牌飞行员相关 ==
{| class="wikitable sortable" width="100%"
{| class="wikitable sortable" width="100%"
! width="10%" | Name
! width="10%" | 名字
! width="20%" | Description
! width="20%" | 描述
! width="25%" | Examples
! width="25%" | 示例
! width="15%" | Notes
! width="15%" | 提示
! width="5%" | Version Added
! width="5%" | 版本
|-id="on_ace_promoted"
|-id="on_ace_promoted"
|on_ace_promoted
|on_ace_promoted
|Trigger the following commands whenever an ace is created.
| 每当创建一个王牌飞行员时,触发该效果。
|<pre>on_ace_promoted = { random_events = { 100 = ace_promoted.1 } }</pre>
|<pre>on_ace_promoted = { random_events = { 100 = ace_promoted.1 } }</pre>
|FROM = ace.
|FROM 是该王牌飞行员。
|1.0
|1.0
|-id="on_ace_killed"
|-id="on_ace_killed"
|on_ace_killed
|on_ace_killed
|Trigger the following commands whenever an aces is killed.
| 每当一个王牌飞行员被消灭时,触发该效果。
|<pre>on_ace_killed = { random_events = { 100 = ace_died.1 } }</pre>
|<pre>on_ace_killed = { random_events = { 100 = ace_died.1 } }</pre>
|FROM = ace.
|FROM 是该王牌飞行员。
|1.0
|1.0
|-id="on_ace_killed_on_accident"
|-id="on_ace_killed_on_accident"
|on_ace_killed_on_accident
|on_ace_killed_on_accident
|Trigger the following commands whenever our aces died on accident.
| 每当我方王牌飞行员在意外中死亡时,触发该效果。
|<pre>on_ace_killed_on_accident = { random_events = { 100 = ace_died.1 } }</pre>
|<pre>on_ace_killed_on_accident = { random_events = { 100 = ace_died.1 } }</pre>
|FROM = our ace died in accident.
|FROM 是我方意外死亡的王牌飞行员。
|1.9
|1.9
|-id="on_non_ace_killed_other_ace"
|-id="on_non_ace_killed_other_ace"
|on_non_ace_killed_other_ace
|on_non_ace_killed_other_ace
|Trigger the following commands whenever non ace killed enemy ace.
| 每当我方非王牌飞行员击落敌方王牌飞行员时,触发该效果。
|<pre>on_non_ace_killed_other_ace = { FROM = { random_events = { 100 = ace_died.1 } } }</pre>
|<pre>on_non_ace_killed_other_ace = { FROM = { random_events = { 100 = ace_died.1 } } }</pre>
|FROM = enemy ace.
|FROM 是该敌方王牌飞行员。
|1.9
|1.9
|-id="on_ace_killed_by_ace"
|-id="on_ace_killed_by_ace"
|on_ace_killed_by_ace
|on_ace_killed_by_ace
|Trigger the following commands whenever an aces is killed by another ace.
| 每当一个王牌飞行员被另一个王牌飞行员击落(敌方击落我方)时,触发该效果。
|<pre>on_ace_killed_by_ace = { random_events = { 100 = ace_killed_by_ace.1 } }</pre>
|<pre>on_ace_killed_by_ace = { random_events = { 100 = ace_killed_by_ace.1 } }</pre>
|FROM = our ace, PREV = enemy ace, has killed FROM.
|FROM 是我方王牌飞行员,PREV是击落FROM的敌方王牌飞行员
|1.0
|1.0
|-id="on_ace_killed_other_ace"
|-id="on_ace_killed_other_ace"
|on_ace_killed_other_ace
|on_ace_killed_other_ace
|Trigger the following commands whenever an aces is killed by another ace (surviving ace side).
| 每当一个王牌飞行员被另一个王牌飞行员击落(我方击落敌方)时,触发该效果。
|<pre>on_ace_killed_other_ace = { random_events = { 100 = ace_killed_other_ace.1 } }</pre>
|<pre>on_ace_killed_other_ace = { random_events = { 100 = ace_killed_other_ace.1 } }</pre>
|FROM = our ace, PREV = enemy ace, killed by FROM.
|FROM 是我方王牌飞行员,PREV是被FROM击落的敌方王牌飞行员。
|1.0
|1.0
|-id="on_aces_killed_each_other"
|-id="on_aces_killed_each_other"
|on_aces_killed_each_other
|on_aces_killed_each_other
|Trigger the following commands whenever two aces kill each other in air duel.
| 每当两个王牌飞行员在空中对决中同归于尽时,触发该效果。
|<pre>on_aces_killed_each_other = { random_events = { 100 = aces_killed_each_other.1 } }</pre>
|<pre>on_aces_killed_each_other = { random_events = { 100 = aces_killed_each_other.1 } }</pre>
|FROM = ace, PREV = enemy ace.
|FROM 是我方王牌飞行员,PREV是敌方王牌飞行员。
|1.0
|1.0
|}
|}


== La Résistance ==
== 抵抗运动相关 ==
{| class="wikitable sortable" width="100%"
{| class="wikitable sortable" width="100%"
! width="10%" | Name
! width="10%" | 名字
! width="20%" | Description
! width="20%" | 描述
! width="25%" | Examples
! width="25%" | 示例
! width="15%" | Notes
! width="15%" | 提示
! width="5%" | Version Added
! width="5%" | 版本
|-id="on_operation_completed"
|-id="on_operation_completed"
|on_operation_completed
|on_operation_completed
|Trigger the following commands whenever an operative completed.
| 每当一名特工完成任务时,触发该效果。
|<pre>on_operation_completed = { effect = { &hellip; } }</pre>
|<pre>on_operation_completed = { effect = { &hellip; } }</pre>
|THIS - the operative, ROOT - the initiating country, FROM - the target country.
|THIS 是该特工,ROOT是发起行动的国家,FROM是目标国家。
|1.9
|1.9
|-id="on_operative_detected_during_operation"
|-id="on_operative_detected_during_operation"
|on_operative_detected_during_operation
|on_operative_detected_during_operation
|Trigger the following commands whenever an operative dies.
| 每当一名特工死亡时,触发该效果。
|<pre>on_operative_death = { effect = { &hellip; } }</pre>
|<pre>on_operative_death = { effect = { &hellip; } }</pre>
|THIS - the operative, ROOT - the killer country (optional), FROM - the country the operative is operating for, FROM.FROM - operation state (will only be set if the operation has a specific selection_target).
|THIS 是该特工,ROOT是杀死该特工的国家(可选),FROM是该特工执行任务的目标国家,FROM.FROM 是任务状态(仅在任务有特定选择目标时设置)。
|1.9
|1.9
|-id="on_operative_on_mission_spotted"
|-id="on_operative_on_mission_spotted"
|on_operative_on_mission_spotted
|on_operative_on_mission_spotted
|Trigger the following commands whenever an operative performing an offensive mission in a country.
| 每当一名特工在一个国家执行破坏任务时,触发该效果。
|<pre>on_operative_on_mission_spotted = { effect = { &hellip; } }</pre>
|<pre>on_operative_on_mission_spotted = { effect = { &hellip; } }</pre>
|THIS - the operative, FROM - the country the operative was performing its mission in, ROOT - the country the operative is operating for.
|THIS 是该特工,FROM是该特工正在执行任务所在的国家,ROOT是该特工所属国家。
|1.9
|1.9
|-id="on_operative_captured"
|-id="on_operative_captured"
|on_operative_captured
|on_operative_captured
|Trigger the following commands whenever an operative is captured.
| 每当一名特工被俘获时,触发该效果。
|<pre>on_operative_captured = { effect = { &hellip; } }</pre>
|<pre>on_operative_captured = { effect = { &hellip; } }</pre>
|THIS - the operative, ROOT - the country the operative was performing its mission in, FROM - the country the operative is operating for.
|THIS 是该特工,ROOT是该特工执行任务所在的国家,FROM是该特工为其服务的国家。
|1.9
|1.9
|-id="on_operative_created"
|-id="on_operative_created"
|on_operative_created
|on_operative_created
|Trigger the following commands whenever an operative is created.
| 每当一名特工被创建时,触发该效果。
|<pre>on_operative_created = { effect = { &hellip; } }</pre>
|<pre>on_operative_created = { effect = { &hellip; } }</pre>
|THIS - the operative, FROM - the country the operative is created by.
|THIS 是该特工,FROM是创建该特工的国家。
|1.9.1
|1.9.1
|-id="on_operative_death"
|-id="on_operative_death"
|on_operative_death
|on_operative_death
|Trigger the following commands whenever an operative dies.
| 每当一名特工死亡时,触发该效果。
|<pre>on_operative_death = { effect = { &hellip; } }</pre>
|<pre>on_operative_death = { effect = { &hellip; } }</pre>
|THIS - the operative, ROOT - the killer country (optional), FROM - the country the operative is operating for.
|THIS 是该特工,ROOT是杀死该特工的国家(可选),FROM是该特工所属国家。
|1.9
|1.9
|-id="on_operative_recruited"
|-id="on_operative_recruited"
|on_operative_recruited
|on_operative_recruited
|Trigger the following commands whenever an operative is recruited.
| 每当一名特工被招募时,触发该效果。
|<pre>on_operative_recruited = { effect = { &hellip; } }</pre>
|<pre>on_operative_recruited = { effect = { &hellip; } }</pre>
|THIS - the operative, FROM - the country the operative is created by.
|THIS 是该特工,FROM是创建该特工的国家。
|1.9.1
|1.9.1
|-id="on_fully_decrypted_cipher"
|-id="on_fully_decrypted_cipher"
|on_fully_decrypted_cipher
|on_fully_decrypted_cipher
|Trigger the following commands whenever a country fully decrypts cipher of a target country.
| 每当一个国家完全破译了目标国家的密码时,触发该效果。
|<pre>on_fully_decrypted_cipher = { effect = { &hellip; } }</pre>
|<pre>on_fully_decrypted_cipher = { effect = { &hellip; } }</pre>
|THIS - the target country that its cipher is decrypted, FROM - the decrypter country.
|THIS 是密码被破译的国家,FROM是破译密码的国家。
|1.9
|1.9
|-id="on_activated_active_decryption_bonuses"
|-id="on_activated_active_decryption_bonuses"
|on_activated_active_decryption_bonuses
|on_activated_active_decryption_bonuses
|Trigger the following commands whenever a country activates its active cipher bonuses against a target.
| 每当一个国家针对目标国家激活已破译密码的加成效果时,触发该效果。
|<pre>on_activated_active_decryption_bonuses = { effect = { &hellip; } }</pre>
|<pre>on_activated_active_decryption_bonuses = { effect = { &hellip; } }</pre>
|THIS - the target country, FROM - the country that activates its bonuses.
|THIS 是目标国家,FROM是激活加成效果的国家。
|1.9
|1.9
|}
|}


== Military Industrial Organization ==
== 军工组织系统相关 ==
{| class="wikitable sortable" width="100%"
{| class="wikitable sortable" width="100%"
! width="10%" | Name
! width="10%" | 名字
! width="20%" | Description
! width="20%" | 描述
! width="25%" | Examples
! width="25%" | 示例
! width="15%" | Notes
! width="15%" | 提示
! width="5%" | Version Added
! width="5%" | 版本
|-id="on_mio_size_increased"
|-id="on_mio_size_increased"
|on_mio_size_increased
|on_mio_size_increased
|Trigger the following commands whenever a MIO increases in size (levels up).
| 每当一个军工机构的规模增长(升级)时,触发该效果。
|
|
|ROOT is the Military Industrial Organization, FROM is the owner of the MIO country
|ROOT 是该军工机构,FROM是该军工机构所在的国家。
|1.13
|1.13
|-id="on_mio_design_team_assigned_to_tech"
|-id="on_mio_design_team_assigned_to_tech"
|on_mio_design_team_assigned_to_tech
|on_mio_design_team_assigned_to_tech
|Trigger the following commands whenever a MIO is assigned to technology research.
| 每当一个军工机构被分配给科技研究时,触发该效果。
|
|
|ROOT is the Military Industrial Organization, FROM is the owner of the MIO
|ROOT 是该军工机构,FROM是该军工机构所在的国家。
|1.13
|1.13
|-id="on_mio_design_team_assigned_to_variant"
|-id="on_mio_design_team_assigned_to_variant"
|on_mio_design_team_assigned_to_variant
|on_mio_design_team_assigned_to_variant
|Trigger the following commands whenever a MIO is asigned to a variant.
| 每当一个军工机构被分配给一个装备的衍生型号时,触发该效果。
|
|
|ROOT is the Military Industrial Organization, FROM is the owner of the MIO country
|ROOT 是该军工机构,FROM是该军工机构所在的国家。
|1.13
|1.13
|-id="on_mio_industrial_manufacturer_assigned"
|-id="on_mio_industrial_manufacturer_assigned"
|on_mio_industrial_manufacturer_assigned
|on_mio_industrial_manufacturer_assigned
|Trigger the following commands whenever a MIO assigned to a production line.
| 每当一个军工机构被分配到一条生产线时,触发该效果。
|
|
|ROOT is the Military Industrial Organization, FROM is the owner of the MIO
|ROOT 是该军工机构,FROM是该军工机构所在的国家。
|1.13
|1.13
<!-- These do not work while still being present in the vanilla on_actions files
<!-- These do not work while still being present in the vanilla on_actions files
第948行: 第975行:
|-id="on_mio_industrial_manufacturer_unassigned"
|-id="on_mio_industrial_manufacturer_unassigned"
|on_mio_industrial_manufacturer_unassigned
|on_mio_industrial_manufacturer_unassigned
|Trigger the following commands whenever a MIO is unnasigned from a production line.
| 每当一个军工机构被从一条生产线取消分配时,触发该效果。
|
|
|ROOT is the Military Industrial Organization, FROM is the owner of the MIO
|ROOT 是该军工机构,FROM是该军工机构所在的国家。
|1.13
|1.13
|}
|}

2024年8月9日 (五) 03:49的版本


代码在一个特定的行动发生后被执行,例如当一个国家向另一个国家宣战或者当一个省份变更控制权时触发某种效果。On actions被定义在 /Hearts of Iron IV/common/on_actions/*.txt文件中。

每一个on action都是一个被包含在on_actions = { ... }代码中,也就是on actions文件的根代码块中的独立代码块。每一个on_action最多有2个参数:

  • effect = { ... }存在于每一个单独的on action中,在需要时作为一个效果执行内效果代码。
  • random_events = { ... } 用于on_actions中,其默认作用域(如果没有另行指定,则与ROOT相同)是一个国家,例如on_new_term_election。这将立即随机触发给定权重的指定事件中的事件之一。这是通过概率与权重成正比的随机方法完成的。
0代替事件ID将确保如果随机到该事件时不会有任何事情发生。
另外,当一个事件的trigger = { ... }代码块计算结果为false(即不满足触发条件)时,该事件不会被random_events = { ... }触发。在这种情况下,每个作用域的处理方式与on action的相同:on action的FROM被视为该事件的FROM,对于FROM.FROM也是一样(注:FROM与上文的ROOT相同,都是指代码的作用域,但是在大部分情况下意义不同)。
如果存在多个random_events代码,将从每个块中选择一个事件。

请注意,就作用域而言,ROOT是默认的假定作用域,除非另有指定(在on_actions中,THIS作为一个独立于ROOT的实体),而FROM和FROM.FROM可以作为另外提供的辅助块。

每个on action只能在游戏开始后执行,不受任何通常会触发一次的来自历史文件或剧本的effects = { ... }部分的效果所影响,例如set_politics.

文件示例

on_actions = {
    on_startup = {
        effect = { # NEVER FORGET! Important to include this line to distinguish it from random_events = { ... }
            every_country = {
                limit = {
                    is_ai = no
                }
                country_event = welcome_event.1
            }
            ENG = {
                country_event = { 
                    id = new_year.1
                    days = 365  # Fires on January 1 1937. Remember that leap days do not exist in-game.
                }
            }
        }
    }
    on_state_control_changed = {
        random_events = {
            1 = germany_state_control.1 # Assuming the triggers for the events are met, then
            1 = germany_state_control.2 # fires one of germany_state_control.1 or germany_state_control.2
            3 = 0                       # Each has a 20% chance, and there's 60% chance nothing happens.
        }
        effect = {
            if = {
                limit = {   # Execute if Italy captures Corsica or Savoy from France
                    tag = ITA
                    FROM = { tag = FRA }
                    FROM.FROM = {
                        OR = {
                            state = 1
                            state = 735
                        }
                    }
                }
                FROM.FROM = {
                    set_resistance = 60
                    damage_building = {
                        type = infrastructure
                        damage = 2
                    }
                }
            }
        }
    }
}

常见的on_actions代码

名字 描述 示例 提示 版本
on_startup 在游戏开局(新的一局开始的时候)时触发一次效果。但是加载存档时不触发该效果。
on_startup = { 
    effect = {
        ENG = {
            news_event = { id = news_event.1 days = 31 random_days = 27 } # Fires a news event in February 1936
        }  # assuming the default start date
    }      # Scoping into ENG is necessary, since
}          # news_event is a country-scoped effect
默认作用域为none,而不是像其他P社游戏(如《欧陆风云4》)那样针对每个国家单独触发。如果没有手动将作用域划分到国家、省份或其他地方,许多通常可以在任何作用域内使用的效果将无法工作。 1.3.3
on_daily 在每一天为每个国家分别触发效果(对性能的影响大,请谨慎使用)。
on_daily = {
    effect = {
        if = {
            limit = { has_variable = to_be_updated_daily }
            add_to_variable = { to_be_updated_daily = 1 }
        } 
    }
}
对于scripted guis和添加新机制的mod非常有用(例如可以每天增加一个变量)。只有在小心避免重复效果的情况下才使用该作用域。在每个国家单独执行意味着本质上相当于在每个国家每一天执行一个单独的效果。例如 effect = { GER = { add_political_power = 100 } }将每天增加约100政治点数到德意志国的国旗 德意志国 ,因为世界地图上有约100个国家,这意味着每天将执行约100次。 1.5.2
on_daily_<TAG> 每天为指定国家触发效果(注:TAG就是你要指定的国家)
on_daily_SOV = {
    effect = {  
        if = {
            limit = { has_war_with = GER }
            SOV_escalate_the_war_effect = yes
        }
    }
}
只有在国家存在的前提条件下才能触发该效果,否则无效 1.9
on_weekly 每周为每个国家触发一次效果
on_weekly = {
    effect = {
        if = {
            limit = { 
                has_intelligence_agency = yes
                is_ai = yes
            }
            update_operation_ai = yes
        }
    }
}
对ai脚本很有用。如果num_days_variable能被7整除,则在这一天的开始运行。 1.9
on_weekly_<TAG> 每周为指定国家触发一次效果(注:TAG就是你要指定国家)
on_weekly_BHR = {
    if = {
        limit = {
            has_country_flag = BHR_must_control_states
            any_owned_state = {
                NOT = { is_controlled_by = ROOT }
            }
            has_stability < 0.5
        }
        country_event = BHR_event.0
        clr_country_flag = BHR_must_control_states
    }
}
只有在该国家存在的情况下才执行效果。如果num_days_variable能被7整除,则在这一天的开始运行。 1.9
on_monthly 在每月为每个国家分别触发效果。
on_monthly = { 
    random_events = {
        1 = random_event.0
        99 = 0
    }
}
1.9
on_monthly_<TAG> 在每月为指定国家触发一次效果(注:TAG就是你要指定的国家)
on_monthly_USA = {
    effect = {
        add_to_variable = { USA_unrest = 1 }
        clamp_variable = {
            var = USA_unrest
            max = 10
        }
        if = {
            limit = { 
                check_variable = { USA_unrest = 10 }
            }
            country_event = usa.rebellion.0
        }
    }
}
只有在该国家存在的前提条件下才能执行该效果,否则无效。 1.9

政治相关

名字 描述 示例 提示 版本
on_stage_coup 对没有抵抗运动抵抗运动DLC的国家策划政变使用,每当政变策划时,触发以下效果。
on_stage_coup = { 
    effect = { 
    }
}
ROOT是策划政变的国家,FROM是目标国家。 1.0
on_coup_succeeded 对没有抵抗运动抵抗运动DLC的国家策划政变使用,每当政变成功时,触发以下效果。
on_coup_succeeded = { 
    effect = { 
        random_other_country = { 
            limit = { 
                has_government = democratic
                original_tag = ROOT
            } 
            set_politics = { elections_allowed = yes }
        }
    }
}
ROOT是政变成功的国家,FROM是策划政变的国家。 1.0
on_government_change 每当一个国家更换政府时,触发以下效果。
on_government_change = { effect = {  …  } }
这包括set_politicsstart_civil_war(总是为双方),不包括被傀儡的情况。总是同时触发on_ruling_party_change效果. 1.0
on_ruling_party_change 每当某个国家改变其意识形态时,触发以下命令。
on_ruling_party_change = { effect = {  …  } }
old_ideology_token是一个临时变量,,它将旧的意识形态存储为token。除了包括触发on_government_change的效果外,还包括被傀儡或通过控制台命令改变意识形态的情况。 1.9
on_new_term_election 每当发生选举或被hold_election命令调用时,触发效果。
on_new_term_election = { random_events = { 100 = usa.6 } }
1.0
on_peaceconference_ended 每当和平会议结束时,触发效果。
on_peaceconference_ended = { effect = { … } }
ROOT是赢家(胜利者),FROM是输家(失败方)。也会在使用
white_peace
效果或接受有条件投降时触发。
1.5
on_peaceconference_started 每当和平会议开始时,触发以下命令。
on_peaceconference_started = { effect = { … } }
ROOT是赢家(胜利者),FROM是输家(失败方)。也会在使用
white_peace
效果或接受有条件投降时触发。
1.12.3

外交/战争相关

名字 描述 示例 提示 版本
on_send_volunteers 每当一个国家向另一个国家派遣志愿军时,触发该效果。
on_send_volunteers = {
    effect = { … }
}
ROOT为派遣志愿军的国家,FROM为接收志愿军的国家。 1.9
on_border_war_lost 每当一个国家输掉边境战争时,触发该效果。
on_border_war_lost = {
    effect = {
        owner = {
            add_ideas = lost_conflict
        }
    }
}
“边境战争”是指通过set_border_war效果(在省份上方用橙色条纹表示)启动的以省份为基础的边境战争,而不是模拟国与国之间战斗的边境战争。默认作用域是输掉边界战争的省份。 1.0
on_war_relation_added 每当两个国家最终彼此开战时,触发该效果。(on_war条件效果是当一个国家将要与任意国家发生战争时触发,并且当该国家进入与另一个国家的战争时不会再次触发,除非该国家在再次进入战争前先进入和平状态)
on_war_relation_added = {
    effect = { … }
}
ROOT是宣战方,FROM是被宣战方。 1.9.3
on_declare_war 每当一个国家宣战时,触发该效果。
on_declare_war = {
    effect = {
        if = {
            limit = {
                tag = GER
                FROM = { tag = SOV }
            }
            add_ideas = GER_barbarossa
        }
    }
}
FROM是战争目标,ROOT是宣战国。 1.0
on_war 每当一个国家从和平状态进入战争状态时,触发该命令。
on_war = {
    effect = { … }
}
THIS是刚刚被卷入战争的国家。 1.7
on_peace 每当一个国家不再处于战争状态时(即刚进入和平状态),触发该效果。
on_peace = {
    effect = { … }
}
THIS是不再处于战争状态的国家。 1.7
on_capitulation 每当一个国家投降,在这个过程中,触发该效果。
on_capitulation = {
    effect = { … }
}
ROOT是投降方,FROM是胜利方。在这时,就已经执行了一些效果,例如删除投降方单位和转移设备。 1.0
on_capitulation_immediate 每当一个国家投降,在这个过程开始时,触发该效果。
on_capitulation_immediate = {
    effect = { … }
}
ROOT是投降方,FROM是胜利方。 1.11.5
on_uncapitulation 每当一个先前投降的国家将其状态更改为不再投降时,触发该效果。
on_uncapitulation = {
    effect = { … }
}
ROOT是受影响的国家。 1.4
on_annex 每当一个国家被吞并时,触发该效果。
on_annex = {
    effect = { … }
}
ROOT是胜利方,FROM是被吞并方。对于在内战中的国家,on_civil_war_end效果将同时被触发。 1.3.3
on_civil_war_end_before_annexation 在FROM被吞并之前效果,这意味着这个国家和它拥有的一切仍然存在。
on_civil_war_end_before_annexation = {
    effect = { … }
}
ROOT是吞并方,FROM是被吞并方。总是同时触发on_annexon_civil_war_end 1.6
on_civil_war_end 每当一场内战结束时,触发该效果。
on_civil_war_end = {
    effect = { … }
}
ROOT是内战胜利方,FROM是被吞并方。总是同时触发on_annex 1.0
on_puppet 每当一个国家在和平会议中被傀儡时,触发该效果。
on_puppet = {
    effect = { … }
}
ROOT是被傀儡的国家,FROM是宗主国。 1.0
on_liberate 每当一个国家在和平会议中被解放时,触发该效果。
on_liberate = {
    effect = { … }
}
ROOT是被解放的国家,FROM是解放它的国家。 1.0
on_release_as_free 每当一个国家被释放时,触发该效果。释放可以在各种效果下释放,并不局限于和平会议
on_release_as_free = {
    effect = { … }
}
ROOT是被释放的国家,FROM是释放者。 1.3
on_release_as_puppet 每当在和平时期通过占领地区菜单释放傀儡(或从非核心但占领的领土释放)时,触发该效果。
on_release_as_puppet = {
    effect = { … }
}
ROOT是被释放的国家,FROM是宗主国。 1.3
on_guarantee 每当一个国家保障另一个国家的独立时,触发该效果。
on_guarantee = {
    effect = { … }
}
ROOT是保障的国家,FROM是被保障的国家。
on_military_access 每当一个国家接受军事通行权请求时,触发该效果。
on_military_access = {
    effect = { … }
}
ROOT是请求军通的国家,FROM是接受军通的国家。
on_offer_military_access 每当一个国家接受提供军事通行权请求的提议时,触发该效果。(注意:这个和上面是两个不同的外交选项!)
on_offer_military_access = {
    effect = { … }
}
ROOT是提供的国家,FROM是接受的国家。
on_call_allies 每当一个国家接受战争召唤时,触发该效果。
on_call_allies = {
    effect = { … }
}
ROOT是发出召唤的国家,FROM是加入战争的国家。
on_join_allies 每当一个国家加入盟友的战争时,触发该效果。
on_join_allies = {
    effect = { … }
}
ROOT是加入战争的国家,FROM是战争被加入的国家。
on_lend_lease 每当一个国家起草的租借法案被接受时,触发该效果。
on_lend_lease = {
    effect = { … }
}
ROOT是发出租借法案的国家,FROM是接受租借法案的国家。
on_incoming_lend_lease 每当一个国家接受请求租借时,触发该效果。
on_incoming_lend_lease = {
    effect = { … }
}
ROOT是接受请求的国家,FROM是发出请求的国家。
on_send_expeditionary_force 每当一个国家接受派遣远征军时,触发该效果。
on_send_expeditionary_force = {
    effect = { … }
}
ROOT是派遣远征军的国家,FROM是接受的国家。
on_return_expeditionary_forces 每当一个国家撤回他们的远征军时,触发该效果。
on_send_expeditionary_force = {
    effect = { … }
}
ROOT是部队的所有者(派遣方),FROM是部队被派遣到的国家。
on_request_expeditionary_forces 每当一个国家要求军队指挥权时,触发该效果。
on_request_expeditionary_forces = {
    effect = { … }
}
ROOT是发出要求的国家,FROM是要求的目标国家。
on_ask_for_state_control 每当一个国家接受要求接管占领区的请求时,触发该效果。
on_ask_for_state_control = {
    effect = { … }
}
ROOT是发出请求的国家,FROM是控制该占领区的国家。
on_give_state_control 每当一个国家接受移交占领区的请求时,触发该效果。
on_give_state_control = {
    effect = { … }
}
ROOT是移交占领区的国家,FROM是接受的国家。
on_peace_proposal 每当一个国家接受有条件投降时,触发该效果。
on_peace_proposal = {
    effect = { … }
}
ROOT是发起有条件投降的国家,FROM是接受的国家。
on_send_attache 每当派遣军事顾问被接受时,触发该效果。
on_send_attache = {
    effect = { … }
}
默认作用域是派遣的国家,FROM是接受的国家。

阵营相关

Name Description Examples Notes Version Added
on_create_faction 每当一个国家创建一个阵营时,触发该效果。
on_create_faction = { effect = { … } }
FROM是加入该阵营的国家。 1.0
on_faction_formed 每当一个阵营创建完成时,触发该效果。
on_faction_formed = { effect = { news_event = { id = news.159 } } }
1.0
on_offer_join_faction 每当一个国家被邀请加入一个阵营时,触发该效果。
on_offer_join_faction = { effect = { … } }
FROM是被邀请的国家,THIS和ROOT是阵营领袖。 1.0
on_join_faction 每当一个国家提出加入阵营并被接受时,触发该效果。
on_join_faction = { effect = { … } }
FROM是阵营领袖,ROOT和THIS是加入的国家。 1.0
on_assume_faction_leadership 每当一个国家接管一个阵营时,触发该效果。
on_assume_faction_leadership = { effect = { … } }
ROOT是新的阵营领袖,FROM是旧的阵营领袖。 1.7
on_leave_faction 每当一个国家离开一个阵营时,触发该效果。
on_leave_faction = { effect = { if = { limit = { AND = { tag = CAN NOT = { has_dlc = "Together for Victory" } } } drop_cosmetic_tag = yes } }
FROM是阵营领袖,ROOT是离开阵营的国家。 1.0

附属国相关

名字 描述 例子 提示 版本
on_subject_annexed 每当一个国家吞并一个傀儡时,触发该效果。
on_subject_annexed = { effect = {  …  } }
ROOT是傀儡国, FROM是宗主国。 1.0
on_subject_free 每当一个国家同意傀儡独立时,触发该效果。
on_subject_free = { effect = {  …  } }
ROOT是傀儡国, FROM是宗主国。 1.0
on_subject_autonomy_level_change 每当一个傀儡的自治级别发生变化时,触发该效果。
on_subject_autonomy_level_change = { effect = {  …  } }
ROOT是傀儡国, FROM是宗主国。 1.0

流亡政府相关

名字 描述 例子 提示 版本
on_government_exiled 每当一个国家成为流亡政府时,触发该效果。
on_government_exiled = { effect = { = { … } }
ROOT是流亡政府,FROM是收容流亡政府的国家。 1.6
on_host_changed_from_capitulation 每当一个流亡政府所在的国家投降时,触发该效果。
on_host_changed_from_capitulation= { effect = { = { … } }
ROOT是流亡政府,FROM的收容流亡政府的国家,FROM:FROM之前收容流亡政府的国家。 1.6
on_exile_government_reinstated 每当一个国家结束流亡状态时,触发该效果。
on_exile_government_reinstated = { effect = { = { … } }
ROOT是流亡政府,FROM是之前收容流亡政府的国家。 1.6

省份相关

名字 描述 示例 提示 版本
on_state_control_changed 每当一个省份的控制权变更时,触发该效果。
on_state_control_changed = {
    effect = {
        if = {
            limit = {
                FROM.FROM = { state = 123 }
            }
            if =  {
                limit = {
                    tag = BHR
                }
                FROM.FROM = {
                    set_state_name = STATE_123_BHR
                    set_province_name = {
                        id = 1234
                        name = VICTORY_POINTS_1234_BHR
                    }
                }
            }
            else = { # Unnested else is preferred over nested
                FROM.FROM = {
                    reset_state_name = yes
                    reset_province_name = 1234
                }
            }
        }
    }
}
ROOT是该省份新的控制者,FROM该省份之前的控制者,FROM.FROM 是省份ID。 1.4

战争目标相关

名字 描述 示例 提示 版本
on_generate_wargoal 每当一个国家生成一个战争目标时,触发该效果。
on_generate_wargoal = {  }
ROOT是战争目标的拥有国家,FROM是战争目标的目标国家。
on_justifying_wargoal_pulse 每当一个国家被作为正当化战争的目标时,触发该效果。
on_justifying_wargoal_pulse = { random_events = { 100 = war_justification.1 } }
FROM是战争目标的目标国家。每天进行检查 1.0
on_wargoal_expire 每当战争目标到期时,触发该效果。
on_wargoal_expire = { random_events = { 100 = war_justification.301 } }
FROM是战争目标的拥有国家。 1.0

将领相关

名字 描述 示例 提示 版本
on_unit_leader_created 每当招募一名新将领时,触发该效果。
on_unit_leader_created = { effect = { … } }
FROM是该将领所在国家,ROOT是该将领。 1.5
on_army_leader_daily 在每一天为一名将领触发该效果。
on_army_leader_daily = { effect = { … } }
FROM是该将领所在国家,ROOT是该将领。 1.0
on_army_leader_won_combat 每当一名将领打赢一场战斗时,触发该效果。
on_army_leader_won_combat = { effect = { … } }
FROM是该将领所在国家,ROOT是该将领。 1.0
on_army_leader_lost_combat 每当一名将领打输一场战斗时,触发该效果。
on_army_leader_lost_combat = { effect = { … } }
FROM是该将领所在国家,ROOT是该将领。 1.0
on_unit_leader_level_up 每当一名将领获得升级时,触发该效果。
on_unit_leader_level_up = { effect = { … } }
FROM是该将领所在国家,ROOT是该将领。 1.0
on_army_leader_promoted 每当一名将领晋升为元帅时,触发该效果。
on_army_leader_promoted = { effect = { add_timed_unit_leader_trait = { trait = recently_promoted days = 100 } } }
FROM是该将领所在国家,ROOT是该将领。 1.0
on_unit_leader_promote_from_ranks_veteran 每当一名战地军官晋升为将军时,触发该效果。
on_unit_leader_promote_from_ranks_veteran = { effect = { … } }
FROM是该战地军官所在的单位,OWNER是该战地军官所在的国家,ROOT是该战地军官。 1.12
on_unit_leader_promote_from_ranks_green 每当一名战地军官晋升为将军时,触发该效果。
on_unit_leader_promote_from_ranks_green = { effect = { … } }
FROM是该战地军官所在的单位,OWNER是该战地军官所在的国家,ROOT是该战地军官。 1.12

军事相关

名字 描述 示例 提示 版本
on_nuke_drop 每当一个国家投掷核弹时,触发该效果。
on_nuke_drop = {
    effect = {
        set_global_flag = first_nuke_dropped
    }
}
ROOT是发射核弹的国家,FROM是被核弹打击的省份。 1.0
on_pride_of_the_fleet_sunk 每当一个国家的舰队荣耀被击沉时,触发该效果。
on_pride_of_the_fleet_sunk = {
    effect = {
        if = {
            limit = {
                tag = ENG
            }
            FROM = { set_country_flag = achievements_pride_and_extreme_prejudice }
        }
    }
}
FROM是击沉舰队荣耀的国家,ROOT是被击沉舰队荣耀的国家。 1.6
on_naval_invasion 每当海上入侵发生时,触发该效果。
on_naval_invasion = {
    effect = { 
        ROOT = {    # Unlike most on_actions, ROOT isn't the default scope
            add_political_power = 100
        }
    }
}
THIS(默认作用域)是被入侵的省份,ROOT是入侵的国家,FROM是入侵开始的省份。 1.9
on_paradrop 每当空投发生时,触发该效果。
on_paradrop = { 
    effect = {
        FROM = {
            controller = {
                add_war_support = 0.01
            }
        }
    }
}
THIS (默认作用域)是未被空投的省份,ROOT是被空投的省份,FROM是进行空投的国家。 1.9
on_units_paradropped_in_state 这与on_paradrop的不同之处在于它对每一次空投运行一次,而不是对每个空投的单位运行一次。
on_paradrop = { 
    effect = {
        FROM = {
            controller = {
                add_war_support = 0.01
            }
        }
    }
}
ROOT是被空投的省份,FROM是进行空投的国家。
on_add_history 每当接收到单位的战斗历史记录时,触发该效果。
on_add_history = { effect = { … } }
ROOT是该单位。 1.12

王牌飞行员相关

名字 描述 示例 提示 版本
on_ace_promoted 每当创建一个王牌飞行员时,触发该效果。
on_ace_promoted = { random_events = { 100 = ace_promoted.1 } }
FROM是该王牌飞行员。 1.0
on_ace_killed 每当一个王牌飞行员被消灭时,触发该效果。
on_ace_killed = { random_events = { 100 = ace_died.1 } }
FROM是该王牌飞行员。 1.0
on_ace_killed_on_accident 每当我方王牌飞行员在意外中死亡时,触发该效果。
on_ace_killed_on_accident = { random_events = { 100 = ace_died.1 } }
FROM是我方意外死亡的王牌飞行员。 1.9
on_non_ace_killed_other_ace 每当我方非王牌飞行员击落敌方王牌飞行员时,触发该效果。
on_non_ace_killed_other_ace = { FROM = { random_events = { 100 = ace_died.1 } } }
FROM是该敌方王牌飞行员。 1.9
on_ace_killed_by_ace 每当一个王牌飞行员被另一个王牌飞行员击落(敌方击落我方)时,触发该效果。
on_ace_killed_by_ace = { random_events = { 100 = ace_killed_by_ace.1 } }
FROM是我方王牌飞行员,PREV是击落FROM的敌方王牌飞行员 1.0
on_ace_killed_other_ace 每当一个王牌飞行员被另一个王牌飞行员击落(我方击落敌方)时,触发该效果。
on_ace_killed_other_ace = { random_events = { 100 = ace_killed_other_ace.1 } }
FROM是我方王牌飞行员,PREV是被FROM击落的敌方王牌飞行员。 1.0
on_aces_killed_each_other 每当两个王牌飞行员在空中对决中同归于尽时,触发该效果。
on_aces_killed_each_other = { random_events = { 100 = aces_killed_each_other.1 } }
FROM是我方王牌飞行员,PREV是敌方王牌飞行员。 1.0

抵抗运动相关

名字 描述 示例 提示 版本
on_operation_completed 每当一名特工完成任务时,触发该效果。
on_operation_completed = { effect = { … } }
THIS是该特工,ROOT是发起行动的国家,FROM是目标国家。 1.9
on_operative_detected_during_operation 每当一名特工死亡时,触发该效果。
on_operative_death = { effect = { … } }
THIS是该特工,ROOT是杀死该特工的国家(可选),FROM是该特工执行任务的目标国家,FROM.FROM是任务状态(仅在任务有特定选择目标时设置)。 1.9
on_operative_on_mission_spotted 每当一名特工在一个国家执行破坏任务时,触发该效果。
on_operative_on_mission_spotted = { effect = { … } }
THIS是该特工,FROM是该特工正在执行任务所在的国家,ROOT是该特工所属国家。 1.9
on_operative_captured 每当一名特工被俘获时,触发该效果。
on_operative_captured = { effect = { … } }
THIS是该特工,ROOT是该特工执行任务所在的国家,FROM是该特工为其服务的国家。 1.9
on_operative_created 每当一名特工被创建时,触发该效果。
on_operative_created = { effect = { … } }
THIS是该特工,FROM是创建该特工的国家。 1.9.1
on_operative_death 每当一名特工死亡时,触发该效果。
on_operative_death = { effect = { … } }
THIS是该特工,ROOT是杀死该特工的国家(可选),FROM是该特工所属国家。 1.9
on_operative_recruited 每当一名特工被招募时,触发该效果。
on_operative_recruited = { effect = { … } }
THIS是该特工,FROM是创建该特工的国家。 1.9.1
on_fully_decrypted_cipher 每当一个国家完全破译了目标国家的密码时,触发该效果。
on_fully_decrypted_cipher = { effect = { … } }
THIS是密码被破译的国家,FROM是破译密码的国家。 1.9
on_activated_active_decryption_bonuses 每当一个国家针对目标国家激活已破译密码的加成效果时,触发该效果。
on_activated_active_decryption_bonuses = { effect = { … } }
THIS是目标国家,FROM是激活加成效果的国家。 1.9

军工组织系统相关

名字 描述 示例 提示 版本
on_mio_size_increased 每当一个军工机构的规模增长(升级)时,触发该效果。 ROOT是该军工机构,FROM是该军工机构所在的国家。 1.13
on_mio_design_team_assigned_to_tech 每当一个军工机构被分配给科技研究时,触发该效果。 ROOT是该军工机构,FROM是该军工机构所在的国家。 1.13
on_mio_design_team_assigned_to_variant 每当一个军工机构被分配给一个装备的衍生型号时,触发该效果。 ROOT是该军工机构,FROM是该军工机构所在的国家。 1.13
on_mio_industrial_manufacturer_assigned 每当一个军工机构被分配到一条生产线时,触发该效果。 ROOT是该军工机构,FROM是该军工机构所在的国家。 1.13
on_mio_industrial_manufacturer_unassigned 每当一个军工机构被从一条生产线取消分配时,触发该效果。 ROOT是该军工机构,FROM是该军工机构所在的国家。 1.13