Diplomacy modding

From Stellaris Wiki
Jump to navigation Jump to search

Version

Outliner top.png
Please help with verifying or updating older sections of this article. At least some were last verified for version 2.6.

This article is for the PC version of Stellaris only.

This page is about the moddings of Diplomacy, Subjects, Federations, and galactic community.

Diplomacy Actions[edit]

Diplomacy Actions are defined at "common/diplomatic_actions/xxx.txt".

There is few we can do with diplomacy actions. New diplomacy actions can't be added, only existing ones can be limitly modified.

Data Structure[edit]

  • icon - A reference to a GFX instance that indicates the icon of this diplomatic status to be shown in the diplomacy GUI.
  • requires_actor_peace - (yes/no) If yes, empires at war can't perform this action.
  • requires_recipient_peace - (yes/no) If yes, empires at war can't be targeted by this action.
  • requires_actor_independence - (yes/no) If yes, this action can't be performed by subject empires.
  • requires_recipient_independence - (yes/no) If yes, subject empires can't be targeted by this action.
  • requires_actor_federation_leader - (yes/no) If yes, empires in federations that aren't federation leaders can't perform this action.
  • requires_recipient_federation_leader - (yes/no) If yes, empires in federations that aren't federation leaders can't be targeted by this action.
  • should_notify_all_communications - (yes/no) If yes, all empires that share communication with at least one empire revelant to this diplomatic action will receive a notification about this action once it's accepted.
  • potential - A block of Conditions that hides this action from diplomacy view if unmet.
  • possible - A block of Conditions that blocks this action from being sent if unmet.
  • proposable - Same above. It's unclear what's the difference between the two.

Other fields have little mean to be modified since they are heavily hard-coded.

Diplomacy Economy[edit]

An abstract game object defined at "common/diplomacy_economy/xxx.txt". Diplomacy related resource upkeeps and productions are implemented through diplomacy economy.

Data Structure[edit]

An instance can be assigned to the "once" group or the "per_relation" group. The former will apply to each empire up to once and the later can apply to the same empire more than once.

  • trigger - A block of Conditions that determines should this diplomacy economy apply. Scope is empire A. If this object was assigned to the "per_relation" group, then FROM is empire B.
  • resources - An Economy Unit that applies to empire A. If this object was assigned to the "per_relation" group, instead it applies to empire A once for each valid empire B.

Diplomacy Economy Example[edit]

once = {
	# this is applied only once per country
	federation = {
		trigger = {
			has_federation = yes
		}
		resources = {
			category = federation
			upkeep = {
				influence = 1
			}
		}
	}
}
per_relation = {
	# this is applied for each such relation with another country
	# scope: this = current country, FROM : other country in the relation
	rivalry = {
		trigger = {
			has_rival = FROM
		}
		resources = {
			category = rivalries
			produces = {
				influence = 0.5
			}
		}
	}

	non_aggression_pact = {
		trigger = {
			has_non_aggression_pact = FROM
		}
		resources = {
			category = non_aggression_pacts
			upkeep = {
				influence = 0.25
			}
		} 
	}

	...
}

Subjects[edit]

Subject types are defined at "common/subjects/xxx.txt".

More can be added but those must be set through events, since relevant diplomatic actions can't be added.

Data Structure[edit]

  • calls_overlord_to_war - (yes/no) If the overlord joins a war launched against their subject. Has no bearing on wars started by the subject.
  • can_be_integrated - (yes/no) If yes, this kind of subject can be integrated into the overlord.
  • can_do_diplomacy - (yes/no) If no, this kind of subject can only undertake limited diplomacy. This typically prevents the formation of defense packs or declaring war. See Diplomacy Actions for more.
  • can_expand - (yes/no) If no, this kind of subject cannot build new starbases unless otherwise specified by the game rule subject_can_expand.
  • gets_access - (yes/no) Default yes. If yes, this subject may travel within their overlord's borders.
  • gets_sensor - (yes/no) Default yes. If yes, this subject shares their overlord's sensor.
  • joins_overlord_wars - (yes/no) If this kind of subject joins their overlord's wars (defensive or offensive).
  • overlord_becomes_warleader - (yes/no) Default yes. If yes, the overlord will become the war leader (primary attacker/defender) if this subject is.
  • overlord_resources - The amount of Economy Units to be produced by the overlord each month. Used for Protectorates to give the overlord Influence.
  • research_agreement - (yes/no) If yes, the overlord and subject automatically enter into a research agreement. This cannot be broken unless the subject is released.
  • research_sharing - (yes/no) If yes, both the overlord and subject apply a modifier to research speed when the other party already has the technology being researched. The modifier amount is set by country_subject_technology_sharing_mult. Unused in vanilla.
  • subject_resources - The amount of Economy Units to be produced by the subject each month. Unused in vanilla.
  • subject_tax_rate - The percentage of Economy Units to be taken from the subject and given to the overlord each month. Used for Subsidiaries and Tributaries.
  • tech_cost_mult - A percentage modifier applied to the total research cost of technologies for the subject when the overlord already has the technology. Used for Protectorates.

These remaining fields are only worth considering when modifying the vanilla subjects as they interact with hard coded diplomacy actions; they will not be called for new subject types.

  • become_vassal - A block of Conditions to determine whether this subject be converted into a Vassal. Used for Protectorates.
  • can_switch_to - A list of subject types this subject can be called to switch to through diplomatic actions. Used for Tributaries.
  • diplo_threat - A number that modifies the threat added to this empire after diplomatically asking another empire to become a subject of this type.
  • effect - A block of Effects to be executed when this subject type is set to an empire. Vanilla subject types use this to prevent some empires owning incorrect types of subjects, like Awakened Fallen Empires should own a Vessal.
  • potential - A block of Conditions to determine whether the relevant Diplomatic Actions of this kind of subject appear.

Federations[edit]

Full Federation modding consist of Federation Types, Federation Perks, Federation Law Categories, and Federation Laws.

A Federation Type have level entries that refer to Federation Perks, while Federation Law Categories and Federation Laws work like policies and policy options.

Federation Types[edit]

Federation Types are defined at "common/federation_types/xxx.txt".

Data Structure[edit]

  • icon - A reference to a GFX instance that indicates the icon of this federation type.
  • potential - A block of Conditions that checks if this federation type is visible in federation type selection menu. (Country scope)
  • allow - A block of Conditions that checks if this federation type can be selected. (Country scope)
  • levels - A list of level entries. The order in this list is the order of the levels to be activated.
    • The key of each level entry is just flavor text. Technically it can be anything. Using just the level_1-5 is recommended since the federation UI is designed for federations of just 5 levels. The first level is always active for the federation for no experience requirement.
    • experience - Experience required from this level to the next level.
      • If set to "100 200 300 400", the 5th level actually requires 100+200+300+400 experience to be achived.
    • perks - A list of Federation Perks to be activated upon activation of this level as well as to be deactivated upon deactivation of this level.
  • on_create - A block of Effects to be executed when this federation is created.
  • ai_weight - The higher the weight, the more likely the AI will be happy to form or join a federation of this type, as well as to swich an existing federation into this type.

Federation Type Example[edit]

This is the default federation type.

default_federation = {
	icon = "GFX_default_federation"
	potential = {
		always = yes
	}
	allow = {
		custom_tooltip = {
			fail_text = requires_actor_not_barbaric_despoilers
			NOT = { has_valid_civic = civic_barbaric_despoilers }
		}
	}
	levels = {
		level_1 = { # Starting rank
			experience = @xp_to_level_2 # Experience until next rank
			perks = {
				default_federation_passive
			}
		}
		...
	}
	on_create = {
		remove_federation_flag = enable_federation_cooldowns
		set_federation_law = centralization_minimal
		set_federation_law = succession_type_rotation
		...
	}
	
	ai_weight = {
		base = 0
		modifier = {
			desc = federation_acceptance_honorbound_warriors
			add = -10
			from = {
				has_ai_personality = honorbound_warriors
			}
		}
		...
	}
}

Unlike the ai_weight block of most other game objects, each modifier block of federation types do have a desc localisation key used to display AI acceptance to this federation type.

Federation Perks[edit]

Federation Perks are defined at "common/federation_perks/xxx.txt".

Unlike other "perks", the federation perks can't be freely picked. They are bound to the federation level entries.

Data Structure[edit]

  • federation_modifier - A block of Modifiers applies to the Federation scope.
  • members_modifier - A block of Modifiers applies to all members of the federation, including the president.
  • leader_modifier - A block of Modifiers applies to only the federation president.
  • on_activate - A block of Effects executed to the Federation scope when this perk is activated because of level up.
  • on_deactivate - A block of Effects executed to the Federation scope when this perk is deactivated because of level down. Used to cancel the effects of on_activate.

Federation Perk Example[edit]

This is the passive effect of the research federation. It's activated through level-1 entry.

research_federation_passive = {
	federation_modifier = {
		description = research_federation_passive_effect
		federation_research_sharing_mult = 0.25
	}
	on_activate = {
		set_federation_settings = {
			research_sharing = yes
		}
	}
	on_deactivate = {
		set_federation_settings = {
			research_sharing = no
		}
	}
}

Federation Law Categories[edit]

Federation Law Categories are defined at "common/federation_law_categories/xxx.txt".

Data Structure[edit]

  • potential - A block of Conditions to determine should this federation law category be displayed in the GUI.
  • laws - A list of keys of Federation Laws.
  • centralization - (yes/no) The Centralization law category use this.

Federation Law Category Example[edit]

This is the Succession Power federation law category.

law_category_succession_power = {
	potential = {
		OR = {
			has_federation_law = succession_type_strongest
			has_federation_law = succession_type_strongest_hegemony
		}
	}
	laws = {
		succession_power_economy
		succession_power_diplomatic_weight
		succession_power_tech
		succession_power_fleet
	}
}

Federation Laws[edit]

Federation Laws are defined at "common/federation_laws/xxx.txt".

Data Structure[edit]

  • potential - A block of Conditions to determine should this federation law option be displayed.
  • allow - A block of Conditions to determine can this federation law be voted to activate.
  • modifier - A block of Modifiers applies to the Federation scope.
  • on_enact - A block of Effects executed to the Federation scope when the federation law is changed to this.
  • ai_weight - Determines AI acceptance to this federation law option.

Federation Law Example[edit]

This is the Federation Law "Succession Power: Diplomatic Weight".

succession_power_diplomatic_weight = {
	potential = {
		OR = {
			has_federation_law = succession_type_strongest
			has_federation_law = succession_type_strongest_hegemony
		}
	}
	allow = { 
		custom_tooltip = {
			NOT = {
				AND = {
					NOT = { has_federation_law = succession_power_diplomatic_weight }
					has_modifier = federation_law_category_succession_power_cooldown
					has_any_federation_law_in_category = law_category_succession_power
				}
			}
		}
	}
	on_enact = {
		set_federation_succession_type = diplomatic_weight
		if = {
			limit = { has_federation_flag = enable_federation_cooldowns }
			add_modifier = {
				modifier = federation_law_category_succession_power_cooldown
				days = @cooldown
			}
		}
		add_cohesion = -5
	}

	ai_weight = {
		base = 26
		
		#Behaviour-specific
		modifier = {
			add = 25
			federation = { 
				has_federation_type = trade_federation
				NOT = { federation = { has_federation_law = succession_power_economy } }
			}
		}
		...
	}
}

Relevant Dynamic Modding Statements[edit]

Country Conditions

  • is_federation_leader = yes/no - Checks if this empire is federation leader.
  • num_envoys_to_federation <=> int - Checks the number of envoys this empire assigned to the federation.
  • is_in_federation_with = <country scope> - Checks if this empire and the target empire are in the same federation.

Country Effects

  • set_federation_leader = yes - Makes this empire the federation leader.

Federation Conditions

  • federation_experience <=> int - Checks the federation experience.
  • federation_cohesion <=> int - Checks the federation cohesion.
  • federation_cohesion_growth <=> int - Checks the federation cohesion monthly growth.
  • federation_level <=> int - Checks the federation level.
  • has_any_federation_law_in_category = <federation law category key> - Checks if there is an active federation law under a specific category.
  • has_federation_law = <federation law key> - Checks if this federation has a specific law.
  • has_federation_perk = <federation perk key> - Checks if this federation has a specific perk.
  • has_federation_type = <federation type key> - Checks the federation type.
  • has_federation_setting = <federation setting key> - Checks the federation setting.

Federation Effects

  • add_federation_experience = int - Changes the federation experience.
  • add_cohesion = int - Changes the federation cohesion.
  • set_federation_law = <federation law key> - Makes the federation law to activate.
  • set_federation_type = <federation type key> - Changes the federation type.
  • set_federation_succession_type = strongest/diplomatic_weight/rotation/challenge/random - Using this effect outside the federation laws is discouraged.
  • set_federation_succession_term = status_change/years_10/years_20/years_30/years_40 - Using this effect outside the federation laws is discouraged.
  • set_only_leader_builds_fleets = yes/no - Using this effect outside the federation laws is discouraged.
  • set_allow_subjects_to_join = yes/no - Using this effect outside the federation laws is discouraged.
  • set_equal_voting_power = yes/no - Using this effect outside the federation laws is discouraged.
  • set_free_migration = yes/no - Using this effect outside the federation laws is discouraged.
  • set_diplomacy_action_setting - Using this effect outside the federation laws is discouraged.
set_diplomacy_action_setting = {
	action = <diplomatic action key that requires federation vote>
	settings = {
		vote_type = unanimous_vote/majority_vote/leader
	}
}
  • set_federation_settings - Using this effect outside the federation laws is discouraged.
set_federation_settings = {
	research_sharing = yes/no
	failed_vote_half_price = yes/no
}

Galactic community[edit]

Full galactic community modding consist of Resolution Categories and Resolutions. They work like policies and policy options.

Resolution categories[edit]

Federation law categories are defined at "common/resolution_categories/xxx.txt".

Data structure[edit]

  • group - A localisation key. Multiple Resolution Categories of the same group will be grouped together in the galactic community view.
  • icon - A reference to a GFX instance that indicates the icon of this Resolution Category.
  • resolution_types - A list of keys of Resolutions.

Resolution Category Example[edit]

These are the ecology and technology resolutions in the "blue group".

resolution_category_ecology = {
	group = environment_technology
	icon = "GFX_resolution_ecolgical_protection"

	resolution_types = {
		"resolution_ecology_repeal_1"
		...
	}
}

resolution_category_galacticstudies = {
	group = environment_technology
	icon = "GFX_resolution_galactic_studies"

	resolution_types = {
		"resolution_galacticstudies_repeal_1"
		...
	}
}

Resolutions[edit]

Resolutions are defined at "common/resolutions/xxx.txt".

Data Structure[edit]

  • icon - A reference to a GFX instance that indicates the icon of this Resolution.
  • target - (yes/no) Determines if this resolution needs an empire for a target.
  • harmful - (yes/no) Determines if the AI should consider this Resolution harmful while choosing the target.
  • modifier - A block of Modifiers. For as long as this Resolution is passed, all members of the galactic community receive these modifiers.
  • triggered_modifier - Similarly, except each block has a potential block.
    • potential - A block of Conditions to determine if this block of triggered_modifier should apply to an empire. (Country scope)
  • effect - A block of Effects to be executed on the proposing empire when this resolution passed. If this resolution needs a target, instead this block is executed on the target empire. (Country scope)
  • fail_effects - Similarly, this block is executed when this resolution is declined.
  • potential - A block of Conditions to determine if this resolution can be displayed to an empire on the resolution proposal view. (Country scope)
  • allow - A block of Conditions to determine if this resolution can be proposed by an empire. (Country scope)
  • ai_weight - Determines AI acceptance of this resolution.
  • valid_target - A block of Conditions to determine if an empire is a valid target of this resolution. targeted = yes only.

Resolution Example[edit]

The following examples are the first level of Economy Sanction and the Council Denouncement.

resolution_sanctions_economic_1 = {
	icon = "GFX_sanctions_orange"

	resources = {
		category = resolutions
		cost = {
			influence = @resolution_cost_denounce
		}
	}

	target = no

	effect = {
		custom_tooltip = sanctions_effect
	}

	modifier = {
	}

	triggered_modifier = {
		potential = {
			OR = {
				is_in_breach_of_any = yes
				has_modifier = resolution_denounced
			}
		}
		modifier = {
			resolution_sanctions_economic = 1
		}
	}

	allow = {
		custom_tooltip = {
			fail_text = "requires_something_illegal"
			has_global_flag = resolution_with_breach_effect_passed
		}
		custom_tooltip = {
			NOT = {
				is_active_resolution = "resolution_sanctions_economic_2"
				is_active_resolution = "resolution_sanctions_economic_3"
			}
		}
	}

	ai_weight = {
		weight = @resolution_weight_normal

		modifier = {
			factor = 0
			is_in_breach_of_any = yes
		}

		...
	}
}
resolution_council_denouncement = {
	icon = "GFX_resolution_purges"

	potential = {
		has_federations_dlc = yes
	}

	resources = {
		category = resolutions
		cost = {
			influence = @resolution_cost_t1
		}
	}

	target = yes
	harmful = yes
	valid_target = {
		is_country_type = default
		is_galactic_community_member = yes
		NOT = { is_same_value = from } # don't denounce yourself.
		OR = {
			opinion_level = { who = from level < neutral }
			from = { is_rival = prev }
			is_in_breach_of_any = yes
		}
	}

	effect = {
		add_modifier = { modifier = resolution_denounced days = 3600 }
	}

	potential = {
		is_galactic_council_established = yes
		NOT = { has_global_flag = resolution_council_denouncement_abolished }
	}

	allow = {
		is_part_of_galactic_council = yes
	}

	ai_weight = {
		weight = @resolution_weight_disliked
	}
}

The "resolution_sanctions_economic" statement is a Static Modifier, not just a Modifier. A "resolution_sanctions_economic = 1" statement in a modifier block means this block has one time the effect as that Static Modifier while "= 2" means twice.

Galactic Focuses[edit]

Galactic Focuses are defined at "common/galactic_focuses/xxx.txt".

Data Structure[edit]

  • icon - A reference to a GFX entry.
  • potential - A block of Conditions to check if this galactic focus is vaild. (Global scope)
  • trigger - A block of Conditions to check if this galactic focus is fulfilled. (Global scope)
  • effect - A block of Effects to be executed to each galactic community member when this focus is fulfilled. (Country scope)

Galactic Focus Example[edit]

galactic_focus_crisis_prethoryn = {
	icon = "GFX_galactic_focus_threat_to_galaxy"

	effect = {
		add_resource = { influence = 100 }
		country_event = { id = crisis.211 }
	}

	potential = {
		has_global_flag = galactic_focus_crisis_prethoryn
		NOT = { has_global_flag = prethoryn_invasion_defeated }
	}

	trigger = {
		custom_tooltip = {
			fail_text = "galactic_focus_crisis_prethoryn"
			has_global_flag = prethoryn_invasion_defeated
		}
	}
}

Relevant Dynamic Modding Statements[edit]

Country Conditions

  • num_envoys_to_galcom <=> int - Checks the number of envoys this empire assigned to the galactic community.
  • is_proposing_resolution = <resolution key/any> - Checks if this empire is proposing a specific, or any, resolution.
  • is_galactic_community_member = yes/no - Checks if this empire is a member of the galactic community.
  • is_part_of_galactic_council = yes/no - Checks if this empire is a member of the galactic council.
  • galactic_community_rank <=> int - Checkes the rank of diplomatic weight this empire of in the galactic community. Returns -1 if this empire is not a member.
  • is_permanent_councillor = yes/no - Checks if this empire is a permanent councillor.
  • is_in_breach_of_any = yes/no - Checks if this empire is in breach of any galactic law.

Country Effects

  • pass_resolution = <resolution key> - Immediately passes a resolution. It's considered to be proposed by this empire. Targeted resolutions can't be passed this way.
  • add_to_galactic_council = yes - Makes this empire a councillor.
  • remove_from_galactic_council = yes - Removes this empire from the galactic council.
  • add_permanent_councillor = yes - Makes this empire a permanent councillor.
  • remove_permanent_councillor = yes - Removes this empire from permanent councillors.

Global Conditions

  • is_galactic_community_formed = yes/no - Checks if the galactic community is formed or not.
  • is_years_since_community_formationn <=> int - Checks the years since the formation of the galactic community.
  • is_galactic_council_established = yes/no - Checks if the galactic council is established or not.
  • is_years_since_council_establishment <=> int - Checks the years since the establishment of the galactic council.
  • num_council_positions <=> int - Checks the number of council positions.
  • is_voting_on_resolution = <resolution key/any> - Checks if the galactic community is now voting on a specific, or any, resolution.
  • is_active_resolution = <resolution key> - Checks if a specific resolution is in effect.

Global Effects

  • set_council_size = int - Sets the galactic council size.
  • increase_council_size = yes - Increases the galactic council size by 1.
  • decrease_council_size = yes - Decreases the galactic council size by 1.
  • set_council_veto = yes/no - Sets whether council members can veto resolutions or not.
  • set_council_emergency_measures = yes/no - Sets whether council members can propose emergency measures or not.
Empire EmpireEthicsGovernments • Civics • OriginsMandatesAgendasTraditions • Ascension PerksEdictsPoliciesRelicsTechnologiesCustom Empires
Pops JobsFactions
Leaders LeadersLeader Traits
Species SpeciesSpecies Traits
Planets PlanetsPlanetary Feature • Orbital DepositBuildings • DistrictsPlanetary Decisions
Systems SystemsStarbasesMegastructuresBypassesMap
Fleets FleetsShips • Components
Land Warfare ArmiesBombardment Stance
Diplomacy Diplomacy • Federations • Galactic CommunityOpinion ModifiersCasus Belli • War Goals
Events EventsAnomaliesSpecial projectsArchaeological Sites
Gameplay GameplayDefinesResources • Economy
Dynamic modding Dynamic moddingEffectsConditionsScopesModifiersVariablesAI
Media/localisation Maya exporterGraphicsPortraitsFlagsEvent picturesInterfaceIconsMusicLocalisation
Other Console commandsSave-game editingSteam Workshop