Subject type modding

From Europa Universalis 4 Wiki
Jump to navigation Jump to search

The /Europa Universalis IV/common/subject_types folder provides a way to make new subject types. The new subject types must be first copied from a template (uses 'copy_from = x') (use 'default' to copy from the first template). After this specific values can be overridden. After a subject type is made, it can be integrated into the game using a peace option.

Default subject[edit]


default = {
	# Graphics:
	sprite = GFX_icon_vassal
	diplomacy_overlord_sprite = GFX_diplomacy_leadvassal # The one that the overlord sees
	diplomacy_subject_sprite = GFX_diplomacy_amvassal	# The one that the subject sees

	# Triggers:
	is_potential_overlord = { always = no } 			# This part is not copied in copy_from. Actual default is equivalent to always = yes
	can_be_established = { always = no }				# Ditto
	
	# Properties:
	has_overlords_ruler = no
	can_fight_independence_war = yes
	is_voluntary = no									# Whether they can leave the relationship whenever they want
	transfer_trade_power = no
	transfer_trade_if_merchant_republic = no
	joins_overlords_wars = yes
	joins_colonial_wars = no
	can_be_integrated = no
	can_release_and_play = no							# "Release Colony" in SubjectView
	uses_tariffs = no
	dynamically_created_during_history = no				# If the country is automatically created. ( Makes for special checks during history )
	eats_overlords_colonies = no						# Wheter subject assumes control of overlord's colonies in same colonial region.
	has_colonial_parent = no							# Regulates most rules that should hold only for colonies
	overlord_can_attack = yes
	overlord_can_be_subject = no
	can_have_subjects_of_other_types = no
	can_be_annexed = no
	takes_diplo_slot = yes
	has_power_projection = yes
	can_release_in_peace = yes
	uses_military_focus = yes
	overlord_protects_external = no						# Whether overlord always gets called (declinable) against countries without the same overlord. When this is 'no' overlord will only join if the defender would have been blocked (by its subject type) from attacking the attacker.
	counts_for_borders = yes							# Whether distance between borders counts this subject type as part of its overlord's borders.
	overlord_enforce_peace_attacking = no				# Whether the overlord can enforce peace on the subject's enemy even when the subject is the attacker
	can_use_claims = yes								# Whether the overlord can use the subject's claims and cores for declaring war
	gives_daimyo_bonuses = no
	gets_help_with_rebels = no							# Only for AI. Bidirectional.
	share_rebel_popup = yes								# Whether the Overlord gets popups about Subject's rebels and sees them in Stability View.
	separatists_become_subjects = no					# Whether separatist rebels enforcing demands will become subjects of the overlord.
	allows_taking_land_without_independence = no
	can_transfer_in_peace = yes							# Whether this subject type can be made into a vassal with the "Transfer Subject" Age Ability.
	can_set_mil_focus = yes
	can_send_missionary_to_subject = yes				# Requires Cradle of Civilization
	can_union_break = no								# Only works together with has_overlords_ruler
	overlord_can_fabricate_for = yes
	
	max_government_rank = 0								# 0 means no limit
	cities_required_for_bonuses = 0						# How many cities the subject needs before giving bonuses to overlord
	trust_on_start = 35									# Overlord and subject will each get this much extra trust with each other at game start

	base_liberty_desire = 0.0
	liberty_desire_negative_prestige = 0.0
	liberty_desire_development_ratio = 0.0
	liberty_desire_same_dynasty = 0.0
	liberty_desire_revolution = 30.0					# Liberty desire at 100% revolution spread in country
	pays_overlord = 0.0									# 1.0 represents the amount payed by vassals
	forcelimit_bonus = 0.0								# 1.0 represents bonus from having a vassal
	forcelimit_to_overlord = 0.0						# Percent of subject FL to use as base for modifiers
	military_focus = 1.0								# How much the AI subject should spend etc. on army and forts. 0 should make them spend nothing. Very high values will probably not make a big difference since there will be sanity checks.

	relative_power_class = 1 							# 0 - relative power not taken into account, 1 - this subject's only, x - all subjects with x
	diplomacy_view_class = 1							# See description in file

	can_fight = {
	}
	can_rival = {
	}
	can_ally = {
	}
	can_marry = {
	}

	# Subject Interactions:
	# (continuous)
	embargo_rivals = yes
	support_loyalists = no
	subsidize_armies = no
	scutage = no
	send_officers = no
	divert_trade= no
	# (immediate)
	placate_rulers = yes
	place_relative_on_throne = no
	enforce_religion = yes
	customize_subject = no
	replace_governor = no
	grant_province = yes
	enforce_culture = no
	siphon_income = no
	fortify_march = no
	seize_territory = no
	start_colonial_war = no
	grant_core_claim = yes
	sacrifice_ruler = no
	sacrifice_heir = no
	increase_tariffs = no
	decrease_tariffs = no
	takeondebt = yes
	bestow_gifts = no
	send_additional_troops = no
	demand_artifacts = no
	demand_additional_tribute = no
	force_seppuku = no
	press_sailors = no
	contribute_to_capital = no
	force_isolation = no
	return_land = no
	conscript_general = no
	knowledge_sharing = yes
	block_settlement_growth = yes
	allow_settlement_growth = yes
	# (special)
	sword_hunt = no
	sankin_kotai = no
	expel_ronin = no

	# Modifiers:
	modifier_subject = clear # Use this to clear after copy_from.
	modifier_subject = { # Otherwise, this only adds modifiers, and doesn't remove previously added.
		modifier = subject_nation
	}
	modifier_overlord = clear

	overlord_opinion_modifier = null # If not "null" it will look for a modifier with that name in 00_opinion_modifiers.txt and other files in that directory.
	subject_opinion_modifier = null
}

Example subject[edit]

Here is an example subject, note the 'copy_from = default' line, this causes it to use the default subject type (shown above) as it's template

A good idea is to copy a similar subject, and then edit the properties


subject_type = {
	copy_from = default
	
	# the icons
	sprite = GFX_icon_subject_type
	diplomacy_overlord_sprite = GFX_diplomacy_lead_subject_type
	diplomacy_subject_sprite = GFX_diplomacy_am_subject_type

	# properties
	can_be_annexed = yes
	has_power_projection = yes
	gets_help_with_rebels = yes

	max_government_rank = 2

	liberty_desire_development_ratio = 0.1
	liberty_desire_same_dynasty = -25.0
	pays_overlord = 2.0
	forcelimit_bonus = 0
	forcelimit_to_overlord = 0

	relative_power_class = 1
	
	restoration_cb = cb_disloyal_vassal

	# Subject Interactions:
	scutage = yes
	place_relative_on_throne = yes
	divert_trade = yes
	seize_territory = no

	# modifiers (extra detail here would be appreciated)
        # allows modifiers like land_forcelimit = 1 ?
	modifier_subject = {
		modifier = subject_type_nation
	}
	modifier_overlord = {
		modifier = subject_type_subject
	}
        #looks in 00_opinion_modifers
	overlord_opinion_modifier = is_subject_type
	subject_opinion_modifier = is_subject_type
}

Localisation[edit]

The following localisation values are required (examples uses the subject type subject_type)


  subject_type: "Subject Type"
  subject_type_long_desc: "Description in subject view (A subject type is a subject that supports its overlord in some way"
  subject_type_is_our: "$NAME|Y$ is a subject type of us"
  subject_type_title: "Subject Type (x is a Subject Type of y - used for showing who is a subject of who)"
  subject_type_title_plural: "Subject Types (used for showing all subjects of subject_type of overlord)"

Interface/GFX[edit]

The following files are required: An image for the overlord of x An image showing the subjects of y An image which is used in the subject view

The following sprites need to be added to countrydiplomacyview.gfx:

        spriteType = {
		name = "GFX_diplomacy_lead_subject_type"
		texturefile = "gfx//interface//icon_diplomacy_lead_subject_type.dds"
	}
	spriteType = {
		name = "GFX_diplomacy_amjunior"
		texturefile = "gfx//interface//icon_diplomacy_am_subject_type.dds"
	}

The following sprite needs to be added to countrysubjectview.gfx:

        spriteType = {
	  	name = "GFX_subject_subject_type"
	 	texturefile = "gfx/interface/subject_type_icon.dds"
	}



Note: the names and texturefiles strings can change, none are needed to be exactly in that format, but this guide will use that format

These are referenced in the the subject file with the following lines:

        sprite = GFX_icon_subject_type
	diplomacy_overlord_sprite = GFX_diplomacy_lead_subject_type
	diplomacy_subject_sprite = GFX_diplomacy_am_subject_type

Peace options[edit]

Note that this guide will go into only the details required for modding a subject type. Also note that only one peace option per file seems to work, so since the default has a dummy option (see below), another file is required


#THIS is taker, FROM is giver

# Cannot have a different taker or giver than the two negotiating in the peace page.
# cannot cede provinces or operate on 3rd parties

# Example:
force_subject_type = {
	category = 6 #  The tab of the peace option.  0 - 6.
	power_projection = vassalized_rival # only applied if the giver is the taker's rival
	power_cost_base = 1.0 # Base factor for unjustified demand dip cost, scales with the war score cost
	prestige_base = 1.0 # Base factor for prestige, scales with war score cost
	ae_base = 1.0 # Base factor for ae, also scales with war score cost.
	warscore_cost = {
		# The cost of the treaty, decides which of the provinces' war score costs are used 
		all_provinces = 0.0 # All the giver's provinces
		no_provinces = 1.0 # price for a single province of 1 war score cost, just a constant
		owner_keeps = 0.0 # The provinces kept
		conquered = 1.0 # Provinces that have been demanded by the taker
		returned_core = 0.0 # Provinces that have been demanded as a 'return core'
		released_nation = 0.0 # provinces that have been demanded to be released into a separate new nation
		cancelled_subject = 0.0 # provinces of a cancelled_subject?
		concede_colonial_region = 0.0 # provinces in a colonial region?
	}
	warscore_cap = -1 # cap for warscore if not negative
	requires_demand_independence = yes # If former subjects in an independence war must ask for independence for this to work
	is_make_subject = yes # Can this peace option be used with other force subject interactions or granting independance options
	requires_is_allowed = no # Whether it is required to be specifically allowed by a cb (such as restoration of union). If no, unjustified demands is applied.
	
	is_visible = { #when is this option viewable
		always = yes
		
	}
	is_allowed = { #when is this option allowed/selectable
		always = yes
	}
	effect = { # effect of peace 
		create_subject = {
			subject = FROM
			subject_type = subject_type
		}
	}
	 ai_weight = { 
		export_to_variable = {
			variable_name = ai_value # Must have variable called 'ai_value' as it is this variable which is evaluated at the end
			value = 1
		}
		 limit = { # if limit is false, the ai_weight is 0
			always = no
		}
	}
}

Localisation of peace option[edit]

The following needs localising

  force_subject_type_desc: "Make [From.GetName] a Subject Type of [This.GetName] - value in peace summary"
  CB_ALLOWED_force_subject_type: "Force Subject Type - value used when displayed in cbs?"
  PEACE_PO_subject_type: "Force Subject Type - option in peace menu?"

Checklist[edit]

added an entry to /common/subject_types/00_subject_types (does work for sure if in same file)

added images to /gfx/interface/name_used_in_gfx_file.tga

added sprites to /interface/countrydiplomacyview.gfx

added sprite to /interface/countrysubjectsview.gfx

added a new file containing a peace offer to /common/peace_treaties/ (unsure if works if in the same file if not above the dummy)

added values described above to any localisation file (x: "y") (with the space) (localisation files in /localisation)

all syntax is correct (if you have a problem this can be it)

Documentation EffectsTriggersModifiersScopesVariablesLocalisationCustomizable localizationRun files
Scripting AdvisorsAgesBookmarksBuildingsCasus belliColonial regionsCountriesCultureDecisionsDefinesDiplomatic actionsDisastersEstatesEventsFactionsGovernmentGreat projectsHistoryIdea groupsInstitutionsMercenariesMissionsModifiersNation designerPoliciesReligionRebel typesSubject typesTechnologyTrade companiesTrade goodsUnits
Map MapRandom New WorldTrade nodes
Graphics 3D ModelsInterfaceGraphical AssetsFontsParticlesShadersUnit models
Audio MusicSound
Other Console commandsChecksumJoroDox mod making toolMod structureTroubleshootingThe ValidatorRun files
Guides Adding a provinceSave-game editing