# Mean time to happen

Mean time to happen (MTTH) is used by the event engine to decide when to trigger events. This defines how often, on average, an event should fire if its triggers are true. There is no mechanism in the game for recording how long it has actually been since the event conditions were satisfied; instead, MTTH is used to calculate a monthly chance of the event firing, and unless conditions change, the probability is exactly the same each month. This means that even an event with a very high MTTH could possibly fire immediately after the conditions are met, and could also possibly not fire at all for the entire game.

## Example

Let's say an event start like this:

```country_event = {

id = 1010

trigger = {
NOT = { primary_culture = Irish }
owns = 373  # Meath
}

mean_time_to_happen = {
months = 216
}
...
```

Here, the triggers are true if a non-Irish country owns Meath. With a MTTH of 216 months this event will fire on average once in every 18 years, however, it may actually fire at any time (with a 1/216 probability of firing each month).

## MTTH modifiers

You can add a whole range of modifiers to the MTTH that will decrease or increase the value. The modifier consists of a trigger statement and a multiplier factor that is added to the MTTH if the trigger is true. It can look e.g. like this:

```    modifier = {
factor = 0.8
NOT = { ADM = 4 }
}
```

The trigger here is valid if the monarch's administrative rating is below 4. If this is true, the MTTH above would become 216*0.8 = 172.8 months, or a little over 14 years.

These modifier triggers are checked separately. That means that you can have additional modifiers for higher/lower values. An example:

```    modifier = {
factor = 0.9
NOT = { ADM = 4 }
}
modifier = {
factor = 0.9
NOT = { ADM = 5 }
}
modifier = {
factor = 0.9
NOT = { ADM = 6 }
}
modifier = {
factor = 1.1
}
```

The way these are scripted, the first three will be true if the monarch has ADM 3, giving a MTTH of 216*0.9*0.9*0.9 = 157.464 months, or just over 13 years. If the monarch has ADM 5, only the third will be true.

## Pulse events

There is a special category of events that can be described as "pulse events". These are a set of events whose IDs can be found in “/common/on_actions.txt”. These events will always have the following setting:

``` is_triggered_only = yes
```

This is event type information (see Structure of events) which indicates that the event does not randomly happen once on average per MTTH, but instead will only happen when it is specifically triggered by something. Pulse events are trigged on a regular basis – the in-game "pulse" code that causes one of them to fire once every 2 years. So these events will appear to pop up randomly without any obvious trigger, but in fact the game is triggering them.

For pulse events, the mean_time_to_happen section is basically hijacked to mean something completely different. Let's take an example pulse event; the "Nobles demand old rights" event:

``` #########################################################
#		Nobles demand old rights		#
#########################################################

country_event = {

id = 5075
is_triggered_only = yes

trigger = {
NOT = { centralization_decentralization = 0 }
NOT = { aristocracy_plutocracy = 0 }
}

mean_time_to_happen = {
days = 1

modifier = {
factor = 2.0
NOT = { ADM = 4 }
}
modifier = {
factor = 0.5
luck = yes
}
modifier = {
factor = 0.66