History modding

From Europa Universalis 4 Wiki
Jump to navigation Jump to search

History is used in Europa Universalis IV to compose much of the world during specific dates.

Country[edit | edit source]

Countries are found in /Europa Universalis IV/history/countries/*.txt. These files control the gameplay parameters that make up a country. A number of entries that can be found in save files, such as monarch_consort, are also compatible with country history files.

Each country has its own file, following the naming conversion of: <tag> - <name>.

Here is a general format of a country:

technology_group = <group>      # The technology group of the country. Will set the unit type to this technology group as well.
unit_type = <group>             # Used if you want a different unit group from the defined technology group

government = <government>       # The government form of the country
government_rank = <rank>        # Current government rank: 1, 2 or 3

primary_culture = <culture>     # The primary culture of the country
religion = <religion>           # The religion of the country

add_accepted_culture = <culture>    # Add an accepted culture
remove_accepted_culture = <culture> # Remove an accepted culture

historical_friend = <tag>        # Adds a historical friend
historical_rival = <tag>        # Adds a historical rival

mercantilism = <int>            # Starting mercantilism value
religious_school = <school>     # For countries that have a religion that use Religious Schools, assigns initial school

add_army_professionalism = <value> # Army professionalism to start with

capital = <id>                  # The province that is the default capital
fixed_capital = <id>            # Forces the AI to never move their capital from the specified id, they will seek to move it back there as well if moved.

# Defines a ruler for the country. Normally used within a history entry
monarch = {
    name = <string>             # Name of the ruler
    dynasty = <string>          # Dynasty of the ruler
    adm = <int>                 # ADM skill of the ruler
    dip = <int>                 # DIP skill of the ruler
    mil = <int>                 # MIL skill of the ruler
    birth_date = <date>         # Used to set the age of the ruler. Derived from the date of the history entry the monarch scope is found in.
    female = yes                # Whether the ruler is female
    regent = yes                # Whether the ruler is considered a regency
    religion = <religion>       # The religion of the ruler
    culture = <culture>         # The culture of the ruler
    
    # Makes the defined ruler a leader
    leader = {
        name = <string>     # Name of the leader
        type = <type>       # Type of leader: general, admiral, explorer, conquistidor
        fire = <int>        # Fire value of the leader
        shock = <int>       # Shock value of the leader
        manuever = <int>    # Manuever value of the leader
        siege = <int>       # Siege value of the leader
    }
}

# Defines a heir for the country. Normally used within a history entry
heir = {
    name = <string>             # Name of heir
    monarch_name = <string>     # Name of heir if they become a ruler
    dynasty = <string>          # Dynasty of heir
    birth_date = <date>         # Used to set the age of the heir. Derived from the date of the history entry the monarch scope is found in.
    death_date = <date>         # When the heir should be removed. 
    claim = <int>               # Strength of claim for heir
    adm = <int>                 # ADM skill of the heir
    dip = <int>                 # DIP skill of the heir
    mil = <int>                 # MIL skill of the heir
    female = yes                # Whether the heir is female
    religion = <religion>       # The religion of the heir
    culture = <culture>         # The culture of the heir
}

# Defines a consort for the country. Normally used within a history entry
queen = {
    name = <string>             # Name of consort
    dynasty = <string>          # Dynasty of consort
    birth_date = <date>         # Used to set the age of the consort. Derived from the date of the history entry the monarch scope is found in.
    death_date = <date>         # When the consort should be removed. 
    adm = <int>                 # ADM skill of the consort
    dip = <int>                 # DIP skill of the consort
    mil = <int>                 # MIL skill of the consort
    female = yes                # Whether the consort is female
    country_of_origin = <tag>   # Which country the consort is from
    religion = <religion>       # The religion of the consort
    culture = <culture>         # The culture of the consort
}

# History entry, can contain any of the values above as well as normal country effects
<year>.<month>.<day> = {
    <country effects>
}

Compatibility - Partial Edits[edit | edit source]

While the basegame's format is <tag> - <name>, anything with <tag> as its first three letters counts as a valid history file for the tag defined. This means that is possible to partially edit or override a history file without modifying the vanilla files.

For example, in "FRA - FranceMODNAMEAdditions.txt":

historical_friend = SCO

And in "SCO - ScotlandMODNAMEAdditions.txt":

primary_culture = scottish
remove_accepted_culture = highland_scottish
add_accepted_culture = scottish
historical_friend = FRA

This set of edits adds a Franco-Scottish relation boost and makes Scotland's primary culture Highlander, without touching the base game's files.

Province[edit | edit source]

Provinces are found in /Europa Universalis IV/history/provinces/*.txt. These files control the gameplay parameters that make up a province.

Each province has its own file, following the naming conversion of: <id> - <name>.

Here is a general format of a province:

owner = <tag>                # Who is the current owner of the province
controller = <tag>           # Who is the current controller of the province
add_core = <tag>             # Adds a core for the specified tag
add_to_trade_company = <tag> # assigns province to trade company of the specified tag
is_city = yes / no           # Whether this province is a proper city, i.e. not a colony. 

culture = <culture>     # The culture of the province
religion = <culture>    # The religion of the province

base_tax = <int>        # The base tax of the province
base_production = <int> # The base production of the province
base_manpower = <int>   # The base manpower of the province

native_size = <int>                 # The stack size of the natives that attack (make sure "is_city = no", or there will be zero natives appearing in a province)
native_ferocity = <int>             # How tough the native attack will be
native_hostileness = <int>          # How likely natives are to attack

trade_goods = <goods>   # The tradegood assigned to this province, from 00_tradegoods.txt
estate = <estate>       # Adds this estate to the province (obsolete)
hre = yes / no          # Whether this province is in the HRE or not
capital = "<string>"    # The capital name to use for the province, otherwise the province name is used as the capital name.

discovered_by = <technology group>  # Grants the specified technology group vision of this province
reformation_center = <religion>     # Sets this province as a reformation center for the specified religion
unrest = <int>                      # Adds base unrest
<building> = yes / no               # Adds or removes the specified building
center_of_trade = <int>

# Adds a revolt
revolt = {
    type = <rebel type>
    size = <int>
    leader = <string>
}

# History entry, can contain any of the values above as well as normal province effects
<year>.<month>.<day> = {
    <province effects>
}

Compatibility - Partial Overwrites[edit | edit source]

Province history can be fully overwritten with a file of the same name. However, for partial edits it is possible to make a file starting with the same province ID #.

For example, to add early-1300s history to "4387 - Angouleme" without replacing the file, we could add a new .txt named "4387 - YourTextHere", and add as follows:

culture = occitain    # Occitan until the early 1300s.
remove_core = FRA     # Cancels the basegame's add_core to France, as in 1300 it was a vassal.
owner = AGM           # A made-up Angoumois tag for this example.
controller = AGM      # A made-up Angoumois tag for this example.
add_core = AGM        # A made-up Angoumois tag for this example.

1308.11.1 = {
    culture = cosmopolitan_french # Guy de Lusignan dies - unknown exact date. CK2 uses this year to make the province French-speaking.
    add_core = FRA # Passes to the Royal Domain, would be fought over in HYW and pass to Orléans in 1394.
    owner = FRA # Passes to the Royal Domain, would be fought over in HYW and pass to Orléans in 1394.
    controller = FRA # Passes to the Royal Domain, would be fought over in HYW and pass to Orléans in 1394.
}
1360.10.24 = {# Treaty of Brétigny.
    owner = ENG
    controller = ENG
} 
1372.1.1 = { # French reconquest of Aquitaine.
    owner = FRA 
    controller = FRA 
}
1394.1.1 = { # Province becomes Orléanais.
    add_core = ORL
    owner = ORL
    controller = ORL
}

This leaves us with Angouleme as it evolved from 1300 to 1444--Occitan-speaking vassal, then contested royal holding, then held by Orléans--all without touching vanilla files.

Diplomacy[edit | edit source]

Diplomacy is found in /Europa Universalis IV/history/diplomacy/*.txt. These files are used to define diplomatic relationships, such as subjects.

Holy Roman Emperor[edit | edit source]

Sets the current Holy Roman Emperor

<year>.<month>.<day> = {
    emperor = <tag>
}

Celestial Emperor[edit | edit source]

Sets the current Celestial Emperor

<year>.<month>.<day> = {
    celestial_emperor = <tag>
}

Relations[edit | edit source]

All relations follow this format:

<type> = {
    first = <tag>       # The overlord, if the relation is a overlord-subject relation
    second = <tag>      # The subject, if the relation is a overlord-subject relation
    start_date = <date> # When to start applying the relationship
    end_date = <date>   # When to stop applying the relationship
}

These are the following valid relations:

  • alliance
  • royal_marriage
  • guarantee
  • warning
  • vassal
  • march
  • union

Dependency[edit | edit source]

For custom subject types, you can use the dependency effect, which allows to specify subject_type:

dependency = {
    subject_type = "<subject type>"
    first = <tag>       # The overlord, if the relation is a overlord-subject relation
    second = <tag>      # The subject, if the relation is a overlord-subject relation
    start_date = <date> # When to start applying the relationship
    end_date = <date>   # When to stop applying the relationship
}

Used for tributaries normally.

Wars[edit | edit source]

Wars are found in /Europa Universalis IV/history/wars/*.txt. These files are used to define on-going wars, or recently finished wars (to create truces).

Each war must be within its own file.

A war follows this format:

name = "<string>"           # Name of the war in the war screen
war_goal = {
    type = <wargoal>        # The wargoal to use from 00_wargoals.txt
    casus_belli = <cb>      # The cb to use from 00_cb_types.txt
}

# Used to start the war at the specified date
<year>.<month>.<day> = {
    add_attacker = <tag>    # Adds a country to the attackers side
    add_defender = <tag>    # Adds a country to the defenders side
}

# Used to add ongoing battles 
<year>.<month>.<day> = {
    batle = { 
        name = "<string>"   # Name of province
        location = <id>     # Province the battle is in
        
        attacker = {
            commander = "<string>"  # Leader of the attacker's army
            infantry = <int>        # Number of infantry. 1 equals 1 soldier
            cavalry = <int>         # Number of cavalry
            artillery = <int>       # Number of artillery
            losses = <float>        # How many of the forces are already dead
            country = <tag>         # The country that is attacking
        }
        
        defender = {
            commander = "<string>"  # Leader of the defender's army
            infantry = <int>        # Number of infantry. 1 equals 1 soldier
            cavalry = <int>         # Number of cavalry
            artillery = <int>       # Number of artillery
            losses = <float>        # How many of the forces are already dead
            country = <tag>         # The country that is defending
        }
        
        result = yes    # Show result
    }
}

# Used to end the war at the specified date
<year>.<month>.<day> = {
    rem_attacker = <tag>    # Removes a country to the attackers side
    rem_defender = <tag>    # Removes a country to the defenders side
}

Advisors[edit | edit source]

Historical advisors are found in /Europa Universalis IV/history/advisors/*.txt. Historical advisors are predefined advisors that are linked to specific provinces within a date range.

A historical advisor follows this format:

advisor = {
    advisor_id = <id>           # The advisor's unique id
    name = <string>             # The advisor's full name
    location = <province id>    # The province that the advisor is linked to.
    skill = <int>               # The skill of the advisor
    type = <advisortype>        # The type of advisor
    discount = yes              # Whether to apply SCRIPTED_ADVISOR_DISCOUNT defined value to the advisor's monthly cost
    date = <year>.<month>.<day>         # When this advisor starts appearing
    death_date = <year>.<month>.<day>   # When this advisor stops appearing
    culture = <culture>         # The advisor's culture
    religion = <religion>       # The advisor's religion
}

Historical advisors are added to the advisor pool in addition to the regularly generated advisors.

Troubleshooting[edit | edit source]

Often issues within history can cause difficult to diagnose crashes. For example, a bad province id in the capital = line within a country's history file will cause a crash.

Therefore, ensure when editing history files all the references you use (i.e. province ids) are valid.

Documentation EffectsTriggersModifiersScopesVariablesLocalisationCustomizable localizationRun filesList of event pictures
Scripting Scripted functionAdvisorsAgesBookmarksBuildingsCasus belliColonial regionsCountriesCultureDecisionsDefinesDiplomatic actionsDisastersEmpire of ChinaEstatesEventsFactionsGovernmentGovernment MechanicsGreat projectsHistoryHoly Roman EmpireIdea groupsInstitutionsMercenariesMissionsModifiersNation designerOn ActionsParliamentPeace treatiesPoliciesRebel typesReligionSubject typesTechnologyTrade companiesTrade goodsUnits
Map MapMap Modding Quick ReferenceNation designerRandom New WorldTrade nodes
Graphics 3D ModelsInterfaceGraphical AssetsFontsParticlesShadersUnit models
Audio MusicSound
Other Console commandsChecksumJoroDox mod making toolMod structureTroubleshootingThe ValidatorRun files
Guides Adding a provinceMap Modding Quick ReferenceSave-game editingScripting Tutorial