Modifier modding

From Europa Universalis 4 Wiki
Jump to navigation Jump to search

There are several types of modifier, which are modded in different ways.

Static modifiers[edit]

Static modifiers are applied to a country or province when a specific event occurs. These events are internally coded, meaning new static modifiers cannot be added, only the modifiers they apply can be changed.

Static modifiers can be found in /Europa Universalis IV/common/static_modifiers/*.txt.

An example of a static modifier for a country would be the following, which scales with the country's current absolutism value.

absolutism = {
	administrative_efficiency = 0.4
	discipline = 0.05
	core_decay_on_your_own = -0.5
}

Timed modifiers[edit]

Timed modifiers are applied to a subject when specific actions are taken towards them. These actions are internally coded, meaning new timed modifiers cannot be added, only the attributes they use can be changed.

Timed modifiers can be found in /Europa Universalis IV/common/timed_modifiers/*.txt. An example of a timed modifier:

place_relative_on_throne_not_regency = {
	liberty_desire = {
		value = 25
		yearly_decay = 1
	}
}

Opinion modifiers[edit]

Opinion modifiers are used to define opinion changes, i.e. how much opinion changes, for how long, and to what max. They are either applied internally, or added with an effect such as add_opinion.

Opinion modifiers are found in /Europa Universalis IV/common/opinion_modifiers/*.txt.

This is the format of an opinion modifier:

<name> = {
    opinion = <int>                 # Opinion change. Can be negative.
    min = <int>                     # Optional. The maximum negative change this modifier can apply. 
    max = <int>                     # Optional. The maximum positive change this modifier can apply. 
    max_vassal = <int>              # Optional. The maximum positive change this modifier can apply to the receving vassal.
    max_in_other_direction = <int>  # Optional. The maximum positive change this modifier can apply to the sending country.
    
    yearly_decay = <int>            # Optional. The rate at which the opinion change is lost per year. Can be negative.
    months = <int>                  # Optional. The number of months until this modifier automatically expires.
}

The name attribute should be localized.

Event modifiers[edit]

Event modifiers are the most widely used modifiers, and are used to apply modifiers to a country or province. Typically event modifiers are added via an effect, such as add_country_modifier or add_province_modifier, see the effects page for all the possible effects.

Event modifiers are found in /Europa Universalis IV/common/event_modifiers/*.txt.

An example of an event modifier:

the_proper_old_ways = {
	raze_power_gain = 0.20
	land_morale = 0.1
	global_trade_goods_size_modifier = -0.25
}

The name attribute should be localized.

By default an event modifier's icon will use the first modifier used within itself. However, you can use the picture attribute to specify a specific icon if the event modifier is being applied to a province.

An example of an event modifier with picture:

important_natural_harbor = {
	province_trade_power_value = 10
	naval_forcelimit = 1
	local_development_cost = -0.05
	local_sailors_modifier = 0.25
	picture = "province_trade_power_value"
}

The possible icons are stored in the /Europa Universalis IV/gfx/interface/ideas_EU4 folder.

Trade modifiers[edit]

Trade modifiers are modifiers that alter the trade power of a country within a specific trade node. They are added with the add_trade_modifier effect when within a trade node province scope. See the effects page for all the details regarding add_trade_modifier.

An example of an trade modifier being added:

random_active_trade_node = {
         limit = {
                 continent = asia
                 NOT = {
                         has_trade_modifier = {
                                 who = ROOT
                                 name = merchant_recalled
                         }
                 }
         }
         add_trade_modifier = {
                 who = root
                 duration = 3650
                 power = -10
                 key = merchant_recalled
         }
}

The key attribute should be localized.

Triggered modifiers[edit]

Triggered modifiers are dynamic modifiers that apply when set trigger values are met by a country or province.

Triggered modifiers are found in /Europa Universalis IV/common/triggered_modifiers/*.txt.

This is the format of a triggered modifier:

<name> = {
    # Whether the triggered modifier is visible in the Triggered Modifiers window
    potential = {
        <triggers>
    }
    
    # Whether the triggered modifier is active
    trigger = {
        <triggers>
    }
    
    # The modifier to apply when the triggered modifier is active
    <modifiers>
}

The name attribute should be localized.

Note: usage of triggered modifiers is discouraged unless essential. Due to the nature of triggered modifiers, they evaluate for every country on every monthly tick. This means if too many triggered modifiers are added, you will introduce performance loss.

Province triggered modifiers[edit]

Province triggered modifiers are dynamic modifiers that operate directly with provinces. They must be applied with add_province_triggered_modifier to work. See the effects page for all the details regarding add_province_triggered_modifier.

Province triggered modifiers are found in /Europa Universalis IV/common/province_triggered_modifiers/*.txt.

This is the format for province triggered modifiers:

<name> = {
    # Whether the triggered modifier is visible in the Province view window
    potential = {
        <triggers>
    }

    # Whether the triggered modifier is active
    trigger = {
        <triggers>
    }

    # The modifier to apply when the triggered modifier is active
    <modifiers>
    
    # Province scope
    # Effects to execute when the triggered modifiers switches to active
    on_activation = {
    
    }
    
    # Effects to execute when the triggered modifiers switches to inactive
    on_deactivation = {
    
    } 
}

The name attribute should be localized.

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