国策制作:修订间差异

本页面所适用的版本可能已经过时,最后更新于1.8
(文本替换 - 替换“[[Category:”为“[[分类:”)
(图书馆wiki行动(国策书))
第2行: 第2行:
[[国策]]的定义在{{path|common/national_focus/*.txt}}。
[[国策]]的定义在{{path|common/national_focus/*.txt}}。


== 国策==
==Focus tree==
{{SVersion|1.8}}
A focus tree is defined by using a <code>focus_tree = { ... }</code> block. The following arguments are used:
  单个国策被捆绑于国策树上。
 
=== 属性===
<code>id = my_focus_tree</code> decides the ID that the focus tree uses. It is mandatory to define, and an overlap will result in an error. The ID is primarily used for the has_focus_tree trigger and the load_focus_tree effect, whose tooltips use it as a localization key.
 
<code>country = { ... }</code> is a MTTH block that assigns a score for the focus tree, deciding which one is used in-game. This is evaluated ''before the game's start'' and the check is essentially '''never refreshed'''. The focus tree with the highest score will be the one that gets loaded for the country. By default, the score starts with 1. A typical usage looks like this:<tabber>
 
country = {
   factor = 0
   modifier = {
     add = 20
     original_tag = TRA
   }
}
</tabber>In this case, countries originating from  Transylvania (i.e. the country itself and any civil war or collaboration government breakaways, as ensured by the original_tag trigger) will have the score of 20, while every other country will have the score of 0. Assuming that there is no other focus tree where  Transylvania has a higher country score, this will ensure that this focus tree gets loaded for it.
 
<code>default = yes</code> sets the focus tree to be marked as default. In total, ''there should be one total default focus tree'', no more, no less. A focus tree being marked as default means that if every other focus tree has a country score of 0, this tree will be chosen instead. Additionally, a country starting with a focus tree will fail to appear in the "minor countries" section within the "interesting countries" menu before the game's start. If this is left out from a focus tree, it gets assumed to be non-default.
 
<code>reset_on_civilwar = no</code> is not determined on its effect. Instead, this is how focus trees are handled in civil wars, regardless of if <code>reset_on_civilwar</code> is set or how it's set:
 
When a civil war starts, the original country will always continue using the focus tree. The focus it's doing will not be paused or cancelled by the civil war itself. The revolter will have the focus tree it's using evaluated when the civil war starts, assigning one depending on each tree's <code>country = { ... }</code> value. If the same focus tree gets used for the revolting country as the one that the original country used when the civil war started, every focus that the original country has completed will get completed for the revolting country, including setting the same focus progress for the one that's being completed by the original country at the moment. Otherwise, the focus progress will get lost.
 
<code>shared_focus = TAG_focusname</code> will set the focus tree to include the specified shared focus and every focus that is connected to it via prerequisites. '''Setting this to a non-existing focus causes a game crash when loading into the main menu.'''
 
<code>continuous_focus_position = { x = 1200 y = 100 }</code> is the position of the top left corner of the continuous focus menu ''in pixels''. For comparison, by default, the continuous focus palette has the position of 50 on the X axis and 1000 on the Y axis. If both x and y are set to 0 or the position is undefined for the tree, it resets to the default position.
 
<code>initial_show_position = { ... }</code> decides the initial position of the camera when the focus tree is first opened. There are 2 ways to arrange it:
 
* <code>focus = TAG_focusname</code> will make the camera centre on the specified focus in particular. It'll be in the top centre of the screen exactly, taking offsets into consideration.
* <code>x = 12 y = 0</code> decides the exact position of the top-centre of the camera. This uses the same coordinate system as regular focuses do, by default a unit of x being equal to 96 pixels and a unit of y being equal to 130 pixels
 
: This also accepts <code>offset = { ... }</code>, adding the specified values to respective positions if the conditions within the <code>trigger = { ... }</code> trigger block are met for the country. For example, this will apply the modifier and result in a position of x = 13, y = 1 if the country is BHR:<tabber>
initial_show_position = {
   x = 17
   y = 0
   offset = {
     x = -4
     y = 1
     trigger = {
       tag = BHR
     }
   }
}
</tabber><code>focus = { ... }</code> are the focuses themselves. Each focus that's put within the focus tree will. The focuses '''have''' to be within a <code>focus_tree = { ... }</code> in order to let the game know which focus tree exactly to assign them to. If a <code>focus = { ... }</code> blocks ends up outside of a <code>focus_tree = { ... }</code> or within another <code>focus = { ... }</code>, this gets marked within the error log as "focus" being an unexpected token, fixed by adjusting brackets as needed.
 
==== id ====
==== id ====
(变量类型: 字符串string) 国策的独一无二的标识符。
(变量类型: 字符串string) 国策的独一无二的标识符。

2024年8月3日 (六) 22:46的版本

国策的定义在/Hearts of Iron IV/common/national_focus/*.txt

Focus tree

A focus tree is defined by using a focus_tree = { ... } block. The following arguments are used:

id = my_focus_tree decides the ID that the focus tree uses. It is mandatory to define, and an overlap will result in an error. The ID is primarily used for the has_focus_tree trigger and the load_focus_tree effect, whose tooltips use it as a localization key.

country = { ... } is a MTTH block that assigns a score for the focus tree, deciding which one is used in-game. This is evaluated before the game's start and the check is essentially never refreshed. The focus tree with the highest score will be the one that gets loaded for the country. By default, the score starts with 1. A typical usage looks like this:

{
   factor = 0
   modifier = {
       add = 20
       original_tag = TRA
   }

}

In this case, countries originating from  Transylvania (i.e. the country itself and any civil war or collaboration government breakaways, as ensured by the original_tag trigger) will have the score of 20, while every other country will have the score of 0. Assuming that there is no other focus tree where  Transylvania has a higher country score, this will ensure that this focus tree gets loaded for it.

default = yes sets the focus tree to be marked as default. In total, there should be one total default focus tree, no more, no less. A focus tree being marked as default means that if every other focus tree has a country score of 0, this tree will be chosen instead. Additionally, a country starting with a focus tree will fail to appear in the "minor countries" section within the "interesting countries" menu before the game's start. If this is left out from a focus tree, it gets assumed to be non-default.

reset_on_civilwar = no is not determined on its effect. Instead, this is how focus trees are handled in civil wars, regardless of if reset_on_civilwar is set or how it's set:

When a civil war starts, the original country will always continue using the focus tree. The focus it's doing will not be paused or cancelled by the civil war itself. The revolter will have the focus tree it's using evaluated when the civil war starts, assigning one depending on each tree's country = { ... } value. If the same focus tree gets used for the revolting country as the one that the original country used when the civil war started, every focus that the original country has completed will get completed for the revolting country, including setting the same focus progress for the one that's being completed by the original country at the moment. Otherwise, the focus progress will get lost.

shared_focus = TAG_focusname will set the focus tree to include the specified shared focus and every focus that is connected to it via prerequisites. Setting this to a non-existing focus causes a game crash when loading into the main menu.

continuous_focus_position = { x = 1200 y = 100 } is the position of the top left corner of the continuous focus menu in pixels. For comparison, by default, the continuous focus palette has the position of 50 on the X axis and 1000 on the Y axis. If both x and y are set to 0 or the position is undefined for the tree, it resets to the default position.

initial_show_position = { ... } decides the initial position of the camera when the focus tree is first opened. There are 2 ways to arrange it:

  • focus = TAG_focusname will make the camera centre on the specified focus in particular. It'll be in the top centre of the screen exactly, taking offsets into consideration.
  • x = 12 y = 0 decides the exact position of the top-centre of the camera. This uses the same coordinate system as regular focuses do, by default a unit of x being equal to 96 pixels and a unit of y being equal to 130 pixels
This also accepts offset = { ... }, adding the specified values to respective positions if the conditions within the trigger = { ... } trigger block are met for the country. For example, this will apply the modifier and result in a position of x = 13, y = 1 if the country is BHR:
{
   x = 17
   y = 0
   offset = {
       x = -4
       y = 1
       trigger = {
           tag = BHR
       }
   }

}

focus = { ... } are the focuses themselves. Each focus that's put within the focus tree will. The focuses have to be within a focus_tree = { ... } in order to let the game know which focus tree exactly to assign them to. If a focus = { ... } blocks ends up outside of a focus_tree = { ... } or within another focus = { ... }, this gets marked within the error log as "focus" being an unexpected token, fixed by adjusting brackets as needed.

id

(变量类型: 字符串string) 国策的独一无二的标识符。

文本id(text)

(变量类型: 字符串string, 默认: id) 一个可替换的文本标识符。这允许多个国策使用同一个名称和描述。

动态(dynamic)

(变量类型: 布尔boolean, 默认: no) 如果为真,本地化的字符串可以包括占位符,例如可以允许国策名字根据意识形态改变。

花费时间(cost)

(变量类型: number (three decimal places precision), 默认: 0) 国策将要花费多长时间(乘以7天)。

允许国策支(allow_branch)

(变量类型: AND trigger, 默认: { }) 如果这个trigger非空,它就可以专有地决定一个国策是否可用。如果这个trigger为假,这个国策及其依赖项都不可用且不可见。

前提条件(prerequisite)

定义一系列作为该国策前提条件的国策(至少一个)。前提国策的id可以由focusOR给出。可以出现多次,在这种情况下每一个prerequisite都需要满足。例如:

prerequisite = { focus = GER_kdf_wagen OR = GER_synthetic_rubber }
prerequisite = { focus = GER_important_focus }

在上面的例子中,GER_kdf_wagenGER_synthetic_rubber中的一个完成了,就是满足了国策的第一个前提条件,但是GER_important_focus也需要完成。第一行也可以等效地写成prerequisite = { focus = GER_kdf_wagen focus = GER_synthetic_rubber }.

互斥(mutually_exclusive)

定义一系列国策,每个国策都和该国策互斥。语法规则和prerequisites相同。可以出现多次,以使该国策与其他多个国策互斥。

可用(available)

(变量类型: AND trigger, 默认: { }) 当allow_branch不存在时,若这个trigger为假,国策将不可用。

投降后可用(available_if_capitulated)

(变量类型: 布尔boolean, 默认: no) 如果为假,这个国策对已投降的国家将不可用,如果国策正在进行,国家投降时国策将会取消。

可取消(cancelable)

(变量类型: 布尔boolean, 默认: yes) 如果为假,国策将不能手动取消。

取消(cancel)

(变量类型: AND trigger, 默认: { }) 当国策进行中而取消触发器变为真时,国策将会取消。与普通的AND触发器不同,一个空的取消触发器被视为假。

无效时取消(cancel_if_invalid)

(变量类型: 布尔boolean, 默认: yes) 如果为真,当available变为假时正在进行的国策会被取消。

无效时继续(continue_if_invalid)

(变量类型: 布尔boolean, 默认: no) 如果为真,cancelcancel_if_invalid会被忽略

开始效果(select_effect)

(变量类型: effect) 当国策被选中开始时,效果将会实施。

完成奖励(completion_reward)

(变量类型: effect) 当国策完成时,效果将会实施。

完成提示(complete_tooltip)

(变量类型: effect) 国策的完成提示将会显示这里面的效果而不是真正的完成奖励completion_reward

跳过(bypass)

(变量类型: AND trigger, 默认: { }) 当跳过触发器为真时,任意当前正在进行中或者可用的国策都会跳过。与普通的AND触发器不同,一个空的跳过触发器被视为假。Bypassing ignores the available trigger. 当一个国策有互斥选项时,玩家需要手动选择跳过。otherwise the bypass happens automatically as soon as the conditions are fulfilled.

图标(icon)

(变量类型: 字符串string) 图形图标名,一般是在/Hearts of Iron IV/interface/goals.gfx中定义。

x坐标(x)

(变量类型: 整数integer, 默认: 0) 国策的水平坐标,网格行。

y坐标(y)

(变量类型: 整数integer, 默认: 0) 国策的垂直坐标,网格列。

坐标移动(offset)

一个对xy坐标属性的额外转换,以一个触发器为条件。xy坐标属性是整数integers,其中的触发器是一个AND触发器。例子如下:

offset = {
	x = -1
	y = 0
	trigger = {
		NOT = { has_dlc = "Man the Guns" }
	}
}

相对位置id(relative_position_id)

(变量类型: 字符串string) 此国策的图形坐标将相对于参考原点国策的位置生成。通常来说参考原点国策会是该国策的前置国策,这样就可以做到移动根国策就可以移动整棵国策树。在编辑国策树时推荐使用相对位置。代码样例如下:

focus = {
	id = root_focus
	x = 2
	y = 0
}
focus = {
	id = branch_focus
	relative_position_id = root_focus
	x = -1
	y = 1
}

在这种情况下,root_focus的坐标为(2,0),而branch_focus的实际坐标为(1,1),可以通过移动root_focus来一起移动其后的整个国策树。

historical

(变量类型: 布尔boolean, 默认: no) 从未使用

历史AI(historical_ai)

(变量类型: AND trigger, 默认: { }) 如果历史AI国策是开启状态,AI只会当这个触发器为真时才会选择这个国策。

is_historical_focus_on

(变量类型: 布尔boolean, 默认: no) 当历史AI国策为启用时,这个布尔值为真。 使用例:

ai_will_do = {
        modifier = {
	        factor = 0
	        is_historical_focus_on = yes
	        date < 1145.1.4
        }
}

AI意愿(ai_will_do)

(变量类型: MTTH, 默认: { base = 1 }) 定义AI选择这个国策的可能性。The value is further modified by +50% if the focus is not at the root of a branch, proportionately reduced if a mutually exclusive choice, as well as multiplied by any focus_factors in AI strategy plans. For each available focus, the AI generates a random number between 0 and the calculated value. It chooses the focus with the highest resulting number.

For example if two focuses are available with calculated values of 1.5 and 3 respectively, the former has a chance of 1-in-6 to be picked and the latter 5-in-6.

导致与某国的战争(will_lead_to_war_with)

(变量类型: country tag) 当该国策进行时,这个国家会收到提示警告,告知本国正在被正当化战争借口。可以出现多次。

本地化(Localization)

国策的本地化键值以国策的id(或文本id)作为前缀。例如,有一个国策id = XYZ,那么本地化键值应该为:

  • XYZ:名称
  • XYZ_desc:描述

国策树

每一个国家都有一个包括许多国策的国策树。并且还可以加入持续性国策和共享国策。

属性

id

(变量类型: 字符串string) 国策树的独一无二的标识符。

国家(country)

(变量类型: MTTH, 默认: { base = 1 })国家(tag)适用这个国策的分数。一个国家会使用相应分值最高的国策树。为了把国策树给到相应国家上,这个值应该高于默认的0,为目标国家添加一个较高的修正值。

默认(default)

(变量类型: 布尔boolean, 默认 no) 如果为yes,这个国策树会给所有没有比0更高的分值的国策树的国家。只有一个国策树应该设为默认,在原版游戏中是generic_focus。

在内战中重设(reset_on_civil_war)

(变量类型: 布尔boolean, 默认: yes) 如果为no,当内战中新出现的国家获得相同的国策树时,它会自动继承原国家的所有国策进度。否则,内战出现的国家会从头开始进行国策。

持续性国策位置(continuous_focus_position)

(变量类型: point, 默认: { x = 0, y = 0 }) 持续性国策面板的视觉位置。

国策(focus)

(变量类型: national focus) 以上文中所说的方式定义和添加一个国策。可以出现多次。

共享国策(shared_focus)

(变量类型: 字符串string) 使得该国策及它的依赖项可以被植入其他国策树。可以出现多次。一个共享国策必须在任何国策树之外用shared_focus定义,否则它的含义和普通国策相同。

例子

shared_focus = {
    id = shared_1
    x = 10
    offset = {
        x = 10
        trigger = {
            tag = LIT
        }
    }
    completion_reward = {
        army_experience = 10
    }
}
focus_tree = {
    id = lithuania_focus
    country = {
        base = 0
        modifier = {
            add = 10
            tag = LIT
        }
    }
    shared_focus = shared_1

    focus = {
        id = LIT_focus_1
        x = 10
        completion_reward = {
            navy_experience = 10
        }
    }
    focus = {
        id = LIT_focus_2
        prerequisite = { focus = LIT_focus_1 }
        relative_position_id = LIT_focus_1
        y = 10
        completion_reward = {
            navy_experience = 10
        }
    }
}
focus_tree = {
    id = basic_focus
    country = {
        base = 1
    }
    shared_focus = shared_1
}