创建国家:修订间差异

本页面所适用的版本可能已经过时,最后更新于1.8
→‎旗帜:​ 翻译完成
无编辑摘要
第365行: 第365行:
==旗帜==
==旗帜==
{{SVersion|Timeless}}
{{SVersion|Timeless}}
 每个国家需要12个旗帜:四种意识形态,包括中立主义在内,每种一个旗帜,并且每种需要三个尺寸:标准、中(Medium)、小(Small)。所有旗帜需要 以TGA 格式保存,文件名包括国家的tag和旗帜所用于的意识形态。(例如:ABC_neutrality.tga)文件格式应该是32位、无压缩的。
 每个国家需要12个旗帜:四种意识形态,包括中立主义在内,每种一个旗帜,并且每种需要三个尺寸:标准、中(Medium)、小(Small)。所有旗帜需要 以[[wikipedia:Truevision TGA|TGA 格式]] 保存,文件名包括国家的tag和旗帜所用于的意识形态。(例如:ABC_neutrality.tga)文件格式应该是32位、无压缩的。


 然而,如果你不想为每个意识形态制作单独的旗帜,也可以创建一个各种尺寸的单独旗帜,并且将其单纯以国家tag命名而不包括意识形态。例如:ABC.tga将会在该国家没有此时意识形态特定的旗帜时,作为该国家的旗帜使用。
 然而,如果你不想为每个意识形态制作单独的旗帜,也可以创建一个各种尺寸的单独旗帜,并且将其单纯以国家tag命名而不包括意识形态。例如:ABC.tga将会在该国家没有此时意识形态特定的旗帜时,作为该国家的旗帜使用。

2021年1月19日 (二) 21:11的版本

这个页面假设你掌握了创建一个模组的基本知识。该页面主要聚焦于帮助模组作者更好地理解如何在某些特定方面编辑一个国家。

快速检查单

如果你想在模组中创建一个新国家,可以参考以下快速检查单:

  • 定义一个独特的三字符国家tag。
  • <yourmod>/common/countries中新建文件。
  • <yourmod>/history/countries中新建文件。
  • <yourmod>/localisations中增加本地化。
  • <yourmod>/gfx/flags中为每一种意识形态添加一个大,中,小号的旗帜。
  • 可选:在<yourmod>/history/units中创建OOB文件。
  • 可选:把国家加入到游戏中。

国家tag

Countries need a 3-character country tag. This is how a country is referred to in all of the game's script. All country tags must be unique. A country must not share a tag with any other country.

To create a tag, add a new file to <yourmod>/common/country_tags (or edit an existing file) and add something like the following:

SCO = "countries/Scotland.txt"

where

countries/Scotland.txt

is address of the country file that will be created/edited, located in <yourmod>/common/countries

国家文件

Create a new file in the <yourmod>/common/countries folder. It is recommended one copies the file of a very similar country, then rename and edit it.

文化

Defines the set of graphics used for units. For Scotland this would be:

graphical_culture = commonwealth_gfx
graphical_culture_2d = commonwealth_2d

颜色

This is the country's colour on the political map mode. It uses the RGB color scale.

color = { 2  10  222 }

colors.txt

Also, make sure that you add the country's color to <yourmod>/common/countries/colors.txt:

SCO = {
  color = rgb { 2  10  222 }
  color_ui = rgb { 255 255 155}
}

`color_ui` usually is a more intense version of the normal color. It is used to render the borders of the country (If borders look ugly, make sure you have done this right). Colors may also be specified in HSV format.

国家历史

Create a file in the <yourmod>/history/countries folder. Alternatively, copy, rename, and edit a similar file. The file name should be <country tag - country name>, e.g. "SCO - Scotland". This file contains information about the history and various other default attributes of the country.

首都

Defines the capital city. Use the State ID of the state that contains the capital, not the province ID. In this case, 121 is Lothrian State, which contains Edinburgh.

capital = 121

战斗顺序

This line will link to the 'Order of Battle' (OoB) file which will define the amount and location of units, their experience and equipment level, and also Air Wings the country has at the start. Starting production and unit templates are also defined there. All countries need an OoB link, but if the country is to be released one doesn't need to add one later on.

oob = "SCO_1936"

For ease of use, naval units are normally put into separate OOB. Also, due to significant changes made to naval units in the 'Man the Guns' DLC, countries normally use 2 separate naval OOBs, one for owners of the mentioned DLC, and one for those who don't own it, and have to use the old ship system (OOB usually distinquished by a _legacy suffix)

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下,并且将各尺寸的旗帜放置于相应的子文件夹下。

战斗顺序(可选)

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)