钢铁雄心 IV 中文离线资料库

Ideology模组制作

原页面:Ideology modding

本页中文翻译进度 93%,未译部分暂保留英文原文。

意识形态代表所选国家中所有不同的政治信仰或立场。意识形态会有助于决定该国将采取的选择与路线。

意识形态位于/Hearts of Iron IV/common/ideologies/*.txt中。

意识形态

意识形态定义遵循以下格式:

ideologies = {
	
	anarchist = {
	
		types = {
			anarcho_syndicalism = { # Used when assigning ideologies to leaders. Eg. democratic has conservatism, liberalism, and socialism. One value can be defined (yes/no).
				can_be_randomly_selected = no # If no, the subideology will not be randomly selected when creating a new random leader.
				color = { 169 42 42 } # Optional - if not specified, the subideology has the color of its ideology.
			}
		}
		
		dynamic_faction_names = {
			"FACTION_NAME_ANARCHIST_1" # Faction names used by the ai when an ai with this ideology creates a faction. Can be defined in any localisation file.
		}
		
		color = { 169 42 42 } # RGB ideology colour, used in the political pie chart or next to the chart. Can be overwritten in a subideology.
		
		rules = { # Rules for the ideology.  (yes/no)
                        can_create_collaboration_government = # Can create a collaboration government
			can_declare_war_on_same_ideology = # Declare war on same ideology. Not required
			can_force_government = # Can change ideology in peace deal. Required
			can_send_volunteers = # Can send volunteers. Required
			can_puppet = # Can puppet a nation at peace deal. Required
			can_lower_tension = # Lowers tension at peace deal. Not required
			can_only_justify_war_on_threat_country = # Can only justify on a nation that has generated world tension/threat. Not required
			can_guarantee_other_ideologies = # Can guarantee nations with different ideologies. Not required
		}

                can_host_government_in_exile = no #Can host a government in exile
		
		war_impact_on_world_tension = 0.2 # Goes from -1 to 1. Increases or decreases the world tension created by this nation
		faction_impact_on_world_tension = 0.3 # Goes from -1 to 1. Increases or decreases a faction of this ideologies impact on tension
		
		modifiers = { # More rules for the ideology. Every country [[Modifiers|modifier]] can apply.
			generate_wargoal_tension = # Required world tension to start justifying a war (0 to 1)
			join_faction_tension = # Required world tension to join a faction (0 to 1)
			lend_lease_tension = # Required tension to start a lend-lease (0 to 1)
			send_volunteers_tension = # Required tension to send volunteers (0 to 1)
			guarantee_tension = # Required tension to guarantee a nation (0 to 1)
			take_states_cost_factor = # Changes the cost of states in a peace deal. 0.25 would increase state cost by 25% (-1 to 1)
			annex_cost_factor = # Changes the cost of entirely annexing a nation in a peace deal. 0.5 would increase annexing cost by 50% (-1 to 1)
			justify_war_goal_when_in_major_war_time = # Changes the cost of justifying a war while in a major war. 0.5 would decrease time by 50% (0 to 1)
			drift_defence_factor = # Natural drift defence for the ideology # 0.3 would grant 30% drift defence (-1 to 1)
			puppet_cost_factor = # Changes the cost of puppeting a nation in a peace deal (-1 to 1)
		}

		can_be_boosted = no # Can you boost this ideologies popularity in another country (yes/no)
		can_collaborate = yes # Can create collaboration governments
		
		faction_modifiers = {    # Applies to the entire faction if the faction leader has this ideology. Every country [[Modifiers|modifier]] can apply.
			faction_trade_opinion_factor = 0.50 #plus 50% trade opinion
		}
		ai_<ideology> = yes # Determines what ai this ideology will use (democratic, communism, fascism, neutral)
	}
}

AI 和平

AI 和平决定 AI 在和平协议中的行为。触发器可以在文件中的 enable = {} 内看到,它们一般都依赖意识形态。

这些文件位于/Hearts of Iron IV/common/ai_peace/*.txt,每个意识形态都有自己的文件。除非调整触发器,AI 很可能使用/Hearts of Iron IV/common/ai_peace/1_fascist.txt。建议修改这些文件中的触发器,为该意识形态指派合适的和平 AI,或创建一个新文件。

在你的游戏中获得该意识形态

本地化文件

意识形态的名称、描述与名词在任何/Hearts of Iron IV/localisation/english/*.yml文件中定义,假定为英语。默认情况下,基础游戏使用parties_l_english.yml。一个意识形态有 3 个本地化键:用于其作为形容词的名称并与意识形态名称匹配,用于其作为名词的名称并追加 _noun,以及用于其描述——主要用于国家选择菜单——并追加 _desc。以一个名称为my_ideology的意识形态为例,它们看起来如下:

my_ideology:0 "My ideologic"
my_ideology_noun:0 "My ideology"
my_ideology_desc:0 "Ideological regime" # Must be short: only shows up in the scenario/bookmark selection screen where it should take up one line.

意识形态类型的本地化类似,但只有名词与描述:

my_subideology:0 "My ideology type" # Noun
my_subideology_desc:0 "My ideology type's description" # Shows up when hovering over an ideology icon in-game

在描述条目之前加上该国 tag 会使其成为该国专属,如POL_my_subideology_desc:0 「仅对波兰显示的 my_subideology 描述。」

类似地,每个国家都有意识形态名称:

TAG_my_ideology:0 "Ideological Country"
TAG_my_ideology_ADJ:0 "Ideological" #Adjective
TAG_my_ideology_DEF:0 "the Ideological Country" #Used to say if the country's name must be prefixed with "the". Leave "the" lowercase, if adding one.
TAG_my_subideology:0 "Sub-ideological Country" #Shows up if the country has the specified ideology type. For instance, "TUR_liberalism" will be used if TUR has a leader with the liberalism ideology type.

如果你不定义意识形态而只是把它留为TAG:0 「测试」,那么除非有特定意识形态的名称优先,否则它会应用于该国而无论其意识形态。这个名称也用于合作政府,在本地化中引用为[GetNonIdeologyName],或者具体到外观标签时引用为$NONIDEOLOGY$。

请注意,你还必须为你的意识形态的偏移添加本地化。基础游戏为此使用/Hearts of Iron IV/localisation/english/modifiers_l_english.yml。

my_ideology_drift:0 "Daily Ideology Support"

GFX

另见:国家创建 § 旗帜
Sprite 通用概览
为了加载 GFX,游戏使用 sprite 系统。sprite 是一种代码定义,它把一个名称附加到一个图像文件上,并且可以选择性地添加额外信息,例如动画、帧数、图像的加载方式等等。这意味着 把图像放进 gfx 文件夹并不足以让它生效,一个 sprite 也必须使用该图像文件。

Sprites are defined in any /Hearts of Iron IV/interface/*.gfx file (this is separate from gfx/interface/), opened with a text editor. To create a new .gfx file, a text file can be created and renamed to change the extension (on Windows, the Windows Explorer needs to show the extensions, which it doesn't by default). In particular, sprites are defined within a spriteTypes = { ... } block, as to separate from fonts and map arrows also defined in that folder, while the simplest sprite with the least mandatory properties is a spriteType = { ... }. The simplest sprite definition looks like the following:

spriteTypes = {
    spriteType = {
        name = GFX_first_sprite                         # In some cases, beginning with GFX_ is mandatory for it to work.
        texturefile = gfx/interface/folder/filename.dds # The folder and filename don't matter, as long as they are correct
    }                                                   # Only the forward slash '/' (can be doubled as '//') can be used to separate folders.
    spriteType = {                                      # The image doesn't have to be .dds, as .tga and .png are acceptable.
        name = GFX_second_sprite
        texturefile = gfx/interface/folder2/filename2.dds
        noOfFrames = 2 # Splits the image into 2 halves, which may be switched between dynamically in GUI
    }
}

In this case, this creates a sprite with the name of GFX_first_sprite and attaches the /Hearts of Iron IV/gfx/interface/folder/filename.dds image to it, and a second sprite similarly. The second sprite will be split into 2 frames: this is decided by having the left half of the image as the first frame and the right half as the second frame (more frames would further split the image horizontally). This doesn't make the sprite animated, just turns on the option to switch between the two halves as needed. GFX_second_sprite:1 serves as a reference to the first frame, and GUI can be set up to change the shown frame depending on context, such as with radio stations.
In order to add animation, a frameAnimatedSpriteType is used.

要修改某个 sprite,从来都不是必须复制基础游戏文件。如果在不同文件中对同名 sprite 存在重复定义,游戏将优先使用稍后根据文件名求值的那个,较旧的 sprite 会被完全忽略。可以通过把替换文件名的首字符设为 ASCII 字符表中较靠后的符号来确保这一点。通常为此使用小写字母 'z'。例如,要把GFX_idea_traits_strip中的帧数改为 10,可以在模组的modname/interface/zz_replace.gfx文件中定义一个同名、含 10 帧的 sprite,而不必复制基础游戏文件。由于大多数 .gfx 文件定义了用户界面的组成部分,在游戏大版本更新时复制它们可能导致模组已加载的文件缺少 sprite,这在游戏内会显示为默认图像,即默认的错误狗。为了减轻检查界面文件的负担,最好永远不要复制 .gfx 文件,除非更多新增内容会主动损害模组,例如interface/subuniticons.gfx的情况

意识形态图标在任何/Hearts of Iron IV/interface/*.gfx文件中定义为 sprite,sprite 的名称决定它何时被使用。对于整个意识形态组,sprite 命名模式必须形如name = GFX_ideology_<name>_group。如果该组types = { ... }内的某个意识形态类型应有独特图标,它会被定义为name = GFX_ideology_<name>。

可以通过在意识形态名称前加上国家 tag(以下划线分隔),使某个 sprite 只被特定国家使用,意识形态组写作GFX_ideology_<TAG>_<name>_group,意识形态类型写作GFX_ideology_<TAG>_<name>。

定义意识形态 sprite 的示例界面文件:

spriteTypes = {
    spriteType = {
        name = GFX_ideology_monarchism_group # Will be used for the "monarchism" group.
        texturefile = gfx/interface/ideologies/monarchism_group.dds
    }
    spriteType = {
        name = GFX_ideology_BHR_monarchism_group # Will be used for the "monarchism" group for the country BHR
        texturefile = gfx/interface/ideologies/BHR_monarchism_group.dds
    }
    spriteType = {
        name = GFX_ideology_absolutism # Will be used for the "absolutism" type, possibly within the "monarchism" group.
        texturefile = gfx/interface/ideologies/absolutism.dds
    }
    spriteType = {
        name = GFX_ideology_BHR_absolutism # Will be used for the "absolutism" type for the country BHR
        texturefile = gfx/interface/ideologies/BHR_absolutism.dds
    }
}

国家历史

如果你希望该意识形态出现在某个国家中,你就必须这样把它加入该国的历史文件:例如在法国,/Hearts of Iron IV/history/countries/FRA - France.txt

set_politics = {
	ruling_party = democratic
	last_election = "1932.5.1"
	election_frequency = 48
	elections_allowed = yes
}
set_popularities = { #This MUST add up to 100 otherwise the ideologies break
	democratic = 69
	fascism = 1
	communism = 30
}

法国现在将需要一位新领袖

create_country_leader = {
	name = "Édouard Daladier"
	desc = "POLITICS_ÉDOUARD_DALADIER_DESC"
	picture = "Portrait_France_Edouard_Daladier.dds"
	expire = "1965.1.1"
	ideology = socialism
	traits = {
		stout_defender
	}
}

政治顾问

为了添加一位提高该意识形态支持度的政治顾问,首先必须在/Hearts of Iron IV/common/country_leader/*.txt中添加一个将赋予该顾问的特质

<ideology>_booster = {
	random = no
	sprite = 13
	<ideology>_drift = 0.1
	
	ai_will_do = {
		factor = 0
	}
}

本地化可以这样添加:

<ideology>_booster:0 "Ideology booster" #Whatever you want to call the person that supports the ideology. Eg. Democratic Politician, Communist Politician, Fascist Politician

建议把通用顾问加入/Hearts of Iron IV/common/ideas/zzz_generic.txt,以确保该文件在国家专属顾问之后加载。通用顾问可以按以下示例添加:

 <name> = {
			
	allowed = {
		NOT = {
			has_available_idea_with_traits = { idea = <ideology>_booster limit = 1 }		#In order to prevent it from appearing alongside country-specific ones.
		}
	}	
	traits = { <ideology>_booster }
			
	available = {
		if = {
			limit = { has_dlc = "Man the Guns" }	
			NOT = { has_autonomy_state = autonomy_supervised_state }
		}
	}
	
	do_effect = {
		NOT = {
			has_government = <ideology> # You can only select it if your current ideology isn't your new one
		}
	}

	ai_will_do = {
		factor = 0
	}
}

关于 GFX 与本地化的更多信息可在Idea模组制作页面找到。

模组制作
文档 效果 • 触发器 • 定义文件 • 修正项 • 修正项列表 • 作用域 • 本地化文件 • 事件钩子 • 数据结构(标记、事件目标、国家标签别名、变量、数组)
脚本 成就 • AI • AI 焦点 • 自治领 • 力量均势 • 书签/剧本 (游戏规则) • 建筑 • 角色与特质 • 外观标签 • 国家 • 师 • 决议 • 学说 • 装备 • 事件 • 阵营 • 理念 • 意识形态 • 军事工业组织 • 国策 • 资源 • 脚本化 GUI • 科技与学说 • 单位
地图 地图 • 州 • 补给区域 • 战略区域
图形 界面 • 图形资源 • 实体 • 后期特效 • 粒子 • 字体
外观 肖像 • 名称列表 • 音乐 • 音效
其他 控制台指令 • 疑难排查 • 模组结构 • 模组 • 地图编辑器