Open main menu

Diplomatic action modding

There are two methods to modifying diplomatic actions: controlling the conditions of hard-coded interactions in /Europa Universalis IV/common/diplomatic_actions, and adding new interactions in /Europa Universalis IV/common/new_diplomatic_actions

Contents

Diplomatic actionsEdit

The 00_diplomatic_actions.txt file in /Europa Universalis IV/common/diplomatic_actions controls the conditions for vanilla diplomatic actions, such as royal marriage. You cannot edit the effect of the interactions, only restrict when the action can be taken.

To do so, you add a condition scope to the appropriate action scope, creating the action scope if it does not exist. For example, if you wanted to prevent study_technology from being used if the current country is a republic, you'd do the following:

study_technology = {
    condition = {
        tooltip = CANNOT_STUDY_TECHNOLOGY
        potential = {
            government = republic
        }
        allow = {
            always = no
        }
    }
}

The potential here is used to limit when the condition is applied. The allow on the other hand is used to restruct when the action is blocked.

You can add a tooltip with the tooltip line, which appears when the condition is valid and is disallowing the action.

The general format is:

<action> = {
    condition = {
        tooltip = <string>
        potential = {
            <triggers>
        }
        allow = {
            <triggers>
        }
    }
}

New diplomatic actionsEdit

The 00diplomatic_actions.txt file in /Europa Universalis IV/common/new_diplomatic_actions is used to implement new diplomatic actions. You can create new files for new actions.

<action> = {
    category = <category>           # Which diplomatic action list the action will appear in.
    
    alert_index = <int>             # The alert to use for the action. Refer to static_actions for the indexes. Optional.
    alert_tooltip = <key>           # The localisation key to display in the alert tooltip. Optional.
    
    require_acceptance = yes / no   # Whether the action needs to be accepted by the target country for the accept effect to execute.
    
    # Determines when the action is visible
    is_visible = {
        <triggers>
    }
    
    # Determines when the action can be taken
    is_allowed = {
        <trigger> 
        # variable_arithmetic_trigger can be used here to use export_to_variable to extract and compare values such as ruler_age, etc
    }
    
    # Which effects to execute on acceptance
    on_accept = {
        <effects>
    }
    
    # Which effects to execute on decline (if declinable). Optional.
    on_decline = {
        <effects>
    }
    
    # Controls the AI's acceptance of the action, if acceptable. Optional.
    ai_acceptance = {
        # Add an AI factor entry
        add_entry = {
            name = <key>    # The localisation key to display for this factor
            
            # Restricts this entry to the countries that validate the triggers. Optional.
            limit = {
                <triggers>
            }
            
            # ai_value MUST always be created within an entry first.
            export_to_variable = {
                variable_name = ai_value
                value = <exportable value>      # Which exportable value to export
                who = FROM                      # Who to export the value from
                with = THIS                     # Who the ai_value is for
            }
            
            # You can then change ai_value with effects such as multiply_variable, etc
        }
    }
    
    # Controls the AI's usage of the action
    ai_will_do = {
        <triggers>
    }
}

is_allowed makes use of the variable arithmetic trigger, for more information see Variables. Look at the examples in the 00diplomatic_actions.txt file as well for further understanding.

ROOT is the country using the action, FROM is the country being targeted for the action.

CategoriesEdit

The diplomatic action category types:

  • alliance
  • influence
  • relation
  • dynasty
  • covert
  • economy
  • access
  • emperor
  • papacy
  • great_powers

LocalisationEdit

New diplomatic actions need the following localisation keys defined:

<action>: "Action"
<action>_title: "Action"
<action>_desc: "Description"
<action>_tooltip: "Description"
<action>_alert_tooltip: "Action"
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