Variable scripting

From Europa Universalis 3 Wiki
Jump to navigation Jump to search

This article is only accurate for EU3 and Napoleon’s Ambition, version 2.2.
Please help update this page to include information on the IN, HTTT and DW expansions.

Note: In Nomine IN.gif has added real variables, this method is obsolete.Here’s an tutorial.

The method

A Variable is a way to save data in order to later retrieve it so that you can make decisions based on it. country and province flags only let you have two states that can be read. they are either present or not present for a country or province. this tutorial will allow you to keep track of how many times a country does something. You can also have 11 possible states that can be read from 1 variable instead of only 2 when using flags.

Here are the steps to be able to allow variables for scripting:

  • creating a new country: Make a new country and call it Variable or something that will let you (And the player since it shows in the event) know that this is a Variable country. read the next steps before starting the new country tutorial to save yourself time.
  • Choose VAR as the country tag or something that you will remember as being the variable country.
  • Do not give this country any core provinces.
  • Do not make a .tga flag for this country since this country will never play in the game.
  • set all the technology sliders for the new country so they start at -5.

since this country will not ever be in the game, we will use it to keep track of our data

Script Examples

use VAR = { aristocracy_plutocracy = 1 } to change the plutocracy variable to position 2 (-4) in an event. then all you have to do is script an event trigger that will look for VAR = { aristocracy_plutocracy = -4 } in order to make something happen once this slider reaches this point.

Slider positions

Variable value, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10


Slider value, ,-5,-4, -3, -2, -1, 0, 1, 2, 3, 4, 5

Counting past ten

You can use the inflation percentage for keeping track of numbers also. this is probably more efficient but just in case you want to use the sliders this is how to count past ten.

I recommend using plutocracy as 0 to 10. make an event that looks for plutocracy being 5 (which is 10) and then reset plutocracy to -5 (0) and then change the next slider below it to -4 (11). from then on you must read both sliders. -4 on slider two will always mean a you add ten to the number. to add 20 to a number then position slider 2 to -3 (20). when the second slider reaches 5 (100) reset it and set the third slider to -4 (100) and continue if needed.

  • slider, , , number colum
  • 1, , , , , 0 to 10 (multiples of 1 only)
  • 2, , , , , 10 to 100 (multiples of 10 only)
  • 3, , , , , 100 to 1000 (multiples of 100 only)
  • 4, , , , , 1000 to 10000 (multiples of 1000 only)
  • 5, , , , , 10000 to 100000 (multiples of 10000 only)
  • 6, , , , , 100000 to 1000000 (multiples of 100000 only)
  • 7, , , , , 1000000 to 10000000 (multiples of 1000000 only)
  • 8, , , , , 10000000 to 100000000 (multiples of 10000000 only)

Slider Names (variables)

  • 1, , aristocracy_plutocracy
  • 2, , centralization_decentralization
  • 3, , innovative_narrowminded
  • 4, , mercantilism_freetrade
  • 5, , offensive_defensive
  • 6, , land_naval
  • 7, , quality_quantity
  • 8, , serfdom_freesubjects

This means you have 8 variables (8 country sliders) from 0 (-5) to 10 (5) that you can use as 8 separate variables or use them all to keep track of a number from 0 to 10,000,000.

Example number: 292

  • 1, , aristocracy_plutocracy -3 (2)
  • 2, , centralization_decentralization 4 (90)
  • 3, , innovative_narrowminded -4 (200)
  • 4, , mercantilism_freetrade -5
  • 5, , offensive_defensive -5
  • 6, , land_naval -5
  • 7, , quality_quantity -5
  • 8, , serfdom_freesubjects -5

2+90+200

Using a dynamic flag

You can also have a slider represent a status of a country. if -5 = 'not at war', -4 = 'at war with unknown', -3 = 'war with England', -2 = 'war with France' and so on, then this means you can set the status for a country. i think this kind of thing may reduce the amount of flags you require to keep track of a countries status.

Other Variables you can use

Recommended:

  • inflation (the current inflation percentage of the variable country)

These can only be changed with events which will not fire for the variable country since it is not in the game. this means a player would have to write their own event to cheat.

Not Recommended:

these are not recommended because the player can use the console to change these things for the variable country using cheats during the game.