Run files

From Europa Universalis 4 Wiki
Jump to navigation Jump to search

Run files, or effect files, are a great way to test triggers and effects quickly. The main benefit is that while events and decisions need to be re-read from the files by restarting the game, run files are read when they are executed. This means they can be edited while the game is still running, a very significant time saver. Do keep in mind that you have to undo any changes to the game state within the run file before running the effect again.

Run files are plain text files that can be placed into both

Documents/Paradox Interactive/Europa Universalis IV/ and

Documents/Paradox Interactive/Europa Universalis IV/mod/<<active mod folder>>/

In the game, do run <<filename>>.txt in the console.

Their ROOT and FROM scopes are both the player country executing the file.

The game will execute everything within the run file from top to bottom, as if it were a regular effect happening to the country.

Testing triggers[edit | edit source]

To test triggers, use them in an IF statement whose output is easy to check, for example like so:

   if = {
       limit = {
           # trigger to test
       add_treasury = 1

This way, you can clearly hear and see if the trigger is true. Note that if eu4 cannot read your trigger properly, it will ignore it and do the effect anyways - if you're unsure how a trigger is written, check for the opposite case (NOT) instead.

Output variables[edit | edit source]

Variables and other data can be read in a run file as well, using the "log" command. This will appear in the game.log file, located at ```Documents/Paradox Interactive/Europa Universalis IV/logs/game.log``` Beware, this file will be filled up with miscellaneous other game events as time in the game progresses.


   FRA = {
       export_to_variable = { which = test value = treasury }
       log = "[This.GetName] has [This.test.GetValue] ducats"

will result in:

   [effectimplementation.cpp:20387]: EVENT [1444.11.11]:France has 123 ducats

Documentation EffectsTriggersModifiersScopesVariablesLocalisationCustomizable localizationRun files
Scripting Scripted functionAdvisorsAgesBookmarksBuildingsCasus belliColonial regionsCountriesCultureDecisionsDefinesDiplomatic actionsDisastersEmpire of ChinaEstatesEventsFactionsGovernmentGreat projectsHistoryHoly Roman EmpireIdea groupsInstitutionsMercenariesMissionsModifiersNation designerOn ActionsParliamentPeace treatiesPoliciesRebel typesReligionSubject typesTechnologyTrade companiesTrade goodsUnits
Map MapNation designerRandom New WorldTrade nodes
Graphics 3D ModelsInterfaceGraphical AssetsFontsParticlesShadersUnit models
Audio MusicSound
Other Console commandsChecksumJoroDox mod making toolMod structureTroubleshootingThe ValidatorRun files
Guides Adding a provinceSave-game editingScripting Tutorial