Estate modding

From Europa Universalis 4 Wiki
Jump to navigation Jump to search

Estates are factions within the nation that influence domestic politics.

Estates[edit | edit source]

Estates are found in /Europa Universalis IV/common/estates/*.txt. An estate follows this general format:

<estate> = {
	icon = <index>
	color = { <rgb> }   # Sets the estate's color in the land share pie chart
	
	# If true, country will get estate
	trigger = {
		<triggers>
	}

	# These scale with loyalty & power
	country_modifier_happy = {
		<modifiers>
	}
	country_modifier_neutral = {
		<modifiers>
	}	
	country_modifier_angry = {
		<modifiers>
	}

	land_ownership_modifier = {
		<modifiers>
	}

	province_independence_weight = {
		factor = <float>
		modifier = {
			factor = <float>
			#Insert conditions here
		}
	}

	# Influence modifiers
	base_influence = <float>
	influence_modifier = {
		desc = <key> # The new name to apply
		trigger = {
			<triggers>
		}	
		influence = <float>
	}
	# Loyalty modifiers
	loyalty_modifier = {
		desc = <key> # The new name to apply
		trigger = {
			<triggers>
		}
		loyalty = <float>
	}
	
	custom_name = {
		desc = <key> # The new name to apply
		trigger = {
			OR = {
			
			}
		}
	}
	contributes_to_curia_treasury = <bool> #yes/no

	privileges = {
                #'privileges' includes the names of the estate privileges this estate uses.
                #Estate privileges can be found in the {{path|common/estates_privileges/00_privileges.txt}}
	}

	agendas = {
                #'agendas' includes the names of the estate privileges this estate uses.
                #Estate agendas can be found in the {{path|common/estates_agendas/*.txt}}
	}
	influence_from_dev_modifier = <float>	#Determines percent influence from development
}

Estate names must contain lower-case letters and underscores only, otherwise certain effects like add_loyalty may not be generated correctly.

Country modifiers for an estate will scale with the estate loyalty and influence.

Estate Privileges[edit | edit source]

/Europa Universalis IV/common/estate_privileges

#All scopes are country scope
#All parameters are optional
<estate_privilege> = {
        icon = <index>
        max_absolutism = <float>        #Change in max absolutism while this privilege is enacted
        loyalty = <float>               #Change in percent loyalty caused by this privilege
        influence  = <float>            #Change in percent influence caused by this privilege
 	is_valid = { <triggers> }	#Conditions for whether it is possible for the country to have this privilege
 	can_select = { <triggers> } 	#Conditions for whether the country is allowed to select the privilege
 	on_granted = { <effects> } 	#Effects executed immediately upon the privilege being taken
 	can_revoke = { <triggers> } 	#Conditions for whether the country can revoke the privilege
 	on_revoked = { <effects> } 	#Effects executed upon the privilege being revoked by the country
 	on_invalid = { <effects> } 	#Effects executed upon the privilege being removed due to invalidity
 	penalties = { <modifiers> } 		#Negative modifiers granted while the privilege is active
        benefits = { <modifiers> }              #Positive modifiers granted while the privilege is active
	conditional_modifier = { 			#Modifier that are applied if the specified conditions are true.
 		trigger = { <triggers> }
 		modifier = { <modifiers> }
 		is_bad = <bool>				#yes/no. Whether the modifier should be listed as positive or negative in the tooltips.
 	}
 	modifier_by_land_ownership = { <modifiers> } 	#Multiplies the modifier by the % of land owned by the estate.
 	mechanics = { <mechanics> } 			#Special mechanics the privilege enables
 	cooldown_years = <int> 				#Time limit before which the privilege cannot be revoked
 	on_cooldown_expires = { effects }		#Effect executed once the specified cooldown_years timer has run down
	ai_will_do = {					#If above ESTATE_PRIVILEGE_GRANT_THRESHOLD define, AI will try to apply. If below 
                factor = <float>                                #ESTATE_PRIVILEGE_REVOKE_THRESHOLD, AI will try to revoke.
                modifier = {
                        factor = <float>
                        <triggers>
                }
        }
}

It is important to note the addition of 'benefits = { <modifiers> }', which is not included in /Europa Universalis IV/common/estate_privileges/xx_example.txt

Estate Agendas[edit | edit source]

This is taken from /Europa Universalis IV/common/estate_agendas/xx_example.txt

#(Nearly) all scopes are country scope
#All parameters are optional (but it will not be much of an agenda without some of them...)

<estate_agenda> = {
 	max_days_active = <float> 		#Lets you override the default of 20 years for an agenda
 	can_select = { triggers } 		#Conditions for whether the agenda can be offered to you
 	provinces_to_highlight = { triggers }	#Conditions for provinces to be highlighted by the agenda. Root = country, this = province.
 	selection_weight = {			#Determines how likely (compared to the estate's other agendas) this agenda is to be selected.
 		factor = <float>		#initial factor will ignore numbers below 1, use a modifier for that!
 		modifier = { factor = <float> triggers = <triggers> }
 	}
 	pre_effect = { effects }		#Effects executed to set up the task (set flags and targets), before it is shown to the player.
 	immediate_effect = { effects } 		#Effects executed when the agenda is accepted by the country
 	task_requirements = { triggers } 	#Conditions for completing the task successfully
 	task_completed_effect = { effects } 	#Effects executed when the agenda is successfully completed
 	failing_effect = { effects } 		#Effects executed when the agenda is failed (i.e. when fail_if is true or time runs out)
 	fail_if = { triggers } 			#Conditions for when the agenda should be auto-failed
 	on_invalid = { effects } 		#Effects executed when the country no longer has that estate or the invalid_trigger is true.
                                                #Useful for clearing flags, modifiers etc.
 	invalid_trigger = { triggers } 		#Conditions for when the agenda should end without it counting as a fail (executing on_invalid 				 
                                                #rather than failing_effect). Happens by default it the estate giving the agenda is removed.
 	modifier = { modifier } 		#Country modifier granted while the agenda is active
}

Firing Agendas[edit | edit source]

To make it so that a newly added estate is able to generate agendas when the diet is summoned the event 'estate_privileges_and_agendas_events.3' found in /Europa Universalis IV/events/EstatesPrivilegesAndAgendas.txt must be modified.

This event contains an option for each estate which could generate an agenda. The easiest way to add an option for a new estate is just to copy one of the options and change all references to the estate you copied the option from to the new estate.

Notice that the trigger for the option that was just added requires a country flag '<estate>_present_agenda' to be set.

To give the game the ability to set this flag for a new estate the 'pick_random_estate_if_present' effect in /Europa Universalis IV/common/scripted_effects/01_scripted_effects_for_estates.txt should be modified.

Once again the easiest way to add a new estate to this effect is to copy another option and change all references to that estate to the new estate.

Finally add localisation for the new option in the 'estate_privileges_and_agendas_events.3' event.

Estate Preload[edit | edit source]

This block must be inserted in /Europa Universalis IV/common/estates_preload/x.txt in order to generate the proper loyalty and influence modifiers.

#Define estate loyalty and influence modifiers here

<estate> = {
	modifier_definition = {
		type = #Either loyalty or influence
		key = <key> #This is what will be referenced in other files
		trigger = {
			<trigger>
		}
	}
}

Furthermore, in order to generate the images for increasing/decreasing loyalty and influence in privileges their particular icons must be inserted into /Europa Universalis IV/gfx/interface/ideas_EU4/<key>.dds.

Estate Crown Land[edit | edit source]

/Europa Universalis IV/common/estate_crown_land Bonuses:

<bonus> = {
    key = <key>
    range_from = <float>
    range_to = <float>
    modifier = {
        <modifiers>
    }
}

Interactions:

<interaction> = {
    key = <key>
    random_seed = random_seed 
    cooldown_months = <float>

    trigger = {
		<triggers>
    }
    effect = {
		<effect>
    }
    ai_will_do = {
		factor = <float>
		modifier = {
			factor = <float>
			<triggers>
		}
    }
}

Interface[edit | edit source]

For estate pictures to work you have to go into interface/countryestatesview.gfx and edit the noOfFrames at GFX_estates_icons and GFX_estate_interactions to match your amount The icons used for the estates themselves are defined via GFX_estates_icons:

spriteType = {
    name = "GFX_estates_icons"
    texturefile = "gfx//interface//estates//estates_icons.dds"
    noOfFrames = 6
    loadType = "INGAME"
}

All privilege icons have to be defined in this format spriteType = { name = "<key>" texturefile = "gfx/interface/privileges/*.dds" }

GFX[edit | edit source]

Estate icons are found in /Europa Universalis IV/gfx/interface/estates_icons.dds. These are used in the Estates window as part of each estate's privilege section.

  • Each icon is 44 x 44 pixels

A version of each estate icon is also found in /Europa Universalis IV/gfx/interface/estates_icons_colour-stroke.dds. These are used in the "Estate Land" section of the Estates window.

  • Each icon is 47 x 44 pixels

Privilege icons are found in /Europa Universalis IV/gfx/interface/privileges/privilege_*.dds

Localisation[edit | edit source]

Typically an estate will need the following localisation keys defined:

<estate>: "Name"
<estate>_desc: "Description"
<privilege>: "Name"
<privilege_desc>: "Description"
<agenda>: "Name"
<agenda_desc>: "Description"

Influence and loyalty modifiers use this: §Y$VAL$%§! within their tooltips to display the amount of influence or loyalty they change.

An estate can be referred to in localisation with: $<estate>$, which will display the current name of the estate, adapting to any custom name entries for the estate. Requires the localisation scope to support dynamic localisation however (i.e. won't work in interaction titles).

Documentation EffectsTriggersModifiersScopesVariablesLocalisationCustomizable localizationRun files
Scripting Scripted functionAdvisorsAgesBookmarksBuildingsCasus belliColonial regionsCountriesCultureDecisionsDefinesDiplomatic actionsDisastersEmpire of ChinaEstatesEventsFactionsGovernmentGreat projectsHistoryHoly Roman EmpireIdea groupsInstitutionsMercenariesMissionsModifiersNation designerOn ActionsParliamentPeace treatiesPoliciesRebel typesReligionSubject typesTechnologyTrade companiesTrade goodsUnits
Map MapNation designerRandom New WorldTrade nodes
Graphics 3D ModelsInterfaceGraphical AssetsFontsParticlesShadersUnit models
Audio MusicSound
Other Console commandsChecksumJoroDox mod making toolMod structureTroubleshootingThe ValidatorRun files
Guides Adding a provinceSave-game editingScripting Tutorial