Structure of events

From Europa Universalis 3 Wiki
Jump to navigation Jump to search

This article is accurate for the latest versions of EU3, Napoleon’s Ambition, In Nomine and Heir to the Throne 4.1b.
Please help update this page to include information on the DW expansion.

Events are pieces of code that check if certain triggers are true. If they are, the event may happen with a certain regularity and coded effects are applied. An event may have several options, where the player can choose which set of coded effects he or she prefers. If the triggers are false, the event will not happen. An event can be either a province event or a country event. Province events are events based on triggers related to a province, like province religion, population, data about the province owner or neighbouring provinces.

You can trigger events manually, providing you know the event id.

Basic event coding

The game loads all the events in the text files in EU3\events. By adding or modifying files in this folder you can mod your game. The events are written in a basic script language common to many Paradox games. Everything on a line that's to the right of a hash sign (#) is a comment, which is ignored by the game.

There are two kind of events : province events and country events. Both consists of five parts:

  • The head which include the event identification number (ID) and event type,
  • An event trigger,
  • A mean time to happen (MTTH),
  • An event title and description,
  • One or more event options and/or an immediate effect.

Event base scope

 province_event/country_event = {

An event could either affect a province or a country. A province event set the default scope of the event to a random province that meet the criteria set by the event triggers. A country event set the default scope of the event to a random country that meet the criteria set by the event triggers. With the help of the scopes brackets you can change the scopes in the triggers or the effects.

Header information

Event identification number

 	id = XXXX

Every event in the game must have a unique id number. It is very important that there are no id conflicts. You can find the Vanilla ID numbers list here

Event type

 is_triggered_only = yes/no

Introduced in Napoleon's Ambition. When yes, this event can only fire when another script (event, decision, on action events, domestic slider change) trigger it. If set to yes, the event should not include a mean_time_to_happen part (unless the event is a "pulse event" - see Mean time to happen). The trigger part is also optional, but if the event includes both the is_triggered_only = yes type and a trigger part, then the trigger should be valid for the event to be triggered. By default this value is set on "no" so there's no need to write is_triggered_only = no.

 major = yes/no

Introduced in In Nomine. When yes, this event is major and all players will get an informative popup with the event title and the event description. By default this value is on "no" so no need to write major = no.

 exclusive = yes/no

Introduced in Heir to the Throne. Unknown type, but we presume that it means that the event can only happen to one country at a time when the value is set to yes. By default this value is on "no" so no need to write exclusive = no.

Triggers

The trigger condition statement is optional, especially if the event have the is_triggered_only value activated.

 	trigger = {
 		TRIGGER
 		SCOPE = {
 			TRIGGER
 		}
 	}

Inside the trigger bracket you can put triggers or scopes with trigger on their own bracket. You can use AND, OR and NOT brackets.

Mean time to happen

As was said before, if the event type is_triggered_only is set to yes, the event should not include a mean_time_to_happen part (unless the event is a "pulse event" - see Mean time to happen).

 	mean_time_to_happen = {
 		TIME = YY
 		modifier = {
 			factor = XX
 		}		
 	}

Time could either be in months, in years or in day.

Title and description

All events must have a title and a description. These are coded like this:

 	title = "EVTNAMEXXXX"
 	desc = "EVTDESCXXXX"

In this example, the title and desc hold a pointer to a localisation file. Standard practice is that XXXX should equal the event ID and its localisation should be put on a csv file into the localisation folder.

This requires you to add these two lines to the localisation file. Alternatively, you can just put the text right in. Keep in mind that this does not work on longer texts. It also doesn't work in newer versions of the game (In Nomine 3.1 and later); these must use a pointer to a localisation file:

   title = "My event"
   desc = "This is the description of my first event"

Specifics strings

The event title and description can use variable strings :

Both base scopes
 $YEAR$: Displays the current year.
 $CAPITAL$: This shows the capital province of the country receiving the event.  
 $CAPITAL_CITY$: Displays the capital city of your capital province.
 $COUNTRY$: This shows the country name of the country receiving the event.  
 $COUNTRY_ADJ$: Displays the adjective form of your country.  
 $PRIMARY_CULTURE$: Displays the primary culture of your country.
 $COUNTRY_RELIGION$: Displays your country's religion.
 $EMPERORNAME$: Display the name of the current holy roman emperor
 $MONARCH$: This shows the name (and number) of the monarch ruling the country receiving the event.
 $RANDOM_OLD_MONARCH$: Display the name of a previous monarch.  
 $MONARCHTITLE$: Displays the title of your monarch.
 $DYNASTY$: Displays the dynasty of your monarch.
 $HEIR$: Display the name of the heir.
 $HEIR_CAP_ADJ$: Display a determiner accorded to the gender of your current heir, with a capital. (i.e. His/Her)
 $HEIR_ADJ$: Same as before, without the capital.
 $HEIR_S_PRONOUN$: Display the pronoun accorded to the gender of your current heir, in singular.
 $HEIR_CAP_S_PRONOUN$: Same as before, but with a capital.
 $HEIR_CAP_O_PRONOUN$: Same as before, but in the objective form.
 $HEIR_O_PRONOUN$: Same as previous, without the capital.

In addition, any advisor title can be used as a string (e.g. $ADVISOR_SCRIPT_NAME$. This will automatically display the full name of the highest-ranking advisor of that type. If none are present, it displays a non-fatal error. If two of the same rank are present it seems to select the youngest one (could be wrong).

Province base scope
 $CONTINENTNAME$: Displays the continent of the current province.
 $OWNERNAME$: Displays the country that owns the province.
 $PROVINCECULTURE$: Displays the culture of the province.
 $PROVINCENAME$: Displays the name of the province.
 $PROVINCECAPITAL$: Displays the capital city of the current province.  

Other codes

 \n: new line
 §Y: Text thereafter is yellow
 §W: Text thereafter is white (not normal text!)
 §R: Text thereafter is red
 §G: Text thereafter is green
 §B: Text thereafter is blue
 §b: Text thereafter is black
 ¤: Displays the symbol for ducats.

All off these also work for the option name.

Effects

 	immediate = {
 		EFFECT
 		SCOPE = {
 			limit = {
 				TRIGGER
 			}
 			EFFECT
 		}
 	}
 	option = {
 		name = "EVTOPTYXXXX"
 		ai_chance = { 
 			factor = XX
   			TRIGGER
 			SCOPE = {
 				TRIGGER
 			}
 			modifier = {
 				factor = XX
   				TRIGGER
 				SCOPE = {
 					TRIGGER
 				}
 			}
 		}
 		EFFECT
 		SCOPE = {
 			limit = {
 				TRIGGER
 			}
 			EFFECT
 		}
 	}
 }

Any events must have an immediate AND/OR one or more options. Effects put on the immediate bracket take effects as soon as the event fire. Effects put on one of the option bracket wait that the player click on one option button to fire. Options have a name where Y should be the option number and XXXX should equal the event ID. It's localisation should be put on a csv file into the localisation folder.

Example

As an example, let's look at the National Bank event:

country_event = {

The base scope of this event is the country.

    id = 4042

This was the id number. The head of this event only include the id. By default, all event type are set to no.

    trigger = {
        NOT = { has_country_flag = bank }
        NOT = { idea = national_bank }
        advisor = treasurer
    }

This was the trigger part

    mean_time_to_happen = {
        months = 480
        
        modifier = {
            factor = 0.9
            ADM = 6
        }
        modifier = {
            factor = 0.9
            advisor = statesman
        }
        modifier = {
            factor = 0.9
            treasurer = 5
        }
        modifier = {
            factor = 0.9
            treasurer = 6
        }
        modifier = {
            factor = 1.1
            NOT = { ADM = 5 }
        }
        modifier = {
            factor = 1.2
            NOT = { ADM = 3 }
        }
        modifier = {
            factor = 1.1
            NOT = { advisor = statesman }
        }
    }

This was the mean time to happen with modifiers

    title = "EVTNAME4042"
    desc = "EVTDESC4042"

These were the title and description. They are reported into the localisation folder.

    option = {
        name = "EVTOPTA4042"        # National loans at 500 ducats
        ai_chance = { factor = 5 }
        inflation = -5
        stability = 1
        loan_size = 500
        set_country_flag = bank
    }
    option = {
        name = "EVTOPTB4042"        # National loans at 200 ducats
        ai_chance = { factor = 90 }
        inflation = -5
        stability = 1
        loan_size = 200
        set_country_flag = bank
    }
    option = {
        name = "EVTOPTC4042"        # National loans at 1000 ducats
        ai_chance = { factor = 5 }
        inflation = -5
        stability = 1
        loan_size = 1000
        set_country_flag = bank
    }
}

And at last the options. This event has three different options but don't have immediate effect. Notice that this event don't use any scope, neither in the trigger, in the MTTH or in the effects.

See also