效果(Effects),也叫指令(Commands),用於在特定作用域內動態地影響遊戲。
效果(也稱為命令)用於從特定作用域內動態效果遊戲。它們是對遊戲當前狀態的一次性更改,沒有產生持久效果的能力。相反,修正用於對遊戲的條件產生連續的、永恆的效果,可以用數字表示。效果塊不能用於直接應用修正,但是它們可以添加可以應用修正的內容,最常見的是add_ideas。
效果在整個遊戲中用於多種作用域,最常見的是國策、事件和決議。
請注意,某些效果可能會從變量中獲取值,即 這在效果參數中由<變量>表示。有關變量效應的信息,有關變量效果的信息,參見變量
注意某些效果可能會需要變量的值,例如:
add_manpower = var:my_var
.
這在效果的參數中用變量的值表示。
效果列表可能已過時。完整但未排序的效果列表可以在/Hearts of Iron IV/documentation/effects_documentation.html 或/Hearts of Iron IV/document/effects_documentation.md中找到。
作用域
這些不用作效果,而是作為作用域,用於更改正在為其執行效果的對象。
名稱 | 用法 | 目標類型 | 例子 | 描述 | 添加的版本 |
---|---|---|---|---|---|
every_possible_country | 始終可用 | 國家 | every_possible_country = { ... } | 對每個達到限制的國家/地區(包括不存在的國家/地區)執行子項效果。 | 1.11 |
every_country | 始終可用 | 國家 | every_country = { … } | 對達到限制的每個國家/地區執行包含效果。 | 1.0 |
random_country | 始終可用 | 國家 | random_country = { … } | 對滿足限制的隨機國家/地區執行包含的效果。 | 1.0 |
every_other_country | 僅在國家作用域內 | 國家 | every_other_country = { … } | 對滿足限制且與包含限制的國家/地區不同的國家/地區執行包含效果。 | 1.0 |
random_other_country | 僅在國家作用域內 | 國家 | random_other_country = { … } | 對滿足限制且與包含該國家/地區不同的隨機國家/地區執行包含效果。 | 1.0 |
every_country_with_original_tag | 始終可用 | 國家 | every_country_with_original_tag = {
original_tag_to_check = TAG #required … #運行的效果 } |
對滿足限制並具有指定原始標籤的每個國家/地區執行包含的效果。 | 1.9 |
random_country_with_original_tag | 始終可用 | 國家 | random_country_with_original_tag = {
original_tag_to_check = TAG #required … #運行的效果 } |
對滿足限制並具有指定原始標籤的隨機國家/地區執行包含的效果。 | 1.9 |
every_neighbor_country | 僅在國家作用域內 | 國家 | every_neighbor_country = { … } | 對滿足限制並與所包含的國家/地區接壤的每個國家/地區執行包含效果。 | 1.0 |
random_neighbor_country | 僅在國家作用域內 | 國家 | random_neighbor_country = { … } | 對符合限制並與包含該國家/地區接壤的隨機國家/地區執行包含效果。 | 1.0 |
every_occupied_country | 僅在國家作用域內 | 國家 | every_occupied_country = { … } | 對達到限制的每個國家/地區執行包含效果,並且其任何核心狀態都由該限制所在的國家/地區控制。 | 1.0 |
random_occupied_country | 僅在國家作用域內 | 國家 | random_occupied_country = { … } | 對滿足限制的隨機國家/地區執行包含效果,並且其任何核心狀態都由該國家/地區控制。 | 1.0 |
every_enemy_country | 僅在國家作用域內 | 國家 | every_enemy_country = { … } | 對每個達到限制的國家/地區執行包含效果,並與其中包含的國家/地區交戰 | 1.0 |
random_enemy_country | 僅在國家作用域內 | 國家 | random_enemy_country = { … } | 對滿足限制的隨機國家/地區執行包含效果,並與其中包含的國家/地區交戰。 | 1.0 |
every_subject_country | 僅在國家作用域內 | 國家 | every_subject_country = { … } | 對滿足限制的每個國家/地區執行包含效果,並且是其中包含該限制的國家/地區的附庸。 | 1.11 |
random_subject_country | 僅在國家作用域內 | 國家 | random_subject_country = { … } | 對符合限制的隨機國家/地區執行包含效果,並且是其中包含該國家/地區的附庸政權。 | 1.11 |
every_state | 始終可用 | state | every_state = { … } | 對滿足限制的每個state執行包含的效果。 | 1.0 |
random_state | 始終可用 | state | random_state = {
limit = { 123 321 } #可選 … #運行的效果 } |
對滿足限制的隨機state執行包含的效果。 | 1.0 |
every_neighbor_state | 僅在state作用域內 | state | every_neighbor_state = { … } | 對滿足限制的每個state執行包含的效果,並與包含該限制的狀態相鄰。 | 1.0 |
random_neighbor_state | 僅在state作用域內 | state | random_neighbor_state = { … } | 對滿足限制的隨機state執行包含效果,並與該狀態所包含的狀態相鄰。不支持優先級排序。 | 1.0 |
every_owned_state | 僅在國家作用域內 | state | every_owned_state = { … } | 對滿足限制且歸其所在國家/地區所有的每個state執行包含效果。 | 1.0 |
random_owned_state | 僅在國家作用域內 | state | random_owned_state = {
limit = { 123 321 } #可選 … #運行的效果 } |
對滿足限制的隨機state執行包含效果,並且該狀態歸其中包含該狀態的國家/地區所有。 | 1.0 |
every_core_state | 僅在國家作用域內 | state | every_core_state = { … } | 對滿足限制的每個state執行包含效果,並且是其中包含的國家/地區的核心。 | 1.11 |
random_core_state | 僅在國家作用域內 | state | random_core_state = {
limit = { 123 321 } #可選 … #運行的效果 } |
對滿足限制的隨機state執行包含的效果,並且是包含該狀態的國家/地區的核心。 | 1.11 |
every_controlled_state | 僅在國家作用域內 | state | every_controlled_state = { … } | 對滿足限制的每個state執行包含效果,並受其包含的國家/地區控制。 | 1.9 |
random_controlled_state | 僅在國家作用域內 | state | random_controlled_state = {
limit = { 123 321 } #可選 … #運行的效果 } |
對滿足限制的隨機state執行包含效果,並由其中包含該狀態的國家/地區控制。 | 1.9 |
random_owned_controlled_state | 僅在國家作用域內 | state | random_owned_controlled_state = {
limit = { 123 321 } #可選 … #運行的效果 } |
對滿足限制的隨機state執行包含效果,並且由其中包含該狀態的國家/地區擁有和控制。 | 1.9 |
every_unit_leader | 僅在國家作用域內 | 人物 | every_unit_leader = { … } | 對每個符合限制的將領人(元帥、元帥、海軍上將)執行包含效果,並由其中包含的國家招募。 | 1.5 |
random_unit_leader | 僅在國家作用域內 | 人物 | random_unit_leader = { … } | 對符合限制的隨機將領人(元帥、陸軍元帥、海軍上將)執行包含效果,並由其中包含的國家 | 1.5 |
every_army_leader | 僅在國家作用域內 | 人物 | every_army_leader = { ... } | 對每個達到限制的軍隊領導人執行包含效果,並由其中包含的國家招募。 | 1.5 |
random_army_leader | 僅在國家作用域內 | 人物 | random_army_leader = { … } | 對達到限制的隨機軍隊首領執行包含效果,並被包含該國家/地區招募。 | 1.5 |
global_every_army_leader | 始終可用 | 人物 | global_every_army_leader = { … } | 對每個達到限制的軍隊首領執行包含效果。最好使用every_army_leader除非有必要使用global_every_army_leader。 | 1.5 |
every_navy_leader | 僅在國家作用域內 | 人物 | every_navy_leader = { … } | 對每個達到限制的海軍將領執行包含效果,並被其中包含的國家招募。 | 1.5 |
random_navy_leader | 僅在國家作用域內 | 人物 | random_navy_leader = { … } | 對達到限制的隨機海軍將領執行包含效果,並由其中包含的國家/地區招募。 | 1.5 |
every_operative | 僅在國家/地區作用域內或業務作用域內 | 特工 | every_operative = { … } | 對每個達到限制的特工執行包含效果,並由其中包含的國家招募。 | 1.9 |
random_operative | 僅在國家/地區作用域內或業務作用域內 | 特工 | random_operative = { … } | 對符合限制的隨機特工執行包含的效果,並由其中包含的國家/地區招募。 | 1.9 |
every_character | 僅在國家作用域內 | 人物 | every_character = { … } | 對每個符合限制的角色執行包含效果,並由其中包含的國家/地區招募。 | 1.11 |
random_character | 僅在國家作用域內 | 人物 | random_character = { … } | 對符合限制的隨機字符執行包含效果,並由其中包含該字符的國家/地區招募。 | 1.11 |
every_country_division | 僅在國家作用域內 | 師旅 | every_country_division = { … } | 對滿足限制且歸當前國家/地區所有的每個部隊執行包含效果。 | 1.12 |
random_country_division | 僅在國家作用域內 | 師旅 | random_country_division = { … } | 對滿足限制且歸當前國家/地區擁有的隨機部隊執行包含的效果。 | 1.12 |
every_state_division | 僅在state作用域內 | 師旅 | every_state_division = { … } | 對滿足限制且位於當前狀態中的每個部隊執行包含的效果。 | 1.12 |
random_state_division | 僅在state作用域內 | 師旅 | random_state_division = { … } | 對滿足限制且位於當前狀態內的隨機部隊執行包含的效果。 | 1.12 |
在博斯普魯斯之戰DLC中添加的新效果
名字 | 參數 | 示例 | 描述 | 注釋 | 添加
版本 |
---|---|---|---|---|---|
add_victory_points | 給一個省份增加勝利點 | add_victory_points = { province = (省份id) value = (数量) } |
給一個省份增加勝利點 | 接受負值 | 1.10 |
set_victory_points | 設置一個省份的勝利點 | set_victory_points = { province = (省份id) value = (数量) } |
設置一個省份的勝利點 | 接受負值 | 1.10 |
在抵抗組織DLC(La Resistance)中添加的新效果(Effect)
名字 | 參數 | 示例 | 描述 | 注釋 | 添加
版本 |
---|---|---|---|---|---|
create_intelligence_agency | 可以自動建立一個情報機構 | create_intelligence_agency = yes
|
建立一個情報機構 | 1.9 | |
upgrade_intelligence_agency | 可以自動解鎖一項情報機構升級 | upgrade_intelligence_agency = upgrade_form_department upgrade_intelligence_agency = <情报机构升级名称>
|
解鎖一項情報機構升級 | 情報機構升級項目可以在目錄 common/intelligence_agency_upgrades 中被找到 | 1.9 |
kill_ideology_leader | 可以殺死一個屬於一個準確的意識形態的國家領導人 | kill_ideology_leader = communism kill_ideology_leader = <意识形态名称>(democratic,facism,communism)
|
殺死當前作用域的指定意識形態領導人 | 1.9 | |
transfer_units_fraction | 可以精確地將一個國家的一部分軍隊和裝備轉移到任何國家。 | transfer_units_fraction= { |
将一定的装备、海军、空军和陆军按照特定的比例转移到一个国家。 | 军队将领可以使用 keep_unit_leaders_trigger = { 保留
|
1.9 |
在炮手就位DLC(Man the Guns)添加的新效果(Effect)
名字 | 參數 | 示例 | 描述 | 注釋 | 添加
版本 |
---|---|---|---|---|---|
remove_decision | 可以在不使用 remove_effect 語句下移除特定的決議 | remove_decision = GER_MEPO
|
移除一項決議 | 1.6 | |
swap_ruler_traits | 與 swap_ideas 類似. 移除一個技能/特質(trait)然後添加另外一個.(trait指的是國家領導人身上的技能) | swap_ruler_traits = { remove = <要移除的技能> add = <要添加的技能> }
|
更換技能 | 1.6 | |
remove_exile_tag |
移除一個軍隊將領的流亡標識(tag), 讓他不再被判定為流亡將領 | remove_exile_tag = { USA = "Arturo Rawson" }
|
移除一個Leader的流亡標識 | 1.6 | |
add_legitimacy | 給一個流亡政府增加政權合法性 | add_legitimacy = 10
|
增加政權合法性 | 1.6 | |
set_legitimacy |
設定流亡政府政權合法性 | set_legitimacy= { POL = 1.0 }
|
設定政權合法性 | 1.6 | |
become_exiled_in | 使一個國家成為一個在既定國家的流亡政府,具有既定的合法性。 | become_exiled_in = { target = <既定国家(在哪里流亡)> legitimacy = <0-1> (预设的合法性) }
|
創建一個流亡政府 | 必須在 ROOT(不懂參見作用域)下使用, 需要成為流亡政府的國家,或者一個特定的tag | 1.6 |
end_exile | 結束流亡政府 | end_exile
|
結束流亡政府 | 1.6 | |
add_province_modifier | 增加省份修正 | add_province_modifier = { 5246 = mud }
|
增加一個省份修正(天氣) | 新的省份修正可以在"weather.txt"文件中創建. | 1.6 |
remove_province_modifier | 移除一個省份修正(天氣) | remove_province_modifier = { 5246 = mud }
|
移除一個省份修正 | 新的省份修正可以在"weather.txt"文件中創建. | 1.6 |
set_faction_name | 設置陣營名字(本地化名字,即需要本地化(localize),寫入本地化文件) | set_faction_name = SOME_LOC_KEY
|
改變陣營名字 | 1.6 | |
add_nuclear_bombs | 給一個特定國家增加指定數量的核彈 | add_nuclear_bombs = 100
|
給一個特定國家增加指定數量的核彈 | 需要事先研究核彈科技 | 1.6 |
launch_nuke | 核爆一個特定省份 |
|
核爆一個省份
當僅提供地區參數的時候,敵人佔領的省份優先核平 |
需要核彈科技和核彈庫存,使用的時候從庫存裏面刪除一個核彈 | 1.6 |
inherit_technology | 轉移一個國家的所有科技到另外一個國家 | inherit_technology = CAN
|
轉移科技 | 在內戰的時候很有用. 作用域國家會繼承Tag標識國家的所有科技,所以要小心作用域的問題 | 1.6 |
set_fuel_ratio | 設定一個國家的燃油存量(倍數) | set_fuel_ratio
|
設置國家目前的燃料比。 | 1.6 | |
add_mines | 為當前國家在一個戰略區域布雷 | add_mines = { region = 42 amount = 100 }
|
在一個戰略區域布雷 |
1.6 | |
give_resource_rights | 給予資源使用權 | give_resource_rights = { receiver = ENG state = 291 }
|
把一個省份的所有資源給予目標國家使用 | 參見 04_mtg_on_actions | 1.6 |
remove_resource_rights | 剝奪資源使用權 | ENG = { remove_resource_rights = 477 }
|
剝奪先前給予的資源使用權 | 1.6 |
任意作用域
能在「國家」、「省份」或者「將領」這些作用域使用
全局
這部分內容可能已不適合當前版本,最後更新於1.5。 |
名字 | 參數 | 示例 | 描述 | 注釋 | 添加
版本 |
---|---|---|---|---|---|
set_global_flag | <flag> 用於標識全局標誌的唯一字符串 |
set_global_flag = my_flag
|
定義一個全球Flag | 1.0 | |
clr_global_flag | <flag> 要清除的全局標誌的唯一字符串 |
clr_global_flag = my_flag
|
清除一個全球Flag | 1.0 | |
modify_global_flag | flag = <flag> The global flag to modify.
|
modify_global_flag = { flag = my_flag value = 1 } |
修改一個全球Flag | 推薦使用 變量 | 1.0 |
custom_effect_tooltip | <string> 作為提示文字的本地化文本 |
custom_effect_tooltip = my_tooltip_tt
|
在效果提示文字內顯示本地化文本 | 1.0 | |
log | <string> 顯示在game.log里的文本 |
log = "myVariable: [?myVariable]"
|
當運行指令時將這行文本寫入game.log | 允許所有的本地化命令 (比如[Root.GetName]等) | 1.5 |
save_event_target_as | <string> 用於標識事件目標的唯一字符串 |
capital_scope = { save_event_target_as = my_state } |
將當前範圍另存為鍵。一旦執行結束(即事件結束)就會被清除。 | Use event_target:<key> to access the scope. Do not use in Scripted GUIs. |
1.0 |
save_global_event_target_as | <string> 用於標識全局事件目標的唯一字符串 |
random_other_country = { save_global_event_target_as = my_country } |
將當前範圍另存為鍵。執行後持續存在,直到通過生效清除。 | Use event_target:<key> to access the scope. Do not use in Scripted GUIs. |
1.0 |
clear_global_event_target | <string> 要清除的全局事件目標的唯一字符串 |
clear_global_event_target = my_country
|
清除特定的全局事件目標。 | 1.0 | |
clear_global_event_targets | yes Boolean. |
clear_global_event_targets = yes
|
清除所有全局事件目標。 | 1.0 | |
break | None
|
break
|
停止執行當前作用域內的指令 | 1.0 | |
sound_effect | <string> 要播放的音頻名字,要事先定義在sound.asset和soundeffects.asset中 |
sound_effect = "boom"
|
播放一段音效 | 不能被作用域限制,一旦播放,其他國家也能聽到(偶然發現的,版本1.8.1,單人模式) | 1.0 |
randomize_weather | <int> 一個隨機數種子(整數) |
randomize_weather = 12345
|
以特定的隨機數種子隨機生成天氣 | 1.0 | |
set_province_name | id = <id> 要重命名的勝利點ID
|
set_province_name = { id = 325 name = "Funland" } |
把某個勝利點的名字改為特定名字 | 1.3 | |
reset_province_name | <id> 要復位的勝利點名字 |
reset_province_name = 325 |
重設特定勝利點的名字 | 1.3 | |
goto_province | <id> 要移動到的地塊 |
goto_province = 325 |
把視角移到特定地塊 | 1.0 | |
goto_state | <scope> / <variable> 要移動到的省份 |
goto_state = 1 goto_state = var:some_state |
把視角移到特定省份 | 1.0 | |
change_tag_from | <scope> / <variable> 要切換到的國家. |
GER = { change_tag_from = ROOT } GER = { change_tag_from = var:from.country } |
從當前國家切換到目標國家遊玩 | 注意:等號後面的是當前國家,指令前的作用域為目標國家 | 1.0 |
add_region_efficiency | 1.5 |
邊境衝突
Name | Parameters | Examples | Description | Notes | Version Added |
---|---|---|---|---|---|
start_border_war(發起邊境衝突) | change_state_after_war = <bool> 在邊境衝突結束後,該省份是否易手 進攻方作用域 state = <id> / <variable> 發起邊境衝突的省份 . num_provinces = <id> 指定進攻方投入當前省份下的多少地塊的部隊發起邊境衝突 . on_win = <id> 進攻方勝利所觸發的事件 . on_lose = <id> 進攻方失敗所觸發的事件 . on_cancel= <id> 進攻方與對方陷入僵持時所觸發的事件 防守方作用域 state = <id> / <variable> 因邊境衝突而受到攻擊的省份. num_provinces = <id> 指定防守方投入當前省份下的多少地塊的部隊發起邊境衝突. on_win = <id> 防守方勝利所觸發的事件 on_lose = <id> 防守方失敗所觸發的事件. on_cancel= <id> 防守方與對方陷入僵持時所觸發的事件 |
start_border_war = { change_state_after_war = no attacker = { state = 527 num_provinces = 4 on_win = japan_border_conflict.2 on_lose = japan_border_conflict.3 on_cancel = japan_border_conflict.4 } defender = { state = 408 num_provinces = 4 on_win = japan_border_conflict.3 on_lose = japan_border_conflict.2 on_cancel = japan_border_conflict.4 } } |
指定一場邊境衝突中的進攻方和防禦方,且雙方都是衝突區域省份的擁有者 | 1.5 | |
set_border_war_data | attacker = <id> / <variable> 攻擊方發起進攻的省份
|
set_border_war_data = { attacker = 527 defender = 408 defender_modifier = 0.15 combat_width = 100 } |
設置雙方的攻守加成或懲罰修正,在發起邊境衝突後使用。 | 1.5 | |
cancel_border_war | attacker = <id> / <variable> 攻擊方發起進攻的省份
|
cancel_border_war = { dont_fire_events = yes defender = 408 attacker = 527 } |
取消當前的邊境衝突而且沒有勝者 | 1.5 | |
finalize_border_war | attacker = <id> / <variable> 攻擊方發起進攻的省份
|
finalize_border_war = { attacker_win = yes attacker = 527 defender = 408 } |
結束一場邊境衝突 | 1.5 |
國家作用域
下列的指令必須在「國家」作用域使用
整體
Name | Parameters | Examples | Description | Notes | Version Added |
---|---|---|---|---|---|
set_country_flag | <flag> An unique string to identify the country flag with. |
set_country_flag = my_flag
|
定義一個國家Flag | 1.0 | |
clr_country_flag | <flag> The unique string of a country flag to clear. |
clr_country_flag = my_flag
|
清除一個國家Flag | 1.0 | |
modify_country_flag | flag = <flag> 要修改的國家Flag
|
modify_country_flag = { flag = my_flag value = 1 } |
修改一個國家Flag | 推薦使用 變量 | 1.3 |
country_event | id = <event> 要觸發的事件
|
country_event = { id = my_event.1 days = 10 random = 50 } |
對特定國家觸發事件 | Where triggers do not need to be repeatedly checked random can be a performance light alternative to mean_time_to_happen for scheduling events.
|
1.0 |
news_event | id = <event> 要觸發的新聞事件
|
news_event = { id = my_event.1 days = 10 random = 50 } |
對特定國家觸發新聞事件 | 新聞事件和普通事件所顯示的界面不同
Where triggers do not need to be repeatedly checked |
1.0 |
set_cosmetic_tag(設置顯示動態Tag) | <string> 設置一個動態Tag以更改旗幟、國名(注意:此代碼無法改變國家初始tag,只會更改其顯示) |
set_cosmetic_tag = SAF_SOV_communism |
Makes the current scope use the specified cosmetic tag, changing name and flag. | 1.3 | |
drop_cosmetic_tag | <bool> Boolean. |
drop_cosmetic_tag = yes |
Makes the current scope drop the current cosmetic tag they are using. | 1.3 | |
set_rule | <rule> Boolean. |
set_rule = { can_create_factions = yes } |
為當前作用域應用特定的遊戲規則 | Possible rules:
|
1.0 |
add_dynamic_modifier | modifier = <modifier_string> The name of the Modifier.
#optional, specify if it is specified while adding the modifier |
add_dynamic_modifier = { modifier = my_modifier } | 添加dynamic modifier | ||
remove_dynamic_modifier | modifier = <modifier_string> The name of the Modifier.
#optional, specify if it is specified while adding the modifier |
remove_dynamic_modifier = { modifier = my_modifier } | 移除dynamic modifier | ||
force_update_dynamic_modifier | <bool> Boolean. |
force_update_dynamic_modifier = yes | 強制刷新dynamic modifier |
地區
Name | Parameters | Examples | Description | Notes | Version Added |
---|---|---|---|---|---|
add_state_core | <scope> / <variable> 添加省份核心 |
add_state_core = 345 |
為當前作用域添加省份核心 | 1.0 | |
remove_state_core | <scope> / <variable> 移除省份核心 |
remove_state_core = 345 |
移除當前作用域的省份核心 | 1.0 | |
set_capital | <scope> / <variable> 將指定省份設置為首都 |
set_capital = { state = 562 } |
將特定的省份設置為當前作用域的首都 | 1.0 | |
add_state_claim | <scope> / <variable> 對當前省份添加領土宣稱 |
add_state_claim = 345 |
添加當前作用域對省份的領土宣稱 | 1.0 | |
remove_state_claim | <scope> / <variable> 移除當前省份的領土宣稱 |
remove_state_claim = 345 |
移除當前作用域對省份的領土宣稱 | 1.0 | |
set_state_owner | <scope> / <variable> 設置省份的擁有者 |
set_state_owner = 345 |
將當前作用域設置為省份的擁有者 | 1.0 | |
set_state_controller | <scope> / <variable> 設置省份的實際控制者 |
set_state_controller = 345 |
將當前作用域設置為省份的實際控制者 | 1.0 | |
transfer_state | <scope> / <variable> 改變省份的擁有者和實際控制者 |
transfer_state = 345 |
將當前作用域設置為省份的擁有者和實際控制者 | 1.0 | |
set_province_controller | <id> 設置地塊的實際控制者 |
set_province_controller = 2999 |
將當前作用域設置為地塊的實際控制者(僅在戰時可用) | 1.0 |
政治力量
Name | Parameters | Examples | Description | Notes | Version Added |
---|---|---|---|---|---|
add_political_power | <int> / <variable> 數量 |
add_political_power = 100 add_political_power = var:my_var |
為當前作用域增加特定數量的政治點數 | 1.0 | |
set_political_power | <int> / <variable> 數量 |
set_political_power = 100 |
為當前作用域設定特定數量的政治點數 | 1.0 | |
add_stability | <int> / <variable> 數量 |
add_stability = 0.1 |
為當前作用域增加特定數量的穩定度 | 穩定度的值在0到1之間 | 1.5 |
set_stability | <int> / <variable> The amount to add. |
set_stability = 0.5 |
為當前作用域設定特定數量的穩定度 | 穩定度的值在0到1之間 | 1.5 |
add_war_support | <int> / <variable> The amount to add. |
add_war_support = 0.1 |
為當前作用域增加特定數量的戰爭支持度 | 戰爭支持度的值在0到1之間 | 1.5 |
set_war_support | <int> / <variable> The amount to set. |
set_war_support = 0.5 |
為當前作用域設定特定數量的戰爭支持度 | 戰爭支持度的值在0到1之間 | 1.5 |
add_command_power | <int> / <variable> The amount to add. |
add_command_power = 100 |
為當前作用域增加特定數量的指揮點數 | 1.5 |
政治
Name | Parameters | Examples | Description | Notes | Version Added |
---|---|---|---|---|---|
kill_ideology_leader | <ideology> 意識形態 |
kill_ideology_leader = communism |
殺死當前作用域下特定意識形態的領袖 | 1.9 | |
retire_ideology_leader | <ideology> 意識形態 |
retire_ideology_leader = fascism |
移除當前作用域下特定意識形態的領袖並使其退休 | 1.9 | |
kill_country_leader | <bool> Boolean. |
kill_country_leader = yes |
殺死當前作用域的國家元首 | 1.0 | |
retire_country_leader | <bool> Boolean. |
retire_country_leader = yes |
移除當前作用域的國家元首並使其退休 | 1.0 | |
set_country_leader_ideology | <government> The government to set. |
set_country_leader_ideology = socialism |
改變國家元首所屬的黨派(實際上是更改意識形態) | 1.0 | |
add_country_leader_trait | <trait> The trait to add. |
add_country_leader_trait = nationalist_symbol |
為當前作用域的國家元首添加特性 | 特性參見 /Hearts of Iron IV/common/country_leader/*.txt. | 1.0 |
remove_country_leader_trait | <trait> The trait to remove. |
remove_country_leader_trait = nationalist_symbol |
移除當前作用域的國家元首的特性 | 特性參見 /Hearts of Iron IV/common/country_leader/*.txt. | 1.0 |
hold_election | <scope> The country to hold an election for. |
hold_election = ROOT |
為當前作用域執行在on_new_term_election內的事件(在On Actions文件里) | 1.0 | |
add_popularity(更改支持率) | ideology = <ideology> 指定需更改支持率的黨派意識形態
|
add_popularity = { ideology = fascism popularity = -0.5 } |
在當前作用域裏修改黨派的支持率 | Values used are 0 to 1. | 1.0 |
set_politics | ruling_party = <ideology> The party to set.
|
set_politics = { ruling_party = neutrality } |
設置當前範圍的政黨設置 |
Previously included the "parties" parameter, which has been deprecated by the "set_popularities" command. The "parties" parameter no longer works as of version 1.7 |
1.0 (Updated 1.7) |
<ideology>_drift(每日增長多少支持率) | <ideology>_drift = <int> / <variable> 意識形態支持度每日增長 |
fascism_drift = 0.01 |
在當前作用域裏每日修改的黨派支持度 | 1.0 | |
set_politics | ruling_party = <ideology> The party to set.
|
set_politics = { ruling_party = neutrality } |
設置當前範圍的政黨設置 |
以前包含「parties」參數,該參數已被「set_popularities」命令棄用。從版本 1.7 開始,「parties」參數不再有效 |
1.0 (Updated 1.7) |
set_popularities | <ideology> = <int>/<variable> The popularity to set. |
set_popularities = { democratic = 50 neutrality = 15 fascism = 30 communism = 5 } |
設置當前範圍的政黨受歡迎程度 |
人氣加起來必須達到 100,否則該命令將無效 |
1.7 |
set_political_party | ideology = <ideology> The party to change.
|
set_political_party = { ideology = fascism popularity = 50 } |
設置當前範圍內指定政黨的受歡迎程度 | 1.0 | |
set_party_name(設置黨派名稱) | ideology = <ideology> 指定更改名稱的黨派
|
set_party_name = { ideology = neutrality long_name = GER_neutrality_party_kaiserreich_long name = GER_neutrality_party_kaiserreich } |
更改當前範圍的指定政黨的名稱 | 1.0 | |
create_country_leader | name = <string> The name of the leader.
|
create_country_leader = { name = "Mohammed Zahir Shah" desc = "POLITICS_MOHAMMED_ZAHIR_SHAH_DESC" picture = "Portrait_Afghanistan_Mohammed_Zahir_Shah.dds" expire = "1965.1.1" ideology = despotism traits = { } } |
縱向字符串可以包含完整路徑(即 gfx/leaders/my_folder/custom_pic.dds)或僅包含圖像的名稱(即 custom_pic.dds)
僅使用名稱時,圖像必須位於與當前範圍的標記匹配的文件夾中,例如/Hearts of Iron IV/gfx/leaders/GER/custom_pic.dds. |
1.0 |
外交
Name | Parameters | Examples | Description | Notes | Version Added |
---|---|---|---|---|---|
set_major | <bool> 布爾值 |
set_major = yes |
使當前作用域成為主要國家 | 1.0 | |
create_faction | <string> 派系名稱。 |
create_faction = MY_FACTION_NAME |
創建一個在當前作用域的有指定名稱的派系(MY_FACTION_NAME)。該作用域範圍內及其附屬國將自動加入派系。 | 1.0 | |
add_to_faction | <TAG> 國家tag標籤。 |
FACTION_LEADER_TAG = { add_to_faction = TAG_TO_ADD }FACITON_LEADER_TAG(派系領導者的國家tag標籤) TAG_TO_ADD(需要加入該派系的國家tag標籤) |
將特定國家(TAG_TO_ADD)加入該派系領導人(FACTION_LEADER_TAG)領導的的派系。 | 1.0 | |
leave_faction | <bool> Boolean. |
leave_faction = yes |
離開當前派系 | 1.5 | |
remove_from_faction | <string> 派系的名稱 |
remove_from_faction = MY_FACTION_NAME |
從指定派系中刪除當前範圍 | 1.0 | |
dismantle_faction | <bool> Boolean. |
dismantle_faction = yes |
拆除當前範圍的派系 | 1.0 | |
puppet | <scope> 被傀儡國家 |
puppet = GER |
傀儡某個國家 | 1.0 | |
end_puppet | <scope> The target country. |
end_puppet = GER |
刪除目標和當前範圍之間的傀儡狀態 | 1.0 | |
release | <scope> The target country. |
release = GER |
將指定的主題或僅核心國家/地區發佈為自由國家/地區 | 1.0 | |
release_puppet | <scope> The target country. |
release_puppet = GER |
將指定的主題或僅核心國家/地區作為當前範圍的傀儡發佈 | 1.0 | |
give_guarantee | <scope> The target country. |
give_guarantee = GER |
使當前範圍保證指定國家/地區 | 1.0 | |
give_military_access | <scope> The target country. |
give_military_access = GER |
使指定國家/地區授予當前範圍的軍事通行權 | 1.0 | |
recall_attache | <scope> The target country with an attache. |
recall_attache = GER |
從指定國家/地區調用當前示波器的隨員 | 1.5 | |
diplomatic_relation | country = <scope> The target country to alter the relationship with ROOT.
|
diplomatic_relation = { country = SOV relation = guarantee active = no } |
用於定義當前範圍和目標範圍國家之間的外交關係 | Possible relations:
|
1.0 |
add_opinion_modifier | target = <scope> The target country.
|
add_opinion_modifier = { target = GER modifier = faction_traitor } |
為當前範圍 towards 指定範圍添加指定的意見修飾符 | Opinion modifiers are found in /Hearts of Iron IV/common/opinion_modifiers/*.txt. | 1.0 |
remove_opinion_modifier | target = <scope> The target country.
|
remove_opinion_modifier = { target = GER modifier = faction_traitor } |
刪除當前範圍 towards 指定範圍的指定意見修飾符 | Opinion modifiers are found in /Hearts of Iron IV/common/opinion_modifiers/*.txt. | 1.0 |
reverse_add_opinion_modifier | target = <scope> The target country.
|
reverse_add_opinion_modifier = { target = GER modifier = faction_traitor } |
為當前作用域的指定範圍 towards 添加指定的意見修飾符 | 意見修飾符位於/Hearts of Iron IV/common/opinion_modifiers/*.txt. | 1.0 |
add_relation_modifier | target = <scope> The target country.
|
add_relation_modifier = { target = SWE modifier = HUN_dynastic_ties_license } |
為當前作用域 towards 添加指定的關係修飾符 | 關係修飾符位於/Hearts of Iron IV/common/modifiers/*.txt. | 1.4 |
remove_relation_modifier | target = <scope> The target country.
|
remove_relation_modifier = { target = SWE modifier = HUN_dynastic_ties_license } |
刪除當前作用域 towards 指定作用域的指定關係修飾符 | 關係修飾符位於/Hearts of Iron IV/common/modifiers/*.txt. | 1.4 |
附屬國
Name | Parameters | Examples | Description | Notes | Version Added |
---|---|---|---|---|---|
add_autonomy_ratio | value = <float> The freedom score to add.
|
add_autonomy_ratio = { value = 0.1 localization = AST_adopt_westminster } |
將自由度百分數比率修飾符添加到當前範圍 | 用於主題 | 1.3 |
add_autonomy_score | value = <float> The freedom score to add.
|
add_autonomy_ratio = { value = 10 localization = EXAMPLE } |
將精確的自由度百分數修飾符添加到當前範圍 | 用於主題 | 1.3 |
set_autonomy | target = <scope> / <variable> The subject country.
|
set_autonomy = { target = AST autonomy_state = autonomy_free } |
設置指定國家/地區的自治級別 | 自治狀態位於/Hearts of Iron IV/common/autonomous_states/*.txt. | 1.3 |
release_autonomy | target = <scope> / <variable> The subject country.
|
release_autonomy = { target = VIN autonomy_state = autonomy_puppet freedom_level = 0.5 } |
釋放國家/地區並設置指定國家/地區的自治級別 | 自治狀態位於/Hearts of Iron IV/common/autonomous_states/*.txt. | 1.3 |
戰爭
名字 | Parameters | 例子 | 描述 | Notes | Version Added |
---|---|---|---|---|---|
add_threat | <int> 增加多少世界緊張度 |
add_threat = 10 |
增加全球緊張度 | 1.0 | |
add_named_threat | threat = <int> The amount to change by.
|
add_named_threat = { threat = 5 name = GER_rhineland } |
調整 World Tension 的級別,並在 World Tension 工具提示中添加一個條目 | 1.0 | |
annex_country | target = <scope> 被吞併的國家ID
|
annex_country = { target = GER transfer_troops = yes } |
讓一個國家吞併另一個國家 | 1.0 | |
add_to_war | targeted_alliance = <scope> The country to assist.
|
add_to_war = { targeted_alliance = PREV enemy = HUN hostility_reason = asked_to_join } |
將當前範圍添加到其盟友與指定敵人的戰爭中 | 1.0 | |
declare_war_on | target = <scope> / <variable> 被攻擊的國家ID
|
declare_war_on = { target = GER type = annex_everything } |
讓一個國家向另一個國家宣戰,並且用其宣戰藉口宣戰 | 宣戰藉口類型可以在 /Hearts of Iron IV/common/wargoals/*.txt中定義 | 1.0 |
white_peace | <scope> / <variable> 被無條件和平的國家ID
|
white_peace = GER white_peace = { tag = GER message = EXAMPLE } |
讓一個國家無條件和平 | 1.0 | |
set_truce | target = <scope> The scope to truce with.
|
set_truce = { target = GER days = 90 } |
使當前作用域休戰與指定的作用域 | 1.0 | |
create_wargoal(製造宣戰藉口) | target = <scope> / <variable> 指定被製造宣戰藉口的國家
|
create_wargoal = { type = puppet_wargoal_focus target = ROOT } |
讓一個國家獲得對另一個國家的宣戰藉口 | 1.0 | |
start_civil_war | ideology = <ideology> The ideology of the breakaway country.
|
start_civil_war = { ruling_party = communism ideology = ROOT size = 0.8 only_own_territory = no capital = 282 states = { 282 533 536 555 529 530 528 } keep_unit_leaders = { 750 751 752 } } |
使用指定參數為當前範圍啟動內戰 | 1.0 |
資源
名字 | 參數 | 示例 | 描述 | 注釋 | 添加
版本 |
---|---|---|---|---|---|
add_resource | type = <resource> 要添加的資源
|
add_resource = { type = oil amount = 50 state = 88 } |
在特定地區添加特定數量的特定資源 | 1.0 | |
destroy_resource | type = <resource> 要添加的資源
|
destroy_resource = { type = oil amount = 50 state = 88 } |
在特定地區摧毀特定數量的特定資源 | 1.9 | |
create_import | resource = <resource> The resource to import.
|
create_import = { resource = steel amount = 100 exporter = GER } |
使用指定資源和從指定導出程序為當前範圍創建導入 | 1.0 |
建築
名字 | 參數 | 示例 | 描述 | 注釋 | 添加
版本 |
---|---|---|---|---|---|
add_offsite_building | type = <building> The building to add.
|
add_offsite_building = { type = arms_factory level = 1 } |
為當前範圍添加一個地圖外建築物,該建築物在不處於狀態的情況下產生其效果 | 1.5 | |
modify_building_resources | building = <building> The building to modify.
|
modify_building_resources = { building = synthetic_refinery resource = oil amount = 1 } |
修改當前範圍的指定建築物的資源輸出 | 1.5 |
國策
名字 | 參數 | 示例 | 描述 | 注釋 | 添加
版本 |
---|---|---|---|---|---|
load_focus_tree | <string> 加載某個指定國策樹. Alternatively, as an effect block: tree = <string> keep_completed = yes/no
|
load_focus_tree = china_communist_focus load_focus_tree = { tree = british_focus keep_completed = yes } |
為當前範圍加載新的國策樹,並保留任何共享國策 | 1.5 | |
unlock_national_focus | <focus> The focus to unlock. |
unlock_national_focus = my_focus |
繞過當前示波器的指定國策(標記為完成,而不觸發國策complete_effect )
|
1.0 | |
complete_national_focus | <focus> The focus to complete. |
complete_national_focus = my_focus |
完成當前作用域的指定國策 | 1.0 |
決議
名字 | 參數 | 示例 | 描述 | 注釋 | 添加
版本 |
---|---|---|---|---|---|
activate_decision | <decision> The decision to activate. |
activate_decision = my_decision |
激活當前作用域的指定決策,忽略決策的觸發器 | 決策位於/Hearts of Iron IV/common/decisions/*.txt | 1.0 |
activate_targeted_decision | target = <scope> The country to target.
|
activate_targeted_decision = { target = GER decision = my_decision } |
為當前範圍的指定目標激活指定的目標決策 | 決策位於/Hearts of Iron IV/common/decisions/*.txt | 1.5 |
remove_targeted_decision | <decision> The decision to remove. |
remove_targeted_decision = { target = FROM decision = my_decision } |
刪除當前作用域的指定目標決策 | 決策位於/Hearts of Iron IV/common/decisions/*.txt | 1.5 |
unlock_decision_tooltip | <decision> The decision to display. |
unlock_decision_tooltip = my_decision |
在效果工具提示中顯示指定決策的特殊工具提示 | 決策位於/Hearts of Iron IV/common/decisions/*.txt | 1.5 |
unlock_decision_category_tooltip | <category> The decision category to display. |
unlock_decision_category_tooltip = my_category |
在效果工具提示中顯示指定決策類別的特殊工具提示 | 決策類別位於/Hearts of Iron IV/common/decisions/catergories/*.txt | 1.5 |
任務
名字 | 參數 | 示例 | 描述 | 注釋 | 添加
版本 |
---|---|---|---|---|---|
activate_mission | <mission> The mission to activate. |
activate_mission = my_mission |
Activates the specified mission for the current scope, ignoring any triggers for the decision. | Missions are found in /Hearts of Iron IV/common/decisions/*.txt | 1.5 |
activate_mission_tooltip | <mission> The mission to display. |
activate_mission_tooltip = my_mission |
Displays a special tooltip for the specified mission in the effect tooltip. | Missions are found in /Hearts of Iron IV/common/decisions/*.txt | 1.5 |
remove_mission | <mission> The mission to remove. |
remove_mission = my_mission |
Removes the specified mission for the current scope. | Missions are found in /Hearts of Iron IV/common/decisions/*.txt | 1.5 |
科技
名字 | 參數 | 示例 | 描述 | 注釋 | 添加
版本 |
---|---|---|---|---|---|
add_research_slot | <int> 要加多少個科研槽 |
add_research_slot = 1 |
讓一個國家增加一定數量個科研槽 | 1.0 | |
set_research_slots | <int> 設置的 |
set_research_slots = 4 |
Sets the number of research slots the current scope has. | 1.0 | |
add_tech_bonus | bonus = <float> The bonus to technology given.
|
add_tech_bonus = { bonus = 0.5 uses = 1 category = radar_tech } |
Grants a research bonus to the current scope with the specified parameters. | Research bonus categories are found in Hearts of Iron IV/common/technology_tags/*.txt
|
1.0 |
set_technology | <technology> = <int> The technology to add. popup = no To not show the popup after adding technology |
set_technology = { suicide_craft = 1 } |
Grants the specified technology to the current scope. | A value of 1 sets the technology. A value of 0 removes the technology, but if it is a researchable technology, the duration to research isn't reset, meaning it can be researched in 1 day. | 1.0 |
add_to_tech_sharing_group | <string> The group to add the current scope to. |
add_to_tech_sharing_group = us_research |
Adds the current scope to the specified technology sharing group. | 1.3 | |
remove_from_tech_sharing_group | <string> The group to remove the current scope from. |
remove_from_tech_sharing_group = us_research |
Removes the current scope from the specified technology sharing group. | 1.3 | |
modify_tech_sharing_bonus | id = <string> The group to modify.
|
modify_tech_sharing_bonus = { id = us_research bonus = 0.5 } |
Modifies the specified technology sharing group. | 1.3 |
民族精神/內閣
名字 | 參數 | 示例 | 描述 | 注釋 | 添加
版本 |
---|---|---|---|---|---|
add_ideas | <idea> 需添加的民族精神/內閣成員 |
add_ideas = my_idea add_ideas = { my_idea_1 my_idea_2 } |
將指定民族精神添加到當前作用域。 | 可以在同效果內添加多個民族精神。 | 1.0 |
add_timed_idea | idea = <idea> 需添加的民族精神
|
add_timed_idea = { idea = my_idea days = 180 } |
在指定作用域添加限時民族精神。 | 1.0 | |
modify_timed_idea | idea = <idea> 需要修改的民族精神
|
modify_timed_idea = { idea = my_idea days = 60 } |
將限時民族精神的持續時間延長指定量。 | 1.0 | |
swap_ideas | add_idea = <idea> 需添加的民族精神
|
swap_ideas = { remove_idea = my_idea_1 add_idea = my_idea_2 } |
在被添加和移除的民族精神之間顯示效果的更改內容和差異。 | 1.3 | |
remove_ideas | <idea> 需移除的民族精神 |
remove_ideas = my_idea remove_ideas = { my_idea_1 my_idea_2 } |
將指定民族精神移除出當前作用域。 | 可以在同效果內移除多個民族精神。. | 1.0 |
remove_ideas_with_trait | <trait> The trait to target. |
remove_ideas_with_trait = motorized_equipment_manufacturer |
Removes all ideas for the current scope that use the specified trait. | 1.0 | |
show_ideas_tooltip | <idea> 需要展示的民族精神 |
show_ideas_tooltip = my_idea |
在當前作用域中顯示指定的民族精神,注意,這個效果並不添加民族精神。 | 1.0 |
單位
Name | Parameters | Examples | Description | Notes | Version Added |
---|---|---|---|---|---|
load_oob(生成單位) | <oob> 引入生成單位的指定文件,並通過該文件生成單位(生成單位的指定文件應放置於history\units文件夾中) |
load_oob = "GER_default" |
Loads the specified OOB for the current scope, applying the effects within. | 1.0 | |
division_template | name The name of the division. regiments = { <unit> = { x = 0 y = 0 } } support = { <unit> = { x = 0 y = 0 } } The composition of the division. |
division_template = { name = "Test" regiments = { infantry = { x = 0 y = 0 } infantry = { x = 0 y = 1 } infantry = { x = 0 y = 2 } infantry = { x = 0 y = 3 } } support = { military_police = { x = 0 y = 0 } } } |
Creates and adds the specified division template to the current scope. | The x and y attributes represent the rows and columns in the division designer. | 1.0 |
set_division_template_lock | division_template = <string> The name of the division template.
|
set_division_template_lock = { division_template = "Infantry Division" is_locked = yes } |
Toggles the locked status on a division template for the current scope, which prevents editing or deletion. | 1.5 | |
delete_unit_template_and_units | division_template = <string> The name of the division template. |
delete_unit_template_and_units = { division_template = "Infantry Division" disband = yes #will refund equipment and manpower } |
Deletes the specified division template and all units using it for the current scope. | 1.5 | |
delete_unit | state = <number id> The id number of the state. |
ENG = { delete_unit = { state = 787 disband = yes #will refund equipment and manpower }} |
Deletes all units within the specified state using the country scope. | 1.5 |
裝備
Name | Parameters | Examples | Description | Notes | Version Added |
---|---|---|---|---|---|
set_equipment_fraction | <float> / <variable> The fraction of equipment to remove. |
set_equipment_fraction = 0.5 |
Reduces the overall equipment stockpile by the specified fraction. | This should not be used in civil wars to simulate stockpile splitting. start_civil_war now automatically divides stockpiles according to the respective size.
|
1.0 |
add_equipment_to_stockpile | type = <equipment> The equipment to add. Can be archetype.
|
add_equipment_to_stockpile = { type = infantry_equipment amount = 100 producer = GER } |
Adds the specified equipment to the current scope. | Note that removal will only remove equipment with the same producer defined in the effect. | 1.0 |
send_equipment | type = <equipment> The equipment to add. Can be archetype.
|
send_equipment = { equipment = infantry_equipment amount = 100 target = GER } |
Sends the specified amount of equipment to the specified target, removing said equipment from the current scope. | 1.0 | |
create_production_license | target = <scope> Which country receives the license.
|
create_production_license = { target = HUN equipment = { type = fighter_equipment_1 } cost_factor = 0 } |
Grants the specified country a licensed to produce the specified equipment from the current scope. | 1.4 | |
create_equipment_variant | name = <string> The name of the variant
|
create_equipment_variant = { name = "Montecuccoli Class" type = light_cruiser_1 upgrades = { ship_reliability_upgrade = 3 ship_engine_upgrade = 3 ship_gun_upgrade = 3 ship_anti_air_upgrade = 3 } } |
Creates the specified equipment variant for the current scope. | 1.0 | |
add_equipment_production | amount = <int> The amount to produce. Optional.
|
add_equipment_production = { equipment = { type = light_cruiser_2 } requested_factories = 1 progress = 0.95 amount = 1 } |
Starts a production line for the specified equipment for the current scope. | 1.0 |
陸軍
Name | Parameters | Examples | Description | Notes | Version Added |
---|---|---|---|---|---|
add_manpower | <int> / <variable> 要添加的數量。 |
add_manpower = 100000 add_manpower = var:my_var |
將指定數量的人力添加到當前範圍。 | 1.0 | |
army_experience | <float> / <variable> 要添加的數量。 |
army_experience = 10 |
將指定數量的陸軍經驗添加到當前範圍。 | 1.0 | |
create_corps_commander | name = <string> The name of the leader.
|
create_corps_commander = { name = "Jean de Lattre de Tassigny" picture = "Portrait_France_Jean_de_Lattre_de_Tassigny.dds" traits = { trickster brilliant_strategist } skill = 4 attack_skill = 4 defense_skill = 2 planning_skill = 4 logistics_skill = 3 } |
Creates a commander for the current scope with the specified attributes. | Traits are found in /Hearts of Iron IV/common/unit_leader/*.txt. | 1.0 |
create_field_marshal | name = <string> The name of the leader.
|
create_field_marshal = { name = "Maurice Gamelin" picture = "Portrait_France_Maurice_Gamelin.dds" traits = { defensive_doctrine } skill = 2 attack_skill = 1 defense_skill = 3 planning_skill = 2 logistics_skill = 1 } |
Creates a field marshal for the current scope with the specified attributes. | Traits are found in /Hearts of Iron IV/common/unit_leader/*.txt. | 1.0 |
海軍
Name | Parameters | Examples | Description | Notes | Version Added |
---|---|---|---|---|---|
navy_experience | <float> / <variable> The amount to add. |
navy_experience = 10 |
Adds the specified amount of navy experience to the current scope. | 1.0 | |
destroy_ships | type = <ship> The type of ship to destroy.
|
destroy_ships = { type = destroyer count = all } |
Destroys the specified type and amount of ships controlled by the current scope. | 1.5 | |
transfer_navy | target = <scope> The target country. |
transfer_navy = { target = GER } |
Transfers the current scope navy to the specified country. | 1.5 | |
transfer_ship | type = <ship> The type of ship to transfer.<br target = <scope>
|
transfer_ship = { prefer_name = "HMS Achilles" type = light_cruiser target = NZL } |
Transfers the specified type of ship from the current scope to the specified country. | 1.4 | |
create_navy_leader | name = <string> The name of the leader.
|
create_navy_leader = { name = "François Darlan" picture = "Portrait_France_Francois_Darlan.dds" traits = { superior_tactician } skill = 3 } |
Creates a naval leader for the current scope with the specified attributes. | Traits are found in /Hearts of Iron IV/common/unit_leader/*.txt. | 1.0 |
空軍
Name | Parameters | Examples | Description | Notes | Version Added |
---|---|---|---|---|---|
air_experience | <float> / <variable> The amount to add. |
air_experience = 10 |
Adds the specified amount of air experience to the current scope. | 1.0 | |
add_ace | name = <string> The name of the ace.
|
add_ace = { name = "Amelia" surname = "Earhart" callsign = "Revenant" type = fighter_genius is_female = yes } |
Adds an ace for the current scope. | Ace types found in /Hearts of Iron IV/common/aces/*.txt. | 1.0 |
AI
Name | Parameters | Examples | Description | Notes | Version Added |
---|---|---|---|---|---|
add_ai_strategy | type = <type> The type of strategy.
|
add_ai_strategy = { type = alliance id = GER value = 200 } |
為當前範圍設置 AI 策略. | 有關更多詳細信息,請參閱 AI Modding | 1.0 |
地區作用域
The effects here must be used within a state scope.
整體
Name | Parameters | Examples | Description | Notes | Version Added |
---|---|---|---|---|---|
state_event | id = <event> The event to fire.
|
state_event = { id = my_event.1 days = 10 random = 50 trigger_for = controller } |
Fires the specified event for the current state. | Where triggers do not need to be repeatedly checked random can be a performance light alternative to mean_time_to_happen for scheduling events.
Using days = <event> / <variable> or hours may still be bugged and will not fire the event. |
1.0 |
set_state_flag | <flag> An unique string to identify the state flag with. |
set_state_flag = my_flag
|
Defines a state flag. | 1.0 | |
clr_state_flag | <flag> The unique string of a state flag to clear. |
clr_state_flag = my_flag
|
Clears a defined state flag. | 1.0 | |
modify_state_flag | flag = <flag> The state flag to modify.
|
modify_state_flag = { flag = my_flag value = 1 } |
Modifies a state flag. | Use variables instead. | 1.3 |
set_state_name | <string> Defines the new name. |
set_state_name = "Funland" |
Changes the current state's name to the specified name. | 1.3 | |
reset_state_name | <bool> Boolean. |
reset_state_name = yes |
Resets any changes to the current state's name. | 1.3 | |
add_claim_by | <scope> / <variable> The country to add the claim for. |
add_claim_by = SOV |
Adds a claim for the specified country on the current scope. | 1.0 | |
remove_claim_by | <scope> / <variable> The country to remove the claim for. |
remove_claim_by = SOV |
Removes a claim by the specified country on the current scope. | 1.0 | |
add_core_of | <scope> / <variable> The country to add the core for. |
add_core_of = SOV |
Adds a core for the specified country on the current scope. | 1.0 | |
remove_core_of | <scope> / <variable> The country to remove the core for. |
remove_core_of = SOV |
Removes a core for the specified country on the current scope. | 1.0 | |
set_demilitarized_zone | <bool> Boolean. |
set_demilitarized_zone = yes |
Makes the current scope a demilitarized zone. | 1.0 | |
set_state_category | <category> The category to change to. |
set_state_category = rural |
Changes the current state category to the specified category. | Categories are found in /Hearts of Iron IV/common/state_category/*.txt | 1.3 |
add_state_modifier | Modifier scope
|
add_state_modifier = { modifier = { local_resources = 2.0 } } |
Adds a modifier to the current state. | 1.3 | |
add_manpower | <int> / <variable> The amount to add. |
add_manpower = 10000 |
Adds the specified amount of manpower to the current state. | 1.0 | |
add_resource | type = <resource> The resource to add.
|
add_resource = { type = oil amount = 100 } |
Adds the specified resource in the specified amount to the current state. | 1.0 | |
set_border_war | <bool> Boolean. |
set_border_war = yes |
Enables Border War status for the current state. | 1.0 | |
create_unit | division = <division string> The division string.
|
create_unit = { division = "name = \"Infantry Division\" division_template = \"Infantry Division\" start_experience_factor = 0.5 start_equipment_factor = 0.5" owner = GER } |
Adds the specified division to the current state. | The division string must be formatted as it is seen in the examples. | 1.3 |
add_dynamic_modifier | modifier = <modifier_string> The name of the Modifier. |
add_dynamic_modifier = { modifier = sabotaged_ressources } | Adds a dynamic modifier to the current scope | Examples can be found in /Hearts of Iron IV/common/dynamic_modifiers/*.txt | 1.9 |
建築
Name | Parameters | Examples | Description | Notes | Version Added |
---|---|---|---|---|---|
add_building_construction | type = <string> The building to add.
|
add_building_construction = { type = arms_factory level = 5 instant_build = yes } add_building_construction = { type = bunker level = 10 instant_build = yes province = { all_provinces = yes limit_to_border = yes } } add_building_construction = { type = bunker level = 1 instant_build = yes province = 2999 } |
Starts construction in the current state for the specified building. | You can limit the construction to victory points using : limit_to_victory_point > 5 |
1.0 |
set_building_level | type = <string> The building to add.
|
set_building_level = { type = infrastructure level = 10 instant_build = yes } set_building_level = { type = bunker level = 3 province = { all_provinces = yes limit_to_border = yes level < 3 } } |
Sets the specified building to the current state (or provinces within the state). | The province scope is used for provincal level buildings. You can limit the construction to victory points using : limit_to_victory_point > 5 |
1.4 |
damage_building | type = <building> The building to damage.
|
damage_building = { type = infrastructure damage = 1 } |
Damages the specified building in the current state. | The health of buildings is determined by the value attribute in a building's definition. This is multiplied by their level to get their total health. | 1.3 |
remove_building | type = <building> The building to remove.
|
remove_building = { type = arms_factory level = 5 } |
Removes the specified building in the current state. For shared buildings level determines the amount, whereas for the others it is the actual level. | 1.0 | |
add_extra_state_shared_building_slots | <int> / <variable> The amount of slots to add or remove. |
add_extra_state_shared_building_slots = 2 |
Adjusts the number of shared building slots for the current state. | 1.0 |
部隊將領作用域
The effects here must be used within a unit leader scope.
整體
Name | Parameters | Examples | Description | Notes | Version Added |
---|---|---|---|---|---|
unit_leader_event | id = <event> The event to fire.
|
unit_leader_event = { id = my_event.1 days = 10 random = 50 } |
Fires the specified event for the owner of the current unit leader. | Uses a special interface displaying the current unit leader portrait.
Where triggers do not need to be repeatedly checked |
1.5 |
set_unit_leader_flag | <flag> An unique string to identify the unit leader flag with. |
set_unit_leader_flag = my_flag
|
Defines a unit leader flag. | 1.5 | |
clr_unit_leader_flag | <flag> The unique string of a unit leader flag to clear. |
clr_unit_leader_flag = my_flag
|
Clears a defined unit leader flag. | 1.5 | |
modify_unit_leader_flag | flag = <flag> The unit leader flag to modify.
|
modify_unit_leader_flag = { flag = my_flag value = 1 } |
Modifies a unit leader flag. | 1.5 | |
promote_leader | <bool> Boolean |
promote_leader = yes |
Promotes the current unit leader to Field Marshal (if Commander. | 1.5 | |
demote_leader | <bool> Boolean |
demote_leader = yes |
Demotes the current unit leader to Commander (if Field Marshal). | 1.5 | |
retire | <bool> Boolean> |
retire = yes |
Retires the current unit leader (removing them). | 1.5 | |
remove_unit_leader | <id> The id of the unit leader. |
remove_unit_leader = 70 |
Removes the specified unit leader by their id. | 1.0 | |
set_nationality | <scope> / <variable> The target country. |
set_nationality = GER |
Switches the current unit leader to the specified country, giving them the leader. | 1.5 | |
add_unit_leader_trait | <trait> The trait to add. |
add_unit_leader_trait = old_guard |
Adds the specified trait to the current unit leader. | Traits are found in /Hearts of Iron IV/common/unit_leader/*.txt. | 1.0 |
remove_unit_leader_trait | <trait> The trait to remove. |
remove_unit_leader_trait = old_guard |
Removes the specified trait from the current unit leader. | Traits are found in /Hearts of Iron IV/common/unit_leader/*.txt. | 1.0 |
add_timed_unit_leader_trait | <trait> The trait to add.
|
add_timed_unit_leader_trait = { trait = wounded days = 90 } |
Adds the specified trait to the current unit leader for the specified duration. | Traits are found in /Hearts of Iron IV/common/unit_leader/*.txt. | 1.5 |
replace_unit_leader_trait | Traits are found in /Hearts of Iron IV/common/unit_leader/*.txt. | 1.5 |
戰鬥
Name | Parameters | Examples | Description | Notes | Version Added |
---|---|---|---|---|---|
supply_units | <int> / <variable> The amount of hours of supply. |
supply_units = 24 |
Adds the specified amount of hours of supply to troops led by the current unit leader. | 1.5 | |
add_max_trait | <int> The amount to add. |
add_max_trait = 1 |
Adds the specified amount of assignable trait slots to the current unit leader. | 1.5 | |
add_skill_level | <int> The skill to add. |
add_skill_level = 1 |
Adds skill to the current unit leader. | 1.5 | |
add_logistics | <int> The skill to add. |
add_logistics = 1 |
Adds logistics skill to the current unit leader. | 1.5 | |
add_planning | <int> The skill to add. |
add_planning = 1 |
Adds planning skill to the current unit leader. | 1.5 | |
add_defense | <int> The skill to add. |
add_defense = 1 |
Adds defense skill to the current unit leader. | 1.5 | |
add_attack | <int> The skill to add. |
add_attack = 1 |
Adds attack skill to the current unit leader. | 1.5 | |
add_temporary_buff_to_units | combat_offense = <float> The bonus to grant. Optional.
|
add_temporary_buff_to_units = { combat_offense = 0.25 combat_breakthrough = 0.25 org_damage_multiplier = -1.0 str_damage_multiplier = 0.25 war_support_reduction_on_damage = 0.2 cannot_retreat_while_attacking = 1.0 days = 7 tooltip = ABILITY_FORCE_ATTACK_TOOLTIP } |
Adds the specified combat buff to the current unit leader. | 1.5 | |
boost_planning | <float> The amount to add. |
boost_planning = 1 |
Improves the planning of units controlled by the current unit leader. | 1.5 |
Flow Control
These scopes are used within effect scopes to control the execution of effects.
If, Else If and Else
These scopes allow effects to be conditionalized, so they only occur when the requisite triggers are met.
For example, if you only have an effect to occur for Germany, you'd do the following:
if = { limit = { original_tag = GER } add_stability = 0.1 }
If you then wanted England to have a similar effect, and everyone else to have something else, you do the following:
if = { limit = { original_tag = GER } add_stability = 0.1 } else_if = { limit = { original_tag = ENG } add_stability = 0.25 } else = { add_stability = 0.05 }
As you can see, this allows for flexibility in how effects occur and cuts down on duplication.
隱藏效果
This scope hides the presence of the effects within it in the player's tooltip. This is used to execute effects without the player seeing them. For example, you may want to manipulate some variables in an event. Showing them to the player may confuse them, so it is best to hide the effects within an hidden effect scope, like so:
hidden_effect = { set_variable = { my_var = 100 } }
Random List
This scope allows the creation of a random selection of effects. For example, if you wanted an effect to randomly given the player one out of four bonuses, you'd do the following:
random_list = { 25 = { add_stability = 0.5 } 25 = { add_manpower = 10000 } 25 = { add_war_support = 0.5 } 25 = { army_experience = 100 } }
Note that if you want to create a repeatable decision including a random list, by default the same decision will pick the same random result every time it is triggered in a game. You can reverse this behaviour by including the following line in the decision block:
fixed_random_seed = no
It is also possible to use modifiers to affect the weight of each possible random effect.
random_list = { 25 = { add_stability = 0.5 modifier = { factor = 1.3 has_country_flag = inward_perfect_flag } } 25 = { add_manpower = 10000 } 25 = { add_war_support = 0.5 } 25 = { army_experience = 100 } }
The above code would multiply the 25 by the factor thereby making it more or less likely to occur if the trigger condition is fulfilled.
Effect Tooltip
This scope will display the tooltip information of the effects within, without actually executing the effects. This is useful when you want to show what the effect may look like to the player. Here is an example:
effect_tooltip = { every_owned_state = { add_manpower = 10000 } }
文檔 | 效果 • 條件 • 定義 • 修正 • 修正列表 • 作用域 • 本地化 • 行動 • Data structures (Flags, Event targets, Country tag aliases, Variables, Arrays) |
編寫腳本 | AI • AI focuses • Autonomous states • Balances of power • 劇本 • 建築 • Characters and traits • Cosmetic tags • 國家 • 師 • 決議 • 裝備 • 事件 • 內閣/民族精神 • 意識形態 • 國策 • 資源 • Scripted GUI • 科技 • 單位 |
地圖 | 地圖 • 地區 • 補給區域 • 戰略區域 |
圖形圖像 | 界面 • 圖形資產 • 實體 • 後特效 • 離子效果 • 字體 |
裝飾性 | 肖像 • 命名列表 • 音樂 • 音效 |
其他 | 控制台指令 • 故障排除 • 模組結構 • 成就代碼分析 |