Scripted function modding

From Europa Universalis 4 Wiki
Jump to navigation Jump to search

Scripted functions let modders disable hardcoded actions under given conditions. All scripted functions entries are fixed, you cannot add more. Many hardcoded actions furthermore have hardcoded conditions that are not listed in scripted functions, which unfortunately means that this limitation cannot be removed.

Scripted functions can have multiple "condition" blocks, which consist of a tooltip, a potential and an allow section. For scripted functions about province-level actions, ROOT is the province and FROM is the country doing the action.

Potential is the trigger for the condition to apply. If this is true, the country cannot do the action. Potential also defines whether the tooltip is shown.

Allow is the trigger for the condition to be ignored. If this is true, the country can do the action, despite the Potential trigger.

Example, a condition that restricts colonial nations to only colonize within their capital's colonial region:

   can_colonize_province = {
       condition = {
           tooltip = "colonial_expansion_limit_tooltip"
           potential = {
               FROM = { is_colonial_nation = yes }
           }
           allow = {
               FROM = { capital_scope = { colonial_region = ROOT } }
           }
       }
   }


Documentation EffectsTriggersModifiersScopesVariablesLocalisationCustomizable localizationRun files
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 ValidatorRun files
Guides Adding a provinceSave-game editing