决议修改:修订间差异

本页面所适用的版本可能已经过时,最后更新于1.5
无编辑摘要
(文本替换 - 替换“[[Category:”为“[[分类:”)
 
(未显示3个用户的6个中间版本)
第126行: 第126行:
===等一会再消失,或者过一会再回来===
===等一会再消失,或者过一会再回来===
 你可能想让决议在完成后等一会再消失,或者你想让决议在完成后过一会再度出现,又或者你可能只想让这个决议使用一次,这些可以通过如下方式实现:
 你可能想让决议在完成后等一会再消失,或者你想让决议在完成后过一会再度出现,又或者你可能只想让这个决议使用一次,这些可以通过如下方式实现:
  days_remove = 5 # Stays for 5 days before being removed
  days_remove = 5 # 完成后维持5天再移除
  
  
  days_re_enable = 5 # Will show up in the interface and can be selected again after 5 days
  days_re_enable = 5 # 将在5天后显示于界面中,可以再次选择
  
  
  fire_only_once = yes # Will not re-enable after being removed
  fire_only_once = yes # 在移除后将不会重新出现


===导致战争的决议===
===导致战争的决议===
If your decision leads to a nation declaring war on another nation, any of the following can be used to inform the targeted nation that a war is coming, as well as alert the AI to begin moving troops onto the border:
如果你的决议会导致一个国家对另一个国家宣战,下列语句都会告知将被宣战的国家一场战争即将到来,同时警告AI把部队移动到边界上:


  war_with_on_remove = TAG # War is declared on the nation in the TAG when the decision is removed
  war_with_on_remove = TAG # War is declared on the nation in the TAG when the decision is removed
第148行: 第148行:


===移除时的效果===
===移除时的效果===
After a decision has run its course (i.e. the ''days_remove'' you have set the decision to), you may want an effect to happen. Taking the example of our infrastructure decision, we want to return the manpower after 10 days:
在一个决议执行完毕后(即你设置的决议的天数),你可能希望发生一个效果。以我们的基础设施决议为例,我们想在10天后归还人力:
  find_resources = {
  find_resources = {
     develop_infrastructure = {
     develop_infrastructure = {
第172行: 第172行:


===决议修正===
===决议修正===
Using decisions you can have a modifier acting for only a certain amount of time. Using a ''modifier'' block does this for as long as the decision is active (set using the ''days_remove'' statement). Our current decision is getting a bit busy now, so here's a new one that gives a 10% resource production bonus for 200 days when activated, for the cost of 100 political power and can only be used once:
使用决议,你可以让一个修正只在一定时间内发挥作用。使用修正,只要决议处于激活状态(使用day_remove语句设置),就可以做到这一点。我们现在的决议已经有点忙了,所以这里建立一个新的决议,在激活后的200天内增加10% 的战略资源获取率,代价是花费100政治点数。该决议只能使用一次:
  find_resources = {
  find_resources = {
     resource_spree = {
     resource_spree = {
第183行: 第183行:
     }
     }
  }
  }
For more on ''local_resource_factor'', see [[modifiers]]
关于local_resources_factor的更多信息,参见[[modifiers|修正]]


==Targeted decisions==
== 目标决议==
Sometimes you want one decision to target multiple tags - rather than writing the same decision multiple times to target each country, you can instead use a targeted decision. In targeted decisions, ''FROM'' refers to (confusingly) the target of the decision, rather than the sender. Here's a new decision giving a country the ability to give Germany, the USA and Japan an infrastructure in a random state at the cost of 50 political power and 500 manpower for the sender:
有时你希望一个决议针对多个TAG - 与其多次编写相同的决议来针对每个国家,不如使用一个有针对性的决议。在有针对性的决议中,FROM指的是(令人困惑的)决议的目标,而不是使用者。这里有一个新的决议,给予一个国家在随机状态下对德国、美国和日本其中之一增加基础设施的能力,代价是FROM(所得国)要付出50的政治点数和500的人力。
  find_resources = {
  find_resources = {
     help_others = {
     help_others = {
第210行: 第210行:
     }
     }
  }
  }
===State targeted decisions===
=== 省份决议(State targeted decisions ===
[https://hackmd.io/@Yard1/HJdIwpIE8 The following section is duplicated from a blogpost by Yard1.]
[https://hackmd.io/@Yard1/HJdIwpIE8 The following section is duplicated from a blogpost by Yard1.]


第243行: 第243行:


==任务==
==任务==
Missions follow the same basic principle as decisions. These also sit inside a category - for missions we will build up a new category and a new mission, this time about Polish conquest of Berlin. Here is our complete mission inside a category - don't worry if it goes over your head, we'll break it down piece by piece:
任务遵循与决议相同的基本原则。这些任务也位于一个类别中 - 对于任务,我们将建立一个新的决议组和一个新的任务,这次是关于波兰征服柏林的。下面是我们在一个决议组中的完整任务 - 如果你不明白,也不用担心,我们会把它逐个分解以讲解:
  polish_conquest = {                # This is our category
  polish_conquest = {                # 这是我们的决议组
     conquer_berlin = {              # This is our mission id
     conquer_berlin = {              # 这是我们的任务id
       allowed = { tag = POL }         # This mission is only allowed for Poland. Other countries will not be able to see it or activate it.
       allowed = { tag = POL }         # 这项任务只允许在波兰进行。其他国家将无法看到它或激活它
       available = {              # Available here means as much as goal because:
       available = {              # 这里的Available和goal中的一样,因为:
          controls_state = 64            # we can only finish this mission if we control state 64 (Berlin)
          controls_state = 64            # 只有控制了64号省份(柏林),我们才能完成这个任务
       }
       }
       activation = {              # The mission appears and starts counting down under these circumstances:
       activation = {              # 在这种情况下,任务被激活并开始倒计时:
          has_war_with = GER            # War with Germany
          has_war_with = GER            # 与德国交战
       }
       }
       is_good = yes              # This mission is color coded to be a positive thing (not a crisis)
       is_good = yes              # 这个任务的颜色编码是有益事情(非危机)
       selectable_mission = yes         # This mission will complete when the player selects the mission rather than completing automatically
       selectable_mission = yes         # 这个任务将在玩家点选任务时完成,而非自动完成
       days_mission_timeout = 100        # How many days before the mission fails?
       days_mission_timeout = 100        # 距离任务失败前有多少天?
       timeout_effect = {            # What happens when we fail the mission?
       timeout_effect = {            # 当任务失败时会发生什么?
          add_political_power = -50        # Lose 50 PP
          add_political_power = -50        # 失去50点政治点数
       }
       }
       complete_effect = {           # What happens when we activate the mission i.e. mission success?
       complete_effect = {           # 当我们激活任务时,即任务成功时会发生什么?
          add_political_power = 50         # Gain 50 PP
          add_political_power = 50         # 获得50点政治点数
       }
       }
     }
     }
  }
  }


==Localising categories, decisions and missions==
== 决议组、决议及任务的本地化==
{{main|Localisation}}
{{main|Localisation}}


Both categories and decisions are localised in a similar way to focus trees. To localise our category and decision, we will have a localisation file as such:
决议组和决议都是以类似于国策树的方式进行本地化。为了使我们的决议组和决议本地化,我们将有一个这样的本地化文件:
  find_resources:0 "Find Resources"
  find_resources:0 "Find Resources"
  find_resources_desc:0 "To increase the military might of our nation, we must find more natural resources within our borders to exploit"
  find_resources_desc:0 "To increase the military might of our nation, we must find more natural resources within our borders to exploit"
第278行: 第278行:
  resource_spree_desc:0 "We should go on a resource spree to increase production for a short time"
  resource_spree_desc:0 "We should go on a resource spree to increase production for a short time"


'''Warning : ''' the description for category is mandatory ; missing the "_desc" entry in localisation files will result on '''all other''' categories not printed at all.
''' 警告:''' 决议组的描述是强制存在的;在本地化文件中缺少"_desc " 条目将导致所有其他决议组完全不显示。


===Localising targeted decisions===
===Localising targeted decisions===
第286行: 第286行:


==完整例子==
==完整例子==
Below are all the final versions of decisions and missions in this wiki page, in one category:
下面是本wiki页面中所有决议和任务的最终版本,归入一个决议组:
  find_resources = {
  find_resources = {
     develop_infrastructure = {
     develop_infrastructure = {
第339行: 第339行:


{{Modding navbox}}
{{Modding navbox}}
[[Category:Modding]]
[[ 分类:Modding]]

2022年12月5日 (一) 15:42的最新版本


决议路径

决议位于/Hearts of Iron IV/common/decisions,决议组路径位于 /Hearts of Iron IV/common/decisions/categories

创建决议组

所有的决议都需要进入可以容纳多个决议的决议组中,并且决议组可以拥有自己的图片和描述。一个基本的决议组如下所示。在这一页中,我们会使用寻找资源的决议组创建作为例子。想要创建决议组,你首先需要在decisions/categories文件夹下创建一个文件,可以是 00_decision_categories.txt或是其他文件。 决议组条目如下所示:

find_resources = {
     icon = generic_prospect_for_resources
}

这是最简单的一种决议组,并且无论何种情况下都会出现。 You can also add conditions such as allowed, available, and visible like in normal decisions if you want the category to appear under specific circumstances. 例如:

find_resources = {
     icon = generic_prospect_for_resources
     available = { 
          num_of_civilian_factories > 3
     }
}

这将使得决议组仅在你拥有多于三个民用工厂时才会出现,与决议组中的决议是否满足条件无关。

创建决议

决议需要位于决议组中——让我们拿上之前的寻找资源决议组,并加入一个给国家增加乡村基础设施的决议。

find_resources = {
     develop_infrastructure = {
     
     }
}

决议效果

决议效果的代码是complete_effect。这条语句位于决议中,决定了当决议被选中时会发生的事情。让我们添加一个在选中时以500人力的代价增加基础设施的效果:

find_resources = {
     develop_infrastructure = {
          complete_effect = {
               random_owned_state = {
                    add_building_construction = { type = infrastructure level = 2 instant_build = yes }
               }
               add_manpower = -500
          }
      }
}

如果想更进一步了解random_owned_state,请查阅作用域,如果想了解关于add_building_constructionadd_manpower的更多信息,请查阅指令

随机效果(random_list effects)

默认情况下,决议启用时每次都是用相同的随机种子。这意味着,如果random_list用在决议中,它每次产生的结果都是相同的。 为了避免这种情况发生,你可以在决议代码中添加fixed_random_seed = no。 例如:

decision_category = {
	give_pp_or_experience_decision = {
		icon = generic_research
		available = {
			has_war = yes
		}
		fixed_random_seed = no
		complete_effect = {
			random_list = {
				33 = {
					add_political_power = 10
				}
				33 = {
					army_experience = 10
				}
				33 = {
					air_experience = 10
				}
			}
		}
		ai_will_do = {
			factor = 0
		}
	}
}

决议可用性

你可能想让某些决议在只满足某些条件的情况下才可用。例如,我们的发展基础设施的决议应当只能在国家有多于500人力的时候才可用。这可以用available语句实现,例子如下:

find_resources = {
     develop_infrastructure = {
          available = {
               has_manpower > 500
          }
          complete_effect = {
               random_owned_state = {
                    add_building_construction = { type = infrastructure level = 2 instant_build = yes }
               }
               add_manpower = -500
          }
     }
}

如果想要进一步了解has_manpower和其他条件,参见条件

决议花费

你可能也想让你的决议需要花政治点数启用。让我们给这个决议增加50政治点数的花费:

find_resources = {
     develop_infrastructure = {
          cost = 50
          available = {
               has_manpower > 500
          }
          complete_effect = {
               random_owned_state = {
                    add_building_construction = { type = infrastructure level = 2 instant_build = yes }
               }
               add_manpower = -500
          }
     }
}

决议是否可见

决议可能不总是要在决议栏中出现,否则会有些杂乱。为了做到这一点,我们只想让玩家拥有多于0的人力的时候才能看到这个决议,如下所示:

find_resources = {
     develop_infrastructure = {
          visible = {
               has_manpower > 0
          }
          cost = 50
          available = {
               has_manpower > 500
          }
          complete_effect = {
               random_owned_state = {
                    add_building_construction = { type = infrastructure level = 2 instant_build = yes }
               }
               add_manpower = -500
          }
     }
}

等一会再消失,或者过一会再回来

你可能想让决议在完成后等一会再消失,或者你想让决议在完成后过一会再度出现,又或者你可能只想让这个决议使用一次,这些可以通过如下方式实现:

days_remove = 5 # 完成后维持5天再移除

days_re_enable = 5 # 将在5天后显示于界面中,可以再次选择

fire_only_once = yes #在移除后将不会重新出现

导致战争的决议

如果你的决议会导致一个国家对另一个国家宣战,下列语句都会告知将被宣战的国家一场战争即将到来,同时警告AI把部队移动到边界上:

war_with_on_remove = TAG # War is declared on the nation in the TAG when the decision is removed

war_with_on_complete = TAG # War is declared on the nation in the TAG when the decision is completed

war_with_on_timeout = TAG # War is declared on the nation in the TAG when the decision times out

war_with_target_on_remove = yes # War is declared when the targeted decision is removed

war_with_target_on_complete = yes # War is declared when the targeted decision is completed

war_with_target_on_timeout = yes # War is declared when the targeted decision times out

移除时的效果

在一个决议执行完毕后(即你设置的决议的天数),你可能希望发生一个效果。以我们的基础设施决议为例,我们想在10天后归还人力:

find_resources = {
     develop_infrastructure = {
          visible = {
               has_manpower > 0
          }
          cost = 50
          available = {
               has_manpower > 500
          }
          complete_effect = {
               random_owned_state = {
                    add_building_construction = { type = infrastructure level = 2 instant_build = yes }
               }
               add_manpower = -500
          }  
          days_remove = 10
          remove_effect = {
               add_manpower = 500
          }
     }
}

决议修正

使用决议,你可以让一个修正只在一定时间内发挥作用。使用修正,只要决议处于激活状态(使用day_remove语句设置),就可以做到这一点。我们现在的决议已经有点忙了,所以这里建立一个新的决议,在激活后的200天内增加10%的战略资源获取率,代价是花费100政治点数。该决议只能使用一次:

find_resources = {
     resource_spree = {
          cost = 100
          fire_only_once = yes
          modifier = {
               local_resources_factor = 0.1
          }
          days_remove = 200
     }
}

关于local_resources_factor的更多信息,参见修正

目标决议

有时你希望一个决议针对多个TAG - 与其多次编写相同的决议来针对每个国家,不如使用一个有针对性的决议。在有针对性的决议中,FROM指的是(令人困惑的)决议的目标,而不是使用者。这里有一个新的决议,给予一个国家在随机状态下对德国、美国和日本其中之一增加基础设施的能力,代价是FROM(所得国)要付出50的政治点数和500的人力。

find_resources = {
     help_others = {
          target_trigger = {
               FROM = {
                    OR = {
                         tag = GER
                         tag = USA
                         tag = JAP
                    }
               }
          }
          cost = 50
          fire_only_once = yes
          complete_effect = {
               FROM = {
                    random_owned_state = {
                         add_building_construction = { type = infrastructure level = 2 instant_build = yes }
                    }
                }
                add_manpower = -500
          }
     }
}

省份决议(State targeted decisions)

The following section is duplicated from a blogpost by Yard1.

State targeted decisions are very similar to country targeted decisions. In order to define a decision as a state targeted decision, you need to put:

   state_target = yes

Then FROM will be a state scope, with target_trigger and target_root_trigger working like with country targeted decisions.

Just like with country targeted decisions, you can define targets (State IDs or variables) and /Hearts of Iron IV/target_array. Useful target arrays include:

   core_states
   controlled_states
   owned_states

Each array can be prefixed with another scope (so eg. EQS.core_states will scope to EQS’s core states, even if ROOT is something else), and you can use your own arrays too.

One extra key state targeted decisions have is on_map_mode. It has two possible values:

   on_map_mode = map_only - will not show the decisions in the decision tab, and instead only put icons over the states in the 3d map
   on_map_mode = map_and_decisions_view - will show the decisions both on map and in the decision tab

Another key is highlight_color_while_active = 1 - seems to highlight the state as long as the decision is active, even after exiting the decision tab. Only used for missions in vanilla.

Activating targeted decisions

Since target_trigger is checked for every country it can have quite a heavy effect on performance. If you simply want to add a targeted decision against a specific country from a focus you can do it by using an effect.

activate_targeted_decision = { target = TAG decision = decision_to_activate }

Note: FROM can be used here in place of a tag

Notes on testing

Target triggers may not be evaluated immediately. When testing triggers, give the game some time to reprocess / evaluate it, rather than erroneously assuming a coding error right away. This explicitly includes after unlocking the visible/available triggers through another action (decision made, national focus completed, etc.).

任务

任务遵循与决议相同的基本原则。这些任务也位于一个类别中 - 对于任务,我们将建立一个新的决议组和一个新的任务,这次是关于波兰征服柏林的。下面是我们在一个决议组中的完整任务 - 如果你不明白,也不用担心,我们会把它逐个分解以讲解:

polish_conquest = {                               # 这是我们的决议组
     conquer_berlin = {                           # 这是我们的任务id
          allowed = { tag = POL }                 # 这项任务只允许在波兰进行。其他国家将无法看到它或激活它
          available = {                           # 这里的Available和goal中的一样,因为:
               controls_state = 64                      # 只有控制了64号省份(柏林),我们才能完成这个任务
          }
          activation = {                          # 在这种情况下,任务被激活并开始倒计时:
               has_war_with = GER                       # 与德国交战
          }
          is_good = yes                           # 这个任务的颜色编码是有益事情(非危机)
          selectable_mission = yes                # 这个任务将在玩家点选任务时完成,而非自动完成
          days_mission_timeout = 100              # 距离任务失败前有多少天?
          timeout_effect = {                      # 当任务失败时会发生什么?
               add_political_power = -50               # 失去50点政治点数
          }
          complete_effect = {                    # 当我们激活任务时,即任务成功时会发生什么?
               add_political_power = 50                # 获得50点政治点数
          }
     }
}

决议组、决议及任务的本地化

主条目:Localisation

决议组和决议都是以类似于国策树的方式进行本地化。为了使我们的决议组和决议本地化,我们将有一个这样的本地化文件:

find_resources:0 "Find Resources"
find_resources_desc:0 "To increase the military might of our nation, we must find more natural resources within our borders to exploit"

develop_infrastructure:0 "Develop Infrastructure"
develop_infrastructure_desc:0 "In order to access our natural resources more effectively, we must develop rural infrastructure!"

resource_spree:0 "Resource Spree"
resource_spree_desc:0 "We should go on a resource spree to increase production for a short time"

警告:决议组的描述是强制存在的;在本地化文件中缺少"_desc "条目将导致所有其他决议组完全不显示。

Localising targeted decisions

We can use From to localise for our targeted country in targeted decisions, for example:

help_others:0 "Help [From.GetName] with their infrastructure"
help_others_desc:0 "We should send some help to [From.GetName] for their rural infrastructure"

完整例子

下面是本wiki页面中所有决议和任务的最终版本,归入一个决议组:

find_resources = {
     develop_infrastructure = {
          visible = {
               has_manpower > 0
          }
          cost = 50
          available = {
               has_manpower > 500
          }
          complete_effect = {
               random_owned_state = {
                    add_building_construction = { type = infrastructure level = 2 instant_build = yes }
               }
               add_manpower = -500
          }
          days_remove = 10
          remove_effect = {
               add_manpower = 500
          }
     } 

     resource_spree = {
          cost = 100
          fire_only_once = yes
          modifier = {
               local_resources_factor = 0.1
          }
          days_remove = 200
     }

     help_others = {
          target_trigger = {
               OR = {
                    tag = GER
                    tag = USA
                    tag = JAP
               }
          }
          cost = 50
          fire_only_once = yes
          complete_effect = {
               FROM = {
                    random_owned_state = {
                         add_building_construction = { type = infrastructure level = 2 instant_build = yes }
                    }
                    add_manpower = -500
                }
          }
     }
}