Unit modding

From Europa Universalis 4 Wiki
Jump to navigation Jump to search

Modding Units[edit]

All units found ingame are stored in /Europa Universalis IV/common/units/.

Land units[edit]

To add a new historical land unit (i.e. halberd_infantry), you create a file in the /Europa Universalis IV/common/units/ directory following this format:

type = <internal type>              # One of the internal types
unit_type = <technology group>      # Optional. The technology group the unit appears for. Leaving it out will display the unit for all technology groups. 

maneuver = <int>                    # 1 for infantry and artillery, 2 for cavalry
offensive_morale = <int>
defensive_morale = <int>
offensive_fire = <int>
defensive_fire = <int>
offensive_shock = <int>
defensive_shock = <int>

unitsize = <int>                    # Optional. Overrides the standard regiment size (1000), making regiments smaller or bigger with this unit.
manpower = <float>                  # Optional. Overrides the manpower cost for this unit. 1 equals 1000 men.

# Optional, displays the unit as an option when the triggers are met.
trigger = {
    <triggers>
}

Land units can be one of these three internal types:

infantry
cavalry
artillery

Note: changing the unitsize for a unit does not alter the combat formula, which means smaller regiments will do poorly in combat.

Ship units[edit]

To add a new historical ship unit (i.e. barque), you create a file in the /Europa Universalis IV/common/units/ directory following this format:

type = <internal type>              # One of the internal types
unit_type = <technology group>      # Optional. The technology group the unit appears for. Leaving it out will display the unit for all technology groups. 

hull_size = <int>
base_cannons = <int>
sail_speed = <int>

trade_power = <float>   # Optional. Trade power this ship grants when Protecting Trade.
sprite_level = <int>    # Optional. Sprite level for ship (1 to 5)
manpower = <float>      # Optional. Overrides the manpower cost for this unit. 1 equals 1000 men.

# Optional, displays the unit as an option when the triggers are met.
trigger = {
    <triggers>
}

Ship units can be one of these four internal types:

heavy_ship
light_ship
galley
transport

Internal Types[edit]

The functionality of the internal types cannot be modified. For example, you cannot remove the cavalry flanking mechanic from units of the cavalry type, or add it to a different internal type.

Other areas in the files such as defines and modifiers refer to these types (i.e. ARTILLERY_SPEED or infantry_power and alter all units that use said internal type.

Technology[edit]

For units to appear at all, they must be enabled within a technology. Add the following line to a technology to enable a unit:

enable = <unit>

Note: land units can only be enabled in MIL type technologies, whereas ship units can only be enabled in DIP type technologies.

Localisation[edit]

The localisation for a unit follows this format:

<unit>: "Unit name here"
<unit>DESCR: "Description here"
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