Ideology modding:修订间差异

本页面所适用的版本可能已经过时,最后更新于1.10
(文本替换 - 替换“[[Category:”为“[[分类:”)
无编辑摘要
 
第1行: 第1行:
{{DISPLAYTITLE:意识形态}}
{{DISPLAYTITLE:意识形态}}
{{Version|1.10}}
{{需要翻译|译者=霜泽图书馆}}


{{Version|1.8}}
[[Ideologies]] represent all of the different political beliefs or alignments in the selected nation. An ideology will help to determine the choices and paths that the nation will take.


[[意识形态]] 代表所选国家的所有不同政治信仰或联盟。意识形态将有助于决定国家将采取的选择和道路。
Ideologies are found in {{path|common/ideologies/*.txt}}.


意识形态文件在 {{path|common/ideologies/*.txt}}.
== Ideologies ==


== 意识形态 ==
An ideology definition follows this format:
 
意识形态遵循以下格式:
<pre>
<pre>
ideologies = {
ideologies = {
第16行: 第16行:
types = {
types = {
anarcho_syndicalism = { # 将意识形态分配给领导者时使用。例如,民主党有保守主义、自由主义和社会主义。 可以定义一个值(yes/no)
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,则在创建新的随机领导人时不会随机选择子意识形态
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 = {
dynamic_faction_names = {
"FACTION_NAME_ANARCHIST_1" # 当一个具有这种意识形态的ai创建一个阵营时,ai使用的阵营名称
"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颜色。 这个颜色会出现在政党饼图或饼图附近。
color = { 169 42 42 } # RGB ideology colour, used in the political pie chart or next to the chart if subideology of country leader dont have its own color.
rules = { #  该意识形态的规则,值为(yes/no)
rules = { # Rules for the ideology. (yes/no)
              can_create_collaboration_government = # 创建合作政府
              can_create_collaboration_government = # Can create a collaboration government
can_declare_war_on_same_ideology = # 对相同意识形态发起战争;非必要
can_declare_war_on_same_ideology = # Declare war on same ideology. Not required
can_force_government = # 可以在和平协议中改变意识形态;必要
can_force_government = # Can change ideology in peace deal. Required
can_send_volunteers = # 派遣志愿军;必要
can_send_volunteers = # Can send volunteers. Required
can_puppet = # 可以在和平协议中傀儡一个国家;必要
can_puppet = # Can puppet a nation at peace deal. Required
can_lower_tension = # 在和平协议中降低世界紧张度;非必要
can_lower_tension = # Lowers tension at peace deal. Not required
can_only_justify_war_on_threat_country = # 只能对一个国家正当化战争;非必要
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_other_ideologies = # Can guarantee nations with different ideologies. Not required
}
}


          can_host_government_in_exile = no # 接待流亡政府
          can_host_government_in_exile = no #Can host a government in exile
war_impact_on_world_tension = # 值范围-1 到1 增加或减少这个国家制造的世界紧张度
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 = # 值范围-1 到1 增加或减少一个该意识形态阵营对世界紧张度的影响
faction_impact_on_world_tension = 0.3 # Goes from -1 to 1. Increases or decreases a faction of this ideologies impact on tension
modifiers = { # 更多意识形态规则
modifiers = { # More rules for the ideology. Every country [[Modifiers|modifier]] can apply.
generate_wargoal_tension = # 正当化战争需要的世界紧张度 (0 to 1)
generate_wargoal_tension = # Required world tension to start justifying a war (0 to 1)
join_faction_tension = # 加入一个阵营需要的世界紧张度 (0 to 1)
join_faction_tension = # Required world tension to join a faction (0 to 1)
lend_lease_tension = # 租借法案需要的世界紧张度 (0 to 1)
lend_lease_tension = # Required tension to start a lend-lease (0 to 1)
send_volunteers_tension = # 派遣志愿军需要的世界紧张度 (0 to 1)
send_volunteers_tension = # Required tension to send volunteers (0 to 1)
guarantee_tension = # 保障国家独立所需要的世界紧张度 (0 to 1)
guarantee_tension = # Required tension to guarantee a nation (0 to 1)
take_states_cost_factor = # 更改和平协议中获取地区的战争点数花费. 0.25 将使使用成本提高25% (-1 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 = # 更改和平协议中完全吞并一个国家的战争点数花费. 0.5 将使使用成本提高50% (-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 
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)
            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)
drift_defence_factor = # 意识形态的抵御力度 # 0.3 将会增加30% 的意识形态抵御力度(-1 to 1)
puppet_cost_factor = # Changes the cost of puppeting a nation in a peace deal (-1 to 1)
puppet_cost_factor = # 更改在和平协议中傀儡一个国家的战争点数花费 (-1 to 1)
}
}


can_be_boosted = # Can you boost this ideologies popularity in another country (yes/no)
can_be_boosted = no # Can you boost this ideologies popularity in another country (yes/no)
can_collaborate = #
can_collaborate = yes # Can create collaboration governments
faction_modifiers = {
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
faction_trade_opinion_factor = 0.50 #plus 50% trade opinion
}
}
ai_<ideology> = yes # Determines what ai this ideology will use (democratic, communism, fascism, neutral or make a new one.)
ai_<ideology> = yes # Determines what ai this ideology will use (democratic, communism, fascism, neutral)
}
}
}
}
</pre>
</pre>
==Ai peace==


==Ai 和平协议==
AI peace determines the AI's behaviour in a peace deal. The triggers can be seen inside of enable = {} in the files, and they are generally reliant on ideologies.


ai_peace 影响ai政体将决定他们的战争行为。这部分内容将影响ai在一定条件下选择占领地区、吞并或傀儡,以及希望从和平协议中得到什么益处。
The files are located in {{path|common/ai_peace/*.txt}} and every ideology has its own file. Unless the triggers are adjusted, AI will be likely to use {{path|common/ai_peace/1_fascist.txt}}. It is recommended to change the triggers in these files to assign a proper peace AI to the ideology or to create a new file.


以上效果这些被ai政体的意识形态所影响。
==Getting the ideology in your game==
===Localisation ===


和平协议效果位于 {{path|common/ai_peace/*.txt}} 每个意识形态都有着自己单独的文件。如果你没有创建一个单独的文件,ai只会使用 {{path|common/ai_peace/z_default.txt}}
The names, descriptions and nouns for ideologies are defined in any {{path|localisation/english/*.yml}} file, assuming the English language. By default, the base game uses <code>parties_l_english.yml</code><br />
An ideology has 3 localisation keys: for its name as an adjective matching the ideology's name, for its name as a noun where _noun is appended, and for its description, used primarily in the country selection menu, where _desc is appended. Taking an ideology with the name of <code>my_ideology</code> as an example, these will look like the following:
<pre>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.</pre>
Ideology types are localised similarly, but with just the noun and description:
<pre>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</pre>
Prefacing a description entry with the country's tag will make it country-specific, as <code>POL_my_subideology_desc:0 "Description for my_subideology that shows up only for Poland."</code>


==在游戏中完善你的意识形态==
Similarly, each country has ideological names:
===本地化===
<pre>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.</pre>
If you do not define the ideology and just leave it as <code>TAG:0 "Test"</code>, it will apply to the country regardless of the ideology unless an ideology-specific name takes priority. This name is also used for the collaboration governments, referenced in localisation as <code>[GetNonIdeologyName]</code> or, specifically for cosmetic tags, as <code>$NONIDEOLOGY$</code>.


The localisation for the ideologies is located in {{path|localisation/parties_l_<language>.txt}}. This file also houses the names given to the political parties in each nation.
Note that you will also have to add localisation for your ideology's drift. The base game uses {{path|localisation/english/modifiers_l_english.yml}} for this.<syntaxhighlight>
 
my_ideology_drift:0 "Daily Ideology Support"
Somewhere in your copy of the file add
</syntaxhighlight>
<pre>
<ideology>:0 "<The name you want to be displayed>"
<ideology>_noun:0 "<The ideology's noun>"
<ideology>_desc:0 "<How you would refer to a nation with that ideology>" # Ie. Democratic Regime, Fascist Dictatorship, Anarcho-Capitalist Regime
</pre>
 
You also have to add localisation for the ideology to every country which can be a bit time consuming
 
<pre>
AFG_anarchist:0 "Anarchist Republic of Afghanistan"
AFG_anarchist_ADJ:0 "Anarcho-Afghan"
AFG_anarchist_DEF:0 "The People's Anarchist Republic of Afghanistan"
</pre>


===GFX===
===GFX===
{{See also|Country creation|Flag|section=yes}}
{{Sprite overview|collapsed=yes}}
Ideology icons are defined as sprites in any {{path|interface/*.gfx}} file, with the name of the sprite determining when it will be used.<br />
For entire ideology groups, the sprite naming pattern must be of the sort <code>name = GFX_ideology_<name>_group</code>. If some ideology type within <code>types = { ... }</code> of the group should have a unique icon, it will be defined as <code>name = GFX_ideology_<name></code>.


Every nation will either need a flag for this ideology, or a generic national flag.
It is possible to make a sprite get used only for a certain country by prepending the country tag before the ideology's name (separated with underscores), as <code>GFX_ideology_<TAG>_<name>_group</code> for ideology groups and <code>GFX_ideology_<TAG>_<name></code> for ideology types.


To assign an ideology to a flag just name it <TAG>_<ideology>.tga or create a flag for the nation to use that doesn't have a specific ideology by just naming the flag <TAG>.tga. Doing it the last way makes it easier to add flags when you have added a lot of similar ideologies.
Example interface file defining ideology sprites:
<pre>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
   }
}</pre>


===Country history===
===Country history===
第136行: 第159行:
===Political advisor===
===Political advisor===


If you want to make it possible for you to boost the ideology through advisor you have to add this into {{path|common/country_leader/00_traits.txt}} 
In order to add a political advisor increasing the popularity of the ideology, first, a trait that will be added to that advisor must be added in {{path|common/country_leader/*.txt}} 


<pre>
<pre>
第149行: 第172行:
}
}
</pre>
</pre>
 
Localisation can be added like so:
Also to add localisation to this advisor go to {{path|localisation/ideas_l_<language>.txt}} and add something similar to:
 
<pre>
<pre>
generic_<ideology>_booster:0 "" #Whatever you want to call the person that supports the ideology. Eg. Democratic Politician, Communist Politician, Fascist Politician
<ideology>_booster:0 "Ideology booster" #Whatever you want to call the person that supports the ideology. Eg. Democratic Politician, Communist Politician, Fascist Politician
</pre>
</pre>


If you want a country to have an advisor of this ideology you have to go to the nation's idea files in {{path|common/ideas/<nation>.txt}} and add:
It is recommended to add the generic advisors in {{path|common/ideas/zzz_generic.txt}} to ensure the file is loaded after the country-specific ones. A generic advisor can be added following this example:
 
<pre>
<pre>
  <name> = {
  <name> = {
allowed = {
allowed = {
original_tag = "<TAG>"
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 }
traits = { <ideology>_booster }
on_add = {
available = {
country_event = # Add an event here if you want one
if = {
limit = { has_dlc = "Man the Guns" }
NOT = { has_autonomy_state = autonomy_supervised_state }
}
}
}
第180行: 第205行:
}
}
}
}
</pre>
</pre>More information about GFX and localisation can be found in the [[Idea modding]] page.


{{Modding navbox}}
{{Modding navbox}}
[[Category:Modding]]
[[分类:Modding]]
[[分类:Modding]]
{{DEFAULTSORT:意识形态}}
{{DEFAULTSORT:意识形态}}

2024年8月29日 (四) 16:22的最新版本


Ideologies represent all of the different political beliefs or alignments in the selected nation. An ideology will help to determine the choices and paths that the nation will take.

Ideologies are found in /Hearts of Iron IV/common/ideologies/*.txt.

Ideologies

An ideology definition follows this format:

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 if subideology of country leader dont have its own color. 
		
		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 peace

AI peace determines the AI's behaviour in a peace deal. The triggers can be seen inside of enable = {} in the files, and they are generally reliant on ideologies.

The files are located in /Hearts of Iron IV/common/ai_peace/*.txt and every ideology has its own file. Unless the triggers are adjusted, AI will be likely to use /Hearts of Iron IV/common/ai_peace/1_fascist.txt. It is recommended to change the triggers in these files to assign a proper peace AI to the ideology or to create a new file.

Getting the ideology in your game

Localisation

The names, descriptions and nouns for ideologies are defined in any /Hearts of Iron IV/localisation/english/*.yml file, assuming the English language. By default, the base game uses parties_l_english.yml
An ideology has 3 localisation keys: for its name as an adjective matching the ideology's name, for its name as a noun where _noun is appended, and for its description, used primarily in the country selection menu, where _desc is appended. Taking an ideology with the name of my_ideology as an example, these will look like the following:

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.

Ideology types are localised similarly, but with just the noun and description:

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

Prefacing a description entry with the country's tag will make it country-specific, as POL_my_subideology_desc:0 "Description for my_subideology that shows up only for Poland."

Similarly, each country has ideological names:

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.

If you do not define the ideology and just leave it as TAG:0 "Test", it will apply to the country regardless of the ideology unless an ideology-specific name takes priority. This name is also used for the collaboration governments, referenced in localisation as [GetNonIdeologyName] or, specifically for cosmetic tags, as $NONIDEOLOGY$.

Note that you will also have to add localisation for your ideology's drift. The base game uses /Hearts of Iron IV/localisation/english/modifiers_l_english.yml for this.

my_ideology_drift:0 "Daily Ideology Support"

GFX

Ideology icons are defined as sprites in any /Hearts of Iron IV/interface/*.gfx file, with the name of the sprite determining when it will be used.
For entire ideology groups, the sprite naming pattern must be of the sort name = GFX_ideology_<name>_group. If some ideology type within types = { ... } of the group should have a unique icon, it will be defined as name = GFX_ideology_<name>.

It is possible to make a sprite get used only for a certain country by prepending the country tag before the ideology's name (separated with underscores), as GFX_ideology_<TAG>_<name>_group for ideology groups and GFX_ideology_<TAG>_<name> for ideology types.

Example interface file defining ideology sprites:

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
    }
}

Country history

If you want the ideology to appear in a country you will have to add it like this to a countries history file like this: In France, for example /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
}

France will now need a new leader

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
	}
}

Political advisor

In order to add a political advisor increasing the popularity of the ideology, first, a trait that will be added to that advisor must be added in /Hearts of Iron IV/common/country_leader/*.txt

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

Localisation can be added like so:

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

It is recommended to add the generic advisors in /Hearts of Iron IV/common/ideas/zzz_generic.txt to ensure the file is loaded after the country-specific ones. A generic advisor can be added following this example:

 <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
	}
}

More information about GFX and localisation can be found in the Idea modding page.