这个页面假设你掌握了创建一个模组的基本知识。该页面主要聚焦于帮助模组作者更好地理解如何在某些特定方面编辑一个国家。
快速检查单
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.8。 |
如果你想在模组中创建一个新国家,可以参考以下快速检查单:
- 定义一个独特的三字符国家tag。
- 在<yourmod>/common/countries中新建文件。
- 在<yourmod>/history/countries中新建文件。
- 在<yourmod>/localisations中增加本地化。
- 在<yourmod>/gfx/flags中为每一种意识形态添加一个大,中,小号的旗帜。
- 可选:在<yourmod>/history/units中创建OOB文件。
- 可选:把国家加入到游戏中。
国家tag
每个国家都要一个三个英文字符的tag, 这是在游戏的所有文件中指明国家的方式。所有国家的TAG都得是独一无二的. 任何国家都不能跟别的国家有一样的TAG
要建立一个新TAG,就往<yourmod>/common/country_tags (或者把原有的文件改了)添加新信息并且再写上像这样的东西:
SCO = "countries/Scotland.txt"
where
countries/Scotland.txt
你想创建或者改动国家标签的文件位于<yourmod>/common/countries
国家文件
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.8。 |
在<yourmod>/common/countries 文件夹中创建一个新的文件.建议复制一个相似的国家的文件来再改成你要的。
单位图像
在这里设置设置国家单位图形。比如苏格兰是:
graphical_culture = commonwealth_gfx graphical_culture_2d = commonwealth_2d
颜色
这里设置的是国家在地图上的颜色。 它使用 RGB色阶
color = { 2 10 222 }
colors.txt
确保国家颜色被写入了<yourmod>/common/countries/colors.txt:
SCO = { color = rgb { 2 10 222 } color_ui = rgb { 255 255 155} }
`color_ui` 通常是比该国家普通颜色更深的色彩,因为这是用于涂边界的 (如果边界看起来很丑,那就再看看你文件有没写错).颜色也能用 HSV形式写指定
国家历史
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.8。 |
在 <yourmod>/history/countries 文件夹中创建该文件. 或者复制个相似国家的文件,重命名并更改。文件名应该是<该国tag - 该国名字>, 比如"SCO - Scotland".这个文件包含了该国家的历史以及默认属性
首都
在这写入国家首都. 要用地区ID(state)而非省份(province)ID指定首都.这样的话,121是洛锡安地区,包含爱丁堡
capital = 121
战斗顺序
这些文件会被链接到'Order of Battle' (OoB)记录了部队数量和位置、经验及装备状况, 还有开局国家拥有的空军联队。开始时的生产状况及部队编制也被记录在那儿。每个国家都需要链接到OoB, 不过如果那个国家将在之后被释放那么就别给他写OoB文件了
oob = "SCO_1936"
为了方便调用,海军通常被编入单独的OoB.另外,因为'炮手就位' DLC对海军改动很大,一个国家通常都有两个独立的海军OoB, 一个就是为了给那个DLC的, 另一个就是给没买那个DLC的人, 使用旧的海军系统(OOB通常以a _legacy为后缀区分)
if = { limit= { has_dlc = "Man the Guns" } set_naval_oob = "SCO_1936_naval_mtg" else = { set_naval_oob = "SCO_1936_naval_legacy" } }
科研槽
Defines the amount of research slots a country has access to at the start. Normally, major powers have 4 slots, minor countries in North America and Europe have 3 and minor countries in the rest of the world have 2. Defaults to 2 slots, if not specified.
set_research_slots = 3
稳定度
Defines the stability percentage that a country will have at the start of the game. The number that is put here will be multiplied by 100 when applied to the country, so the max is 1 (100) and the minimum is 0 (0).
set_stability = 0.7
战争支持度
Defines the war support percentage that a country will have at the start of the game. Like stability, the number will be multiplied by 100 when applied to the country, with the max being 1 (100) and minimum being 0 (0).
set_war_support = 0.5
民族精神和内阁
Sets Ideas country starts with (National Spirits, as well as advisors, companies & laws). A list of ideas can be found in /Hearts of Iron IV/common/ideas
Note that you don't have to add any ideas. Country will then start with no advisors, Civilian Economy and Volunteer Only conscription. This is an example:
add_ideas = { henschel GER_autarky_idea #laws war_economy extensive_conscription }
科技
Here the technology a country has from the start is declared. A list of technologies can be found in /Hearts of Iron IV/common/technologies.
set_technology = { infantry_weapons = 1 infantry_weapons1 = 1 tech_engineers = 1 tech_mountaineers = 1 motorised_infantry = 1 gw_artillery = 1 interwar_antiair = 1 gwtank = 1 basic_light_tank = 1 basic_heavy_tank = 1 early_fighter = 1 fighter1 = 1 early_bomber = 1 tactical_bomber1 = 1 strategic_bomber1 = 1 CAS1 = 1 naval_bomber1 = 1 }
Keep in mind that those who own 'Man the Guns' DLC will need to use a different set of technologies for ships, therefore you have to set technologies for ships twice, like this:
if = { limit = { not = { has_dlc = "Man the Guns" } } set_technology = { early_submarine = 1 early_destroyer = 1 } set_naval_oob = "SCO_1936_naval_legacy" } if = { limit = { has_dlc = "Man the Guns" } set_technology = { basic_naval_mines = 1 submarine_mine_laying = 1 early_ship_hull_light = 1 early_ship_hull_submarine = 1 basic_ship_hull_submarine = 1 basic_battery = 1 basic_torpedo = 1 basic_depth_charges = 1 } set_naval_oob = "SCO_1936_naval_mtg" }
其他(可选)
Add starting political power:
add_political_power = 500
Adds this amount of trade convoys. Note: If present multiple times in the same file, these stack
set_convoys = 100
Add starting research bonus. Useful for example if you had to manually complete a complex National Focus that adds research bonus, and effects had to be applied individually. For example this is used in the Soviet history file.
add_tech_bonus = { bonus = 1.0 uses = 2 category = armor }
Add wargoal:
create_wargoal = { type = take_state_focus target = POL generator = { 72 88 90 87 86 } # Zaolzie Krakow Kielce Lodz Poznan }
Country and global flags:
set_global_flag = earhart_disappeared #Global flags can be placed in any country's file set_country_flag = sudetenland_acquired #For Germany in 1939
USA = { #country to which the event will happen country_event = { id = usa.50 days = 2 } #triggers this event, 2 days from the start country_event = { id = usa.51 days = 2 } }
Opinion modifiers:
add_opinion_modifier = { target = POL modifier = refused_anti_comintern_pact_opinion }
Modifiers have their effects defined in /Hearts of Iron IV/common/opinion_modifiers
外交
If the new country has any diplomatic relations, these can be declared here. It is recommended that one adds relations only in one file (not in both the faction leader's file and the minor ally's for instance).
阵营
Factions are defined by adding the following line:
create_faction = Clanintern
The country that belongs to the file this line is in will take the role of faction leader. Other countries may be added to the faction:
add_to_faction = IRE
Puppets of members should always be added to the faction as well, to prevent bugs.
傀儡国
Puppets are defined as follows if the player has the 'Together for Victory' Expansion:
set_autonomy = { target = ENG autonomous_state = autonomy_integrated_puppet }
and as follows if they don't:
puppet = ENG
In order to make the mod useable for both types of players an if-statement should be used:
if = { limit = { has_dlc = "Together for Victory" } set_autonomy = { target = ENG autonomous_state = autonomy_integrated_puppet } else = { puppet = ENG } }
If the player has 'Together for Victory', Great Britain will be an integrated puppet, if not, they will be a regular (the only type of) puppet.
其他外交行动
Guarantee Independence:
The country this file belongs to will guarantee the following TAG
give_guarantee = FRA
Non-aggression Pact:
diplomatic_relation = { country = USA relation = non_aggression_pact }
Starting trade:
The country this file belongs to will import preset amount of resource
create_import = { resource = tungsten factories = 1 exporter = SWE }
Military access:
give_military_access = IRE
科技共享
If the player has 'Together for Victory' one can add the country to a tech sharing group:
add_to_tech_sharing_group = haggis_investigators
An if-statement as shown above will be required to limit it to 'Together for Victory' owners and to prevent bugs with those that don't own it.
设定党派支持度
Defines the popularity of different parties in the country:
set_popularities = { democratic = 5 communism = 80 fascism = 10 neutrality = 5 }
设定政治
Defines the ruling party and how elections work in a country:
set_politics = { ruling_party = communism last_election = "1932.11.8" election_frequency = 48 elections_allowed = no }
Note: Frequency is in months
国家领导人
Defines the leaders a country has. In theory adding a leader for only the starting ideology would be enough, as the other ones will be randomly generated, it is possible however, to define the leaders of all parties.
create_country_leader = { name = "Ronald McDonald" desc = "POLITICS_RONALD_MCDONALD_DESC" picture = "gfx/leaders/Europe/Portrait_Europe_Generic_land_3.dds" expire = "1965.1.1" ideology = fascism_ideology traits = { scary_clown } }
One can add a custom portrait by adding it in in DDS-format, which may require Gimp or Paint.net to edit.
A list of traits can be found in /Hearts of Iron IV/common/country_leader. It is possible to add more there as well.
将军
Custom army leaders may be defined here:
create_corps_commander = { name = "Sean McHaggis" portrait_path = "gfx/leaders/Europe/Portrait_Europe_Generic_land_4.dds" traits = { panzer_leader fortress_buster } attack_skill = 4 defense_skill = 2 planning_skill = 1 logistics_skill = 2 }
As well as naval leaders:
create_navy_leader = { name = "James McSeafarer" portrait_path = "gfx/leaders/Europe/Portrait_Europe_Generic_navy_1.dds" traits = { blockade_runner superior_tactician } attack_skill = 3 defense_skill = 3 maneuvering_skill = 5 coordination_skill = 2 }
变种型号(可选)
Special variants on equipment available for this country from the start can be defined as well:
create_equipment_variant = { name = "Haggis Class" type = submarine_1 upgrades = { sub_engine_upgrade = 3 sub_stealth_upgrade = 2 sub_torpedo_upgrade = 2 } }
create_equipment_variant = { name = "Scotfire" type = fighter_equipment_1 upgrades = { plane_gun_upgrade = 3 plane_range_upgrade = 0 plane_engine_upgrade = 3 plane_reliability_upgrade = 3 } } create_equipment_variant = { name = "Tanktoon 2" type = light_tank_equipment_2 upgrades = { tank_gun_upgrade = 5 tank_armor_upgrade = 1 tank_engine_upgrade = 2 tank_reliability_upgrade = 0 } obsolete = yes #optional, marks the unit as obsolete and hides the unit from the UI }
本地化
Add the localisation for your new country to the following file (it is generally recommended to always create a new, separate file, to avoid overwrites of vanilla files)
<yourmod>/localisation/mynewscotland_l_<language>.yml
where <language> can be either English, German, Spanish, French, Polish, Russian or Brazilian Portuguese. A file can be created for each language for better coverage across the supported languages.
Define the localisation for the country's name and its adjective as follows for every ideology:
SCO_communism: "People's Republic of Scotland" SCO_communism_DEF: "The People's Republic of Scotland" #For events SCO_ADJ: "Scottish"
Note: Do not mistake the correct letter _l_ ( L ) with a letter i ( I ), or number 1 ( One ), it's a common mistake, causing localisations to not show up, without any evident cause.
旗帜
每个国家需要12个旗帜:四种意识形态,包括中立主义在内,每种一个旗帜,并且每种需要三个尺寸:标准、中(Medium)、小(Small)。所有旗帜需要以TGA格式保存,文件名包括国家的tag和旗帜所用于的意识形态。(例如:ABC_neutrality.tga)文件格式应该是32位、无压缩的。
然而,如果你不想为每个意识形态制作单独的旗帜,也可以创建一个各种尺寸的单独旗帜,并且将其单纯以国家tag命名而不包括意识形态。例如:ABC.tga将会在该国家没有此时意识形态特定的旗帜时,作为该国家的旗帜使用。
要求尺寸 | |
---|---|
标准 | 82x52 pixel |
中 | 41x26 pixel |
小 | 10x7 pixel |
所有旗帜位于/Hearts of Iron IV/gfx/flags。用于模组制作目的时,将旗帜放置于<yourmod>/gfx/flag下,并且将各尺寸的旗帜放置于相应的子文件夹下。
战斗顺序(可选)
File:Ambox outdated info.png | 这部分内容可能已不适合当前版本,最后更新于1.8。 |
If the country will exist at the start, an order of battle is necessary for the country to have an army. Create a new file in /Hearts of Iron IV/history/units or copy one from a similar country. It must be named exactly the way it's linked in the country's history file. Specific names of different types of units and their support companies can be found in /Hearts of Iron IV/common/units.
师模板
First the default division template will be defined, simply set up what regiments will fill the country's divisions:
division_template = { name = "Blueskirt Division" regiments = { infantry = { x = 0 y = 0 } infantry = { x = 0 y = 1 } infantry = { x = 0 y = 2 } infantry = { x = 1 y = 0 } infantry = { x = 1 y = 1 } infantry = { x = 1 y = 2 } infantry = { x = 2 y = 0 } infantry = { x = 2 y = 1 } infantry = { x = 2 y = 2 } infantry = { x = 3 y = 0 } infantry = { x = 3 y = 1 } } }
As can be seen, this division exists solely out of infantry. Example of more advanced unit template from Germany, which will use german infantry names:
division_template = { name = "Infanterie-Division" division_names_group = GER_Inf_01 regiments = { infantry = { x = 0 y = 0 } infantry = { x = 0 y = 1 } infantry = { x = 0 y = 2 } infantry = { x = 1 y = 0 } infantry = { x = 1 y = 1 } infantry = { x = 1 y = 2 } infantry = { x = 2 y = 0 } infantry = { x = 2 y = 1 } infantry = { x = 2 y = 2 } } support = { engineer = { x = 0 y = 0 } artillery = { x = 0 y = 1 } } }
师位置
Division can be placed as follows:
units = { division= { name = "1st Blueskirt Division" location = 9392 # Edinburgh division_template = "Blueskirt Division" start_experience_factor = 0.2 #optional, otherwise starts with 0 expereince start_equipment_factor = 0.3 #optional, otherwise starts with equipment factor of 1 (maximum) } }
The name is simply the name the game shows for the division, the location is where the division is on the map, the template links to the template defined above and start_experience_ and _equipment_factors define how much experience and equipment the division has. Alternatevely you can use the automatic naming using a predefined list of names.
division= { division_name = { is_name_ordered = yes name_order = 35 } location = 6488 division_template = "Infanterie-Division" start_experience_factor = 0.1 #optional, otherwise starts with 0 expereince force_equipment_variants = { infantry_equipment_0 = { owner = "GER" } } #optional, replaces equipment with a specific variant (for example to give obsolete equipment to garrison units) }
空军联队
Air wings are not placed into a specific province, but rather a State.
air_wings = { 121 = { # Edinburgh tac_bomber_equipment_0 = { owner = "SCO" amount = 72 } start_experience_factor = 0.2 #optional, otherwise starts with 0 expereince fighter_equipment_1 = { owner = "SCO" version_name = "Scotfire" amount = 150 } #version_name is optional start_experience_factor = 0.5 } }
version_name defines a specific variant of that type of equipment to be used. It first needs to be defined in the same file.
添加其他剧本的历史(可选)
If you want to edit something about your country, but only want it applied after a specific date (as in 1939 bookmark for example), you have to add these lines to the history file:
1939.1.1 = { #There you can add anything, in the same format as described earlier oob = "SCO_1939" #Usually another oob is used for later bookmarks, only the latest one will be loaded set_technology = { atomic_research = 1 nuclear_reactor = 1 nukes = 1 } }
国策
National Focuses can be completed in two ways: If you want the effects to apply, then use:
complete_national_focus = army_effort
If you want to just bypass the focus (often used for more complex focuses, like 'Demand Sudetenland', and apply effect manually, without triggering all the associated events), use:
unlock_national_focus = GER_demand_sudetenland
具体案例
Cancelling a relation that is activated earlier (like a guarantee to FRA used earlier):
diplomatic_relation = { country = FRA relation = guarantee active = no }
Removing previously used idea:
remove_ideas = { great_depression }
要记住的事情
- The date used must be at least 1 day before the actual bookmark start date, multiple dates can be used
- Ideas are added, Laws are replaced by the latest loaded
- Technologies only have to be applied once, add only extra technologies to the later bookmarks
- If a National Focus triggers an event, or adds effect, completing it by history file does not apply these, they have to be triggered separately
- Country leader is chosen based on corresponding ideology, if multiple are present, the one located lower in the file is chosen
在游戏中增加国家
There are three ways to implement the new country into the game.
- Using events
- By national focus
- Editing state history
通过事件或国策增加国家
- 主条目:Event Modding
There are multiple ways to add a country's presence by event or national focus. Here are two:
set_state_owner = 119
Using this script in an event option or national focus reward, when scoped to the new country, will cause the province to be owned by the new country. If it is occupied by a third power and the new country is at war with them however, the region will remain occupied.
transfer_state = 119
This script will change both the ownership and control to the scoped state. If a third country occupies it it will go to the new country regardless of the state of relations between it and the occupying power.
通过地区历史添加国家
Change the owner and cores in province history files so that they include the new country either by default or in defined bookmarks (for instance only in 1939)
文件 | 效果 • 条件 • 定义 • 修正 • 修正列表 • 作用域 • 本地化 • on action • 数据结构 (标记, 临时标记, 国家别名, 变量, 数组) |
脚本 | 成就修改 • AI修改 • AI focuses • 自治领修改 • 权力平衡修改 • 剧本/标签 (游戏规则)• 建筑修改 • 人物修改 • 修饰性TAG修改 • 国家创建 • 军队修改 • 决议制作 • 装备修改 • 事件修改 • Idea修改 • 意识形态修改 • 军工商修改 • 国策制作 • 资源修改 • Scripted GUI • 科技制作 • 单位修改 |
地图 | 地图 • 省份 • 补给区域 • 战略区域 |
图形图像 | 界面 • 图形资产 • 实体模型 • 后期特效 • 离子效果 • 字体 |
装饰性 | 肖像 • 命名列表 • 音乐 • 音效 |
其他 | 控制台指令 • 故障排除 • 模组结构 • 成就代码分析 • Mod相关 • Nudger修改 |