Event triggers

From Europa Universalis 3 Wiki
Revision as of 17:24, 7 May 2015 by Dauth (talk | contribs) (→‎List of scope changers)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

For an event to happen, it usually needs to fulfill certain conditions, known as the event trigger.

The trigger is a list of one or more conditions that has to be true for the event to fire. You can e.g. say that a country event should only happen to France, by using a tag trigger:

    trigger = {
        tag = FRA
    }

This means that when the event engine check if this event should fire, it will only do so for France.

Scope

There are two types of events, province events and country events. The triggers for a province event will check properties of the province in question only, while the triggers of a country event will check country properties. It is therefore possible to have the same trigger code mean two different things due to the scope. As an example, the trigger

religion

can be used in both cases.

There are also ways to change scope; either from province to country or vice versa, or from one country to another or from one province to another. What a scope change does is to perform checks on this other entity, and return if they are true or not. As an example:

    trigger = {
        owner = {
            religion_group = Christian
        }
    }

The above is a trigger for a province event. It checks if the owner (i.e. country) has a state religion in the Christian religion group. It is also possible to do double scope changes:

    trigger = {
        owner = {
            religion_group = Christian
            capital_scope = {
                continent = Europe
            }
        }
    }

This first changes from the province to the country, then back to a province - the capital. This trigger will be true if the owner of the province is Christian and is a European country.

List of scope changers

Command Scope from Syntax Scope change
ally Country ally = { triggers… } From country to country. Picks a random ally.
owner Province owner = { triggers… } From province to country
controller Province controller = { triggers… } From province to country
emperor Country emperor = { triggers… } From country to emperor's country
capital_scope Country capital_scope = { triggers… } From country to capital
<num> Province <num> = { triggers… } To a specific province
<tag> Country <tag> = { triggers… } To a specific country
any_neighbor_province Province any_neighbor_province = { triggers… } To any neighbouring province
any_neighbor_country Country any_neighbor_country = { triggers… } To any neighbouring country

Numerical Triggers

A partial list of the triggers in Discovery of the East Indian trade route reads:

num_of_ports = 4
NOT = { mercantilism_freetrade = -2 }

In EU, the equals sign actually means "equal to or greater than". Use the NOT to mean "less than".

In the example above, the player must have 4 or more port provinces, and their Mercantilism/Freetrade Domestic policies slider must be set to -3 to -5, i.e., less than -2.

Combining Triggers

You can combine several trigger conditions into one trigger. This is done on the example above, where we check for country religion and capital location. The general rule is that if you have several conditions listed, all of them must be fulfilled for the trigger to be true.

If we want to have conditions based on one true out of a set, we use OR = {}. An example:

   trigger = {
        OR = {
        	owns = 124 # Messina
        	owns = 125 # Palermo
        }
    }

This country trigger is true of the country owns any of the two provinces.

Another thing we can do is to reverse the trigger, so that it returns true if the original trigger is false. To do this, we use NOT = {}. An example:

    trigger = {
        NOT = { exists = GBR }
        culture_group = British
    }

This country trigger returns true if the country's primary culture is in the British culture group, and if Great Britain (GBR) does not exist.

List of country and province triggers

The two links above document the quasi-exhaustive list of triggers :