无编辑摘要 |
小 (林登万移动页面Decision modding至决议修改) |
(没有差异)
|
2020年8月18日 (二) 00:08的版本
决议路径
Decisions can be found in /Hearts of Iron IV/common/decisions, Decision categories can be found in /Hearts of Iron IV/common/decisions/categories.
创建决议组
All decisions need to sit inside a category - this can house multiple decisions, and can have it's own picture and description. A basic category is as follows - throughout the page we will use the example of creating a category about looking for new resource. To create a category you need to add a file in decisions/categories, this can be in 00_decision_categories.txt, or a different file. The category entry is as follows:
find_resources = { icon = generic_prospect_for_resources }
This is the simplest type of category, and will appear always no matter what. 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. For example:
find_resources = { icon = generic_prospect_for_resources available = { num_of_civilian_factories > 3 } }
This will make the decision category only appear if you have more than 3 civilian factories regardless of whether the decisions inside meet their requirements.
创建决议
Decisions need to sit nestled inside a category - let's take our category of prospecting resources and give the country a decision to improve rural infrastructure:
find_resources = { develop_infrastructure = { } }
决议效果
Decisions have effects using complete_effect. This is nestled inside the decision, and defines what will happen when the decision is selected. Let's give our option to improve rural infrastructure the effect of actually improving infrastructure in a random state for the cost of 500 manpower:
find_resources = { develop_infrastructure = { complete_effect = { random_owned_state = { add_building_construction = { type = infrastructure level = 2 instant_build = yes } } add_manpower = -500 } } }
For more information on random_owned_state, see scopes, and for more information on add_building_construction and add_manpower, see commands
random_list effects
By default decisions use the same random seed everytime they are enacted. This means, if random_list
is used in a decision, it will give the same result everytime.
To prevent this, you can add fixed_random_seed = no
to the decision.
For example:
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 } } }
决议可用性
You will want to make some decisions available only under certain circumstances. For example, our decision to develop infrastructure should only be available if the country has more than 500 manpower to spend. This can be achieved by a available block, as follows:
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 } } }
For more information on has_manpower and other conditions, see conditions
决议花费
You may also want your decision to cost political power to begin. Let us give our decision the cost of 50 political power:
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 } } }
决议是否可见
A decision may not always need to be visible on the decision tab, to avoid cluttering it up. In order to avoid clutter we only want the decision to appear if the player has more than 0 manpower, as follows:
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 } } }
等一会再消失,或者过一会再回来
You may wish for your decision to remain in the category for a short while after it has been completed, or you may wish for it to return after a short time. Equally you might wish for your decision to only be used once. These can all be achieved as follows:
days_remove = 5 # Stays for 5 days before being removed days_re_enable = 5 # Will show up in the interface and can be selected again after 5 days fire_only_once = yes # Will not re-enable after being removed
导致战争的决议
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:
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
移除时的效果
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:
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 } } }
决议修正
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:
find_resources = { resource_spree = { cost = 100 fire_only_once = yes modifier = { local_resources_factor = 0.1 } days_remove = 200 } }
For more on local_resource_factor, see 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:
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.).
任务
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 conquer_berlin = { # This is our mission id allowed = { tag = POL } # This mission is only allowed for Poland. Other countries will not be able to see it or activate it. available = { # Available here means as much as goal because: controls_state = 64 # we can only finish this mission if we control state 64 (Berlin) } activation = { # The mission appears and starts counting down under these circumstances: has_war_with = GER # War with Germany } is_good = yes # This mission is color coded to be a positive thing (not a crisis) selectable_mission = yes # This mission will complete when the player selects the mission rather than completing automatically days_mission_timeout = 100 # How many days before the mission fails? timeout_effect = { # What happens when we fail the mission? add_political_power = -50 # Lose 50 PP } complete_effect = { # What happens when we activate the mission i.e. mission success? add_political_power = 50 # Gain 50 PP } } }
Localising categories, decisions and missions
- 主条目: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_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"
Warning : the description for category is mandatory ; missing the "_desc" entry in localisation files will result on all other categories not printed at all.
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"
完整例子
Below are all the final versions of decisions and missions in this wiki page, in one category:
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 } } } }
文件 | 效果 • 条件 • 定义 • 修正 • 修正列表 • 作用域 • 本地化 • on action • 数据结构 (标记, 临时标记, 国家别名, 变量, 数组) |
脚本 | 成就修改 • AI修改 • AI focuses • 自治领修改 • 权力平衡修改 • 剧本/标签 (游戏规则)• 建筑修改 • 人物修改 • 修饰性TAG修改 • 国家创建 • 军队修改 • 决议制作 • 装备修改 • 事件修改 • Idea修改 • 意识形态修改 • 军工商修改 • 国策制作 • 资源修改 • Scripted GUI • 科技制作 • 单位修改 |
地图 | 地图 • 省份 • 补给区域 • 战略区域 |
图形图像 | 界面 • 图形资产 • 实体模型 • 后期特效 • 离子效果 • 字体 |
装饰性 | 肖像 • 命名列表 • 音乐 • 音效 |
其他 | 控制台指令 • 故障排除 • 模组结构 • 成就代码分析 • Mod相关 • Nudger修改 |