执行

本页面所适用的版本可能已经过时,最后更新于1.9


杂项

名称 描述 示范 注释 Version Added
on_startup 在新游戏的第一天触发(不包括保存与加载) on_startup = { effect = { ... } } 1.0
on_daily 每一天对每个国家触发(对性能要求高,要谨慎使用呀~) on_daily = { effect = { ... } } 对于给mod添加新机制很有用(比如说可以每天新增一个变量) 1.5.2
on_weekly 每周对每个国家触发 on_weekly = { effect = { ... } } 对于写ai的脚本很有用 1.9
on_weekly_TAG 每周对指定(TAG)的国家触发 on_weekly_TAG = { effect = { ... } } 1.9
on_monthly 每月对每个国家触发 on_monthly = { effect = { ... } } 1.9
on_monthly_TAG 每周对指定(TAG)的国家触发 on_monthly_TAG = { effect = { ... } } 1.9
on_nuke_drop 当有国家丢核弹时触发命令 on_nuke_drop = {effect = { set_global_flag = first_nuke_dropped } } FROM是被炸的省份 1.0
on_pride_of_the_fleet_sunk 当有国家的舰队荣耀被击沉时触发命令 on_pride_of_the_fleet_sunk = { effect = { ... } } FROM是击沉它的国家, ROOT 是被击沉的国家 1.6
on_naval_invasion Triggers the following commands whenever a sea invasion is made. on_naval_invasion = { effect = { ... } } THIS state that is invaded, ROOT country that invades, FROM state that the invasion started 1.9
on_paradrop Triggers the following commands whenever a landing occurs. on_paradrop = { effect = { ... } } THIS state that is invaded, ROOT country that invades, FROM state that the invasion started 1.9

政治

Name Description Examples Notes Version Added
on_coup_succeeded Trigger the following commands whenever a coup succeeds. on_coup_succeeded = { effect = { random_other_country = { limit = { has_government = democratic original_tag = ROOT } set_politics = { elections_allowed = yes } } } } 1.0
on_government_change Trigger the following commands whenever a country switch government. on_government_change = { effect = { ... } } 1.0
on_ruling_party_change Trigger the following commands whenever a country switch ideology. on_ruling_party_change = { effect = { ... } } 1.9
on_new_term_election Trigger the following commands whenever an election happen or is called by the hold_election command. on_new_term_election = { random_events = { 100 = usa.6 } } 1.0
on_peaceconference_ended Trigger the following commands whenever a peace conference ends. on_peaceconference_ended = { effect = {...} } ROOT is the winner, FROM is the loser. 1.0

外交/战争

Name Description Examples Notes Version Added
on_send_volunteers Trigger the following commands whenever a country send volunteers to another. on_send_volunteers = { effect = {...} } ROOT is sender, FROM is receiver. 1.9
on_border_war_lost Trigger the following commands whenever a country lose a border war. on_border_war_lost = { effect = { owner = { country_event = { id = china.14 } } } } 1.0
on_declare_war Trigger the following commands whenever a country declares war. on_declare_war = { effect = { if = { limit = { ROOT = { tag = SOV } FROM = { has_idea = anti_soviet_pact } } } } } FROM is war target. 1.0
on_war Trigger the following commands whenever a country has just entered a war. on_war = { effect = { = {...} } #THIS is country that has just gotten into a war. 1.9
on_capitulation Trigger the following commands whenever a country capitulates. on_capitulation = { effect = {...} } ROOT is capitulated country, FROM is winner. 1.0
on_uncapitulation Trigger the following commands whenever a country that was previously capitulated changes its status to no longer having capitulated. on_uncapitulation = { effect = {...} } ROOT is the country affected. 1.6
on_annex Trigger the following commands whenever a country is annexed. on_annex = { effect = { = {...} } ROOT is winner, FROM gets annexed. For civil wars on_civil_war_end is also fired. 1.0
on_civil_war_end_before_annexation Trigger the following commands just before FROM gets annexed, meaning the country and everything it owns still exists. on_civil_war_end_before_annexation = { effect = { = {...} } ROOT is winner, FROM gets annexed. It will also fire on_annex and on_civil_war_end. 1.6
on_civil_war_end Trigger the following commands whenever a civil war ends. on_civil_war_end = { effect = { = {...} } ROOT is civil war winner, FROM gets annexed. This will also fire on_annex. 1.0
on_puppet Trigger the following commands whenever a country is puppeted in a peace conference only. on_puppet = { effect = { = {...} } ROOT is the nation being puppeted, FROM is the overlord. 1.0
on_liberate Trigger the following commands whenever a country is liberated in a peace conference only. on_liberate = { effect = { = {...} } ROOT is the nation being liberated, FROM is the leader of the liberators. 1.0
on_release_as_free Trigger the following commands whenever a country is released. on_release_as_free = { effect = { = {...} } #ROOT is free nation FROM is releaser. 1.0
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). on_release_as_puppet = { effect = { = {...} } ROOT is the nation being released, FROM is the overlord. 1.0
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) on_war_relation_added = { effect = { = {...} } ROOT is attacker, FROM is defender 1.9.3

阵营

Name Description Examples Notes Version Added
on_create_faction Trigger the following commands whenever a country create a faction. on_create_faction = { effect = {...} } FROM is the one that joins the faction. 1.0
on_faction_formed Trigger the following commands when a faction is formed. on_faction_formed = { effect = { news_event = { id = news.159 } } } 1.0
on_offer_join_faction Trigger the following commands whenever a country is invited in a faction. on_offer_join_faction = { effect = {...} } FROM is the country invited. 1.0
on_join_faction Trigger the following commands for a faction leader whenever a country is invited in his faction. on_join_faction = { effect = {...} } FROM is faction leader on join faction requests. 1.0
on_assume_faction_leadership Trigger the following commands whenever a country assumes leadership of a faction. on_assume_faction_leadership = { effect = {...} } FROM is the former faction leader. 1.6
on_leave_faction Trigger the following commands whenever a country leave a faction. on_leave_faction = { effect = { if = { limit = { AND = { tag = CAN NOT = { has_dlc = "Together for Victory" } } } drop_cosmetic_tag = yes } } 1.0

自治权

Name Description Examples Notes Version Added
on_subject_annexed Trigger the following commands when a country annex a subject. on_subject_annexed = { effect = { ... } } ROOT is the subject, FROM is the overlord. 1.0
on_subject_free Trigger the following commands when a country grants freedom to a puppet. on_subject_free = { effect = { ... } } ROOT is the subject, FROM is the previous overlord. 1.0
on_subject_autonomy_level_change Trigger the following commands when the autonomy level of a puppet changes. on_subject_autonomy_level_change = { effect = { ... } } ROOT is the subject, FROM is the overlord. 1.0

流亡政府

Name Description Examples Notes Version Added
on_government_exiled Trigger the following commands whenever a country becomes a government in exile. on_government_exiled = { effect = { = {...} } ROOT is the government in exile, FROM is the country that is hosting the government in exile. 1.6
on_host_changed_from_capitulation Trigger the following commands whenever a country that is hosting a government in exile has capitulated. on_host_changed_from_capitulation= { effect = { = {...} } 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. 1.6
on_exile_government_reinstated Trigger the following commands whenever a country has returned from governing in exile. on_exile_government_reinstated = { effect = { = {...} } ROOT is the government in exile, FROM is the country that was hosting the government in exile. 1.6

省份

Name Description Examples Notes Version Added
on_state_control_changed Trigger the following commands when a state's controller changes. on_state_control_changed = { effect = { ... } } ROOT is new controller, FROM is old controller, FROM.FROM is state ID. 1.0

战争目标

Name Description Examples Notes Version Added
on_justifying_wargoal_pulse Trigger the following commands whenever the country is targeted by a wargoal under justification. on_justifying_wargoal_pulse = { random_events = { 100 = war_justification.1 } } FROM = target nation. Checked every day. 1.0
on_wargoal_expire Trigger the following commands whenever a wargoal expire. on_wargoal_expire = { random_events = { 100 = war_justification.301 } } FROM is the wargoal owner. 1.0

领袖

Name Description Examples Notes Version Added
on_unit_leader_created Trigger the following commands when an army leader is created. on_unit_leader_created= { effect = {...} } FROM is owner country, ROOT is the unit leader 1.5
on_army_leader_daily Trigger the following commands on an army leader each day. on_army_leader_daily = { effect = {...} } FROM is owner country. 1.0
on_army_leader_won_combat Trigger the following commands whenever an army leader won a combat. on_army_leader_won_combat = { effect = {...} } FROM is owner country. 1.0
on_army_leader_lost_combat Trigger the following commands whenever an army leader lost a combat. on_army_leader_lost_combat = { effect = {...} } FROM is owner country. 1.0
on_unit_leader_level_up Trigger the following commands when a leader gain a level. on_unit_leader_level_up = { effect = {...} } 1.0
on_army_leader_promoted Trigger the following commands whenever an army leader is promoted. on_army_leader_lost_combat = { effect = { add_timed_unit_leader_trait = { trait = recently_promoted days = 100 } } } 1.0

王牌飞行员

Name Description Examples Notes Version Added
on_ace_promoted Trigger the following commands whenever an ace is created. on_ace_promoted = { random_events = { 100 = ace_promoted.1 } } FROM = ace. 1.0
on_ace_killed Trigger the following commands whenever an aces is killed. on_ace_killed = { random_events = { 100 = ace_died.1 } } FROM = ace. 1.0
on_ace_killed_on_accident Trigger the following commands whenever our aces died on accident. on_ace_killed_on_accident = { random_events = { 100 = ace_died.1 } } FROM = our ace died in accident. 1.9
on_non_ace_killed_other_ace Trigger the following commands whenever non ace killed enemy ace. on_non_ace_killed_other_ace = { FROM = { random_events = { 100 = ace_died.1 } } } FROM = enemy ace. 1.9
on_ace_killed_by_ace Trigger the following commands whenever an aces is killed by another ace. on_ace_killed_by_ace = { random_events = { 100 = ace_killed_by_ace.1 } } FROM = our ace, PREV = enemy ace, has killed FROM. 1.0
on_ace_killed_other_ace Trigger the following commands whenever an aces is killed by another ace (surviving ace side). on_ace_killed_other_ace = { random_events = { 100 = ace_killed_other_ace.1 } } FROM = our ace, PREV = enemy ace, killed by FROM. 1.0
on_aces_killed_each_other Trigger the following commands whenever two aces kill each other in air duel. on_aces_killed_each_other = { random_events = { 100 = aces_killed_each_other.1 } } FROM = ace, PREV = enemy ace. 1.0

抵抗运动

Name Description Examples Notes Version Added
on_operation_completed Trigger the following commands whenever an operative completed. on_operation_completed = { effect = {...} } THIS - the operative, ROOT - the initiating country, FROM - the target country. 1.9
on_operative_detected_during_operation Trigger the following commands whenever an operative dies. on_operative_death = { effect = {...} } 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). 1.9
on_operative_on_mission_spotted Trigger the following commands whenever an operative performing an offensive mission in a country. on_operative_on_mission_spotted = { effect = {...} } THIS - the operative, FROM - the country the operative was performing its mission in, ROOT - the country the operative is operating for. 1.9
on_operative_captured Trigger the following commands whenever an operative is captured. on_operative_captured = { effect = {...} } THIS - the operative, ROOT - the country the operative was performing its mission in, FROM - the country the operative is operating for. 1.9
on_operative_death Trigger the following commands whenever an operative dies. on_operative_death = { effect = {...} } THIS - the operative, ROOT - the killer country (optional), FROM - the country the operative is operating for. 1.9
on_fully_decrypted_cipher Trigger the following commands whenever a country fully decrypts cipher of a target country. on_fully_decrypted_cipher = { effect = {...} } THIS - the target country that its cipher is decrypted, FROM - the decrypter country. 1.9
on_activated_active_decryption_bonuses Trigger the following commands whenever a country activates its active cipher bonuses against a target. on_activated_active_decryption_bonuses = { effect = {...} } THIS - the target country, FROM - the country that activates its bonuses. 1.9