Government modding

From Europa Universalis 4 Wiki
Jump to navigation Jump to search

In Europa Universalis IV, a government determines how a nation is ruled and any mechanics that should be associated with a nation's government.

Governments[edit]

Governments are split into government types, which are defined in /Europa Universalis IV/common/governments/.

Each government type can be named arbitrarily, i.e. you can have my_gov_type = { } instead of monarchy = { }.

It is this name that the trigger government = checks for.

Here is an overview of a government type entry:

<name> = {
    basic_reform = <reform>
    
    color = { <red> <green> <blue> }
    
    reform_levels = {
        <name> = {
            reforms = {
                <reform>
            }
        }
    }
    
    legacy_government = {
        <reform>
    }
    
    exclusive_reforms = {
        <reform>
    }
}

basic_reform defines the basic reform associated with this government type, they are specified in /Europa Universalis IV/common/government_reforms/.

color defines the mapmode color to use for governments of this type. The values should be RGB values (0 to 255).

reform_levels defines each reform tier and the reforms that belong to said tier. The tiers can be named arbitrarily. You do not need to add this if your government type has no reforms.

legacy_government defines the legacy government reforms that belong to this government type. This is required to support non-Dharma players.

exclusive_reforms is used to make a set of reforms exclusive. List the reforms that should be exlusive with one another within. You can have multiple of these scopes.

Additionally, if you want to support pre-Dharma save games, you need to include the following:

pre_dharma_mapping = {
    <old government> = {
        government = <government type>
        legacy_government = <government reform>
    }
}

This maps the old government name to a new government type and legacy government reform.

Government reforms[edit]

The government reforms system is used in two ways: to implement Dharma government reforms and to implement legacy governments which apply to non-Dharma players.

A legacy government is a reform that has the following attribute: legacy_government = yes. Note that legacy government reforms must come before all other reforms, otherwise the game will crash.

A basic reform is a reform that has the following attribute: basic_reform = yes. These are referred to in government types.

To support non-Dharma players, government reforms that you add directly to countries should include the following attribute: legacy_equivalent = <reform> where reform is the legacy government reform the government reform should map to.

Note that the defaults_reform entry is required and must come before all other reforms. It is applied before any other reform.

Here is an overview of a government reform entry:

<name> = {
    potential = {
        <triggers>
    }

    <attribute> = <value>
    
    modifiers = {
        <modifiers>
    }
    
    custom_attributes = {
        <attribute> = <bool>
    }
    
    conditional = {
        allow = {
            <triggers>
        }
        
        <attribute> = <value>
    }
}

Attributes can be added directly in the form or within a conditional scope, typically to limit them to owners with the correct DLC.

potential is used to limit when a reform is visible to a nation.

modifiers is used to apply country modifiers to the country that has a reform.

custom_attributes is used to define arbitrary strings that can be checked elsewhere and localized nicely.

This is a list of all possible attributes you can use in a government reform:

Name Effect How to use Notes
basic_reform basic_reform = yes Determines whether a reform is considered a basic reform. Used in government types, should not be used in regular reforms.
legacy_government legacy_government = yes Determines whether a reform is considered a legacy government. Used in legacy government reforms, which are only applied for non-Dharma players.
legacy_equivalent legacy_equivalent = <reform> Determines the legacy government reform the reform should map to. Required for proper support of non-Dharma owners.
monarchy monarchy = yes Defines this reform as a monarchy rule set, making Legitimacy the ruler legitimacy type and applying monarchy-specific mechanics. Should only be used in basic or legacy reforms.
This is not related to the government types defined in /Europa Universalis IV/common/governments/.
republic republic = yes Defines this reform as a republic rule set, making Republican Tradition the ruler legitimacy type and applying republic-specific mechanics. Should only be used in basic or legacy reforms.
This is not related to the government types defined in /Europa Universalis IV/common/governments/.
religion religion = yes Defines this reform as a religion rule set, making Legitimacy the ruler legitimacy type and applying religion-specific mechanics. Should only be used in basic or legacy reforms.
This is not related to the government types defined in /Europa Universalis IV/common/governments/.
monastic monastic = yes Defines this reform as a monastic rule set, making Legitimacy the ruler legitimacy type and applying monastic-specific mechanics. Should only be used in basic or legacy reforms.
This is not related to the government types defined in /Europa Universalis IV/common/governments/.
dictatorship dictatorship = yes Defines this reform as a dictatorship rule set, making Legitimacy the ruler legitimacy type and applying dictatorship-specific mechanics. Should only be used in basic or legacy reforms.
This is not related to the government types defined in /Europa Universalis IV/common/governments/.
tribal tribal = yes Defines this reform as a tribal rule set, making Legitimacy the ruler legitimacy type and applying tribal-specific mechanics. Should only be used in basic or legacy reforms.
This is not related to the government types defined in /Europa Universalis IV/common/governments/.
nomad nomad = yes Defines this reform as a nomad rule set, making Horde Unity the ruler legitimacy type and applying nomad-specific mechanics. Should only be used in basic or legacy reforms.
This is not related to the government types defined in /Europa Universalis IV/common/governments/.
papacy papacy = yes Defines this reform as a papacy rule set, making Legitimacy the ruler legitimacy type and applying papacy-specific mechanics. Should only be used in basic or legacy reforms.
This is not related to the government types defined in /Europa Universalis IV/common/governments/.
has_meritocracy has_meritocracy = yes Determines whether this government uses the Meritocracy ruler legitimacy type.
has_devotion has_devotion = yes Determines whether this government uses the Devotion ruler legitimacy type.
is_elective is_elective = yes Determines whether this government uses the Election Monarchy mechanics.
free_city free_city = yes Determines whether this government uses the Free City mechanics.
is_trading_city is_trading_city = yes Determines whether this government uses the Trade City mechanics.
icon icon = "shogunate" Assigns the icon to use for the government reform. The icon needs to be defined within a GFX file before it can be used.
valid_for_new_country valid_for_new_country = yes Determines whether a new country can inherit this government reform, i.e. a released country.
allow_convert allow_convert = yes Determines whether this government reform can be converted from, i.e. Change Government peace term.
allow_normal_conversion allow_normal_conversion = yes Determines whether this government reform can be changed from, i.e. picking a new reform.
fixed_rank fixed_rank = <rank> Defines the fixed government rank this reform locks the nation to.
queen queen = yes Determines whether this government can have a consort.
heir heir = yes Determines whether this government can have a heir.
royal_marriage royal_marriage = yes Determines whether this government can have a royal marriage.
nation_designer_trigger nation_designer_trigger = { <triggers> } Determines the conditions that allow this reform to be picked in the Nation Designer.
valid_for_nation_designer valid_for_nation_designer = yes Determines whether this reform should appear in the Nation Designer.
nation_designer_cost nation_designer_cost = <value> Determines the cost in points to take this reform.
republican_name republican_name = yes Determines whether this government displays ruler names in the republican manner (without dynasties).
duration duration = <value> Determines the election cycle duration for a republic. Has no effect outside of a republic government.
maintain_dynasty maintain_dynasty = yes Determines whether the dynasty is guaranteed to remain the same no matter how the ruler is generated. Used for script generated rulers and heirs so they inherit the original dynasty (i.e. Ottomans).
militarised_society militarised_society = yes Determines whether this government bestows the Militarized Society mechanics.
has_parliament has_parliament = yes Determines whether this government bestows the Parliament mechanics.
has_harem has_harem = yes Determines whether this government bestows the Harem mechanics.
has_pashas has_pashas = yes Determines whether this government bestows the Pasha mechanics.
foreign_slave_rulers foreign_slave_rulers = yes Determines whether this government bestows the Slave Ruler mechanics.
allow_vassal_war allow_vassal_war = yes Determines whether this government bestows the Shogunate mechanics, allowing vassal wars.
allow_vassal_alliance allow_vassal_alliance = yes Determines whether this government bestows the Shogunate mechanics, allowing vassal alliances.
allow_force_tributary allow_force_tributary = yes Determines whether this government may use the Force Tributary action.
claim_states claim_states = yes Determines whether this government may claim entire states at once.
different_religion_acceptance different_religion_acceptance = <value> Applies the specified opinion modifier against nations of a different religion.
different_religion_group_acceptance different_religion_group_acceptance = <value> Applies the specified opinion modifier against nations of a different religion group.
boost_income boost_income = yes Determines whether this government boosts trade good production of neighbours (and self).
can_use_trade_post can_use_trade_post = yes Determines whether this government can assign Trade Posts.
can_form_trade_league can_form_trade_league = yes Determines whether this government can form Trade Leagues.
trade_city_reform trade_city_reform = <reform> Determines the government reform given to Trade Cities created by the nation with this government reform.
native_mechanic native_mechanic = yes Determines whether this government uses the Native Federation and Advancement mechanics.
allow_migration allow_migration = yes Determines whether this government can use the Migration mechanics.
rulers_can_be_generals rulers_can_be_generals = yes Determines whether this government can make rulers into generals.
heirs_can_be_generals heirs_can_be_generals = yes Determines whether this government can make heirs into generals.
min_autonomy min_autonomy = <value> Determines the minimum autonomy allowed when a nation has this government reform.
start_territory_to_estates start_territory_to_estates = <value> Determines the initial territory spread owned by estates when a nation has this government reform.
factions factions = { <faction> } Applies the specified factions to the nation that has this government reform.
assimilation_cultures
assimilation_cultures = {
    <culture group> = {
        <modifiers>
    }
}
Applies the Assimilation mechanic with the specified bonuses to the nation that has this government reform.
states_general_mechanic
states_general_mechanic = {
    <group> = {
        <modifiers>
    }
    <group> = {
        <modifiers>
    }
}
Applies the States General mechanic using the specified groups to the nation that has this government reform. The groups used by the mechanic can be defined arbitrarily.
government_abilities government_abilities = { <mechanic> } Applies the specified Government Abilities to the nation that has this government reform. Possible abilities:
  • iqta_mechanic
  • russian_mechanic
  • mamluk_mechanic
  • feudal_theocracy_mechanic
  • tribal_federation_mechanic

Government setup[edit]

To setup a government correctly, you need to be sure to include the correct government form in the history file of a country. For example, FRA - France.txt contains the following:

government = monarchy
add_government_reform = feudalism_reform

The government = monarchy tells the game that France should use the monarchy government type. If you just include this, only the basic reform associated with the monarchy type will be applied to France.

This line: add_government_reform = feudalism_reform tells the game to apply the feudalism_reform to France. This reform contains the actual Feudal Monarchy modifiers. For non-Dharma players, this reform will instead apply the feudal_monarchy legacy reform, which emulates the old Feudal Monarchy government.

Government ranks[edit]

Government ranks are no longer specific to governments, and are found in /Europa Universalis IV/common/government_ranks/.

Adding a new rank is simple, just add the new rank number and the modifiers you want to be applied.

For example:

4 = {
    diplomats = 1
}

You will need to change MAX_GOVERNMENT_RANK in the defines before this works however.

Localization[edit]

Localizing government types, reforms and reform tiers follow this format:

 <string>: ""
 <string>_desc: ""

The government names themselves are handled in /Europa Universalis IV/common/government_names/. The files here contain the entries that assign the localization strings for ruler, consort and heir names, as well as the government names by government rank.

Here is the format used for a government naming entry:

<string> = {
    rank = {
        <rank> = <string>
    }
    
    ruler_male = {
        <rank> = <string>
    }
    
    ruler_female = {
        <rank> = <string>
    }
    
    consort_male = {
        <rank> = <string>
    }
    
    consort_female = {
        <rank> = <string>
    }
    
    heir_male = {
        <rank> = <string>
    }
    
    heir_female = {
        <rank> = <string>
    }
    
    trigger = {
        <triggers>
    }
}

By default you only need to add entries for ranks one to three, but the system does support up to ranks one to ten.

Note that the game will use the earliest entry that the country matches, so adding entries that are too general before more specific entries will cause the more specific entries not to be used.

Documentation EffectsTriggersModifiersScopesVariablesLocalisationCustomizable localization
Scripting AdvisorsAgesBookmarksBuildingsCasus belliColonial regionsCountriesCultureDecisionsDefinesDiplomatic actionsDisastersEstatesEventsFactionsGovernmentGreat projectsHistoryIdea groupsInstitutionsMissionsModifiersNation designerPoliciesReligionRebel typesSubject typesTechnologyTrade companiesTrade goodsUnits
Map MapRandom New WorldTrade nodes
Graphics 3D ModelsInterfaceGraphical AssetsFontsParticlesShadersUnit models
Audio MusicSound
Other Console commandsChecksumJoroDox mod making toolMod structureTroubleshootingThe Validator
Guides Adding a province