
===============
= Definitions =
===============

N = integer
V = float

-----------------------
- Valid [target char] -
-----------------------

Family:
-------

[spouse/father/mother/random_son/worst_son/best_son/primary_heir/other_heir]

Court:
------

[ruler/steward/chancellor/marshal/spymaster/chaplain/random_courtier/worst_courtier/best_courtier/knight]

Note: "knight" selects a random adult male in the court

Ruler:
------

[liege/random_vassal/worst_vassal/best_vassal]

Other:
------

[random_neighbor/worst_neighbor/best_neighbor/random_enemy]
[this]										Note: targets the same character for whom the current event is firing
[crusade_target_holder]								Note: targets the ruler who controls the current crusade target. Use with caution!
[papacy]									Note: Whoever holds the title PAPA (you should check that someone does in your trigger conditions else this may CTD)
[controller]									Note: current papal controller (again, you should check that one exists in your trigger)

----------------------
- General Conditions -
----------------------

type = difficulty value = N							Note: difficulty >= N, range[0, 4]
type = aggressiveness value = N							Note: aggressiveness >= N, range[0, 4]
type = year value = N								Note: Game year >= N
type = crusade									Note: True if any crusade is active
type = target value = [provID]							Note: true if target of current crusade is that province


====================
= CHARACTER EVENTS =
====================

--------------
- Conditions -
--------------

Character conditions:
---------------------

type = gender value = male or female
type = age value = N								Note: True if >= N
type = health value = V								Note: True if >= V
type = diplomacy value = V							Note: True if >= V
type = martial value = V							Note: True if >= V
type = intrigue value = V							Note: True if >= V
type = stewardship value = V							Note: True if >= V
type = fertility value = V							Note: True if >= V
type = religion value = [religion type]						Note: Check if the character has a certain religion.
type = culture value = [culture type]						Note: Check if the character has a certain culture.
type = piety value = V								Note: True if >= V
type = prestige value = V							Note: True if >= V
type = gold value = V								Note: True if >= V
type = loyalty value = V							Note: True if >= V
type = badboy value = V								Note: True if >= V
type = trait value = [trait type]
type = pregnant									Note: True if character is pregnant
type = is_alive									Note: True if character is alive (in some event conditions this isn't necessarily the case and could need to be established)
type = primary_heir								Note: True if character is listed as his/her LIEGE's primary heir
type = other_heir								Note: True if character appears listed as his/her LIEGE's heir but IS NOT the liege's primary heir. *** seems to be broken ***

Family conditions:
------------------

type = father_trait value = [trait type]
type = is_married								Note: Character is married
type = ruler_child								Note: Character is a courtier and the child of any ruler (any tier) and resides in the same court as the parent.

Court conditions:
-----------------

type = steward									Note: Character is a stewart.
type = chancellor								Note: Character is a chancellor.
type = spymaster								Note: Character is a spymaster.	
type = chaplain									Note: Character is a chaplain.
type = marshal									Note: Character is a marshal.
type = court value = N								Note: true if the number of adults in that court >=N

Ruler conditions:
-----------------

type = ruler									Note: Character is a ruler.
type = is_independent								Note: Character is an independent ruler.
type = is_vassal								Note: Character is a vassal.
type = has_vassal								Note: Character has at least one vassal.
type = kingdom									Note: Character is a king.
type = duchy									Note: Character is a duke.
type = county									Note: Character is a count
type = title value = TAG							Note: Character owns title TAG.
type = same_religion								Note: Character has the same religion as his liege?
type = ruler_religion value = [religion type]					Note: Check if the liege has a certain religion.
type = ruler_culture value = [culture type]					Note: Check if the liege has a certain culture.
type = papacy									Note: Check if the character is the papal controller
type = on_crusade								Note: true if character is at war with owner of the current crusade's target province.

Realm conditions:
-----------------

type = has_province_effect value = { [effect type] = [yes/no] ... }		Note: Check if the effect exist in the capital province of the court the character is in
type = has_advance value = [advance type]					Note: The character has a realm and it contains this advance?
type = has_law value = { [law type] = [yes/no] ... }
type = region value = [region tag]						Note: Owns a province in that region
type = efficiency value = V							Note: True if >= V ; range 0.0 to 1.0

War conditions:
---------------

#type = has_claim [value = tag]                                                 Note: Unfortunately, this condition doesn't seem to work.
type = atwar									Note: Character is at war
type = enemy_has_mercenaries							Note: At least one enemy (at war) has active mercenary regiments.
type = enemy_same_religion							Note: Character has the same religion as his enemy (at war)?
type = command									Note: Character is commanding a regiment.
type = combat									Note: true if the character is CURRENTLY commanding a regiment in a battle.
type = siege									Note: true if the character is CURRENTLY commanding a regiment in a siege.

External conditions:
--------------------

type = exists value = [tag]
type = ai									Note: true if the character is part of an AI realm.

-----------------------------
- Context Switch Conditions -
-----------------------------

These conditions change where the next condition is checked.

Warning:
--------
- It does not apply to effect
- Some combinations with Character/Province events do not make sense
- Some could be very CPU consuming
- They can be nested

type = capital									Note: Change context for next condition to the capital province
type = realm_capital								Note: Change context for next condition to the realm capital province
type = province province = [provID]						Note: Change context for next condition to the specified province
type = location									Note: Change context for next condition to the location of the character's military command, or to the capital province if the character has no current military command.
type = any_demesne_province							Note: Change context for next condition to a province
type = any_same_religion_province						Note: Change context for next condition to a province
type = any_same_culture_province						Note: Change context for next condition to a province
type = any_province								Note: Change context for next condition to a province
type = liege									Note: Change context for next condition to the liege
type = father									Note: Change context for next condition to the father
type = mother									Note: Change context for next condition to the mother
type = spouse 									Note: Change context for next condition to the spouse
type = realm_ruler								Note: Change context for next condition to the ruler of the realm
type = ruler_csc								Note: Change context for next condition to the ruler
type = steward_csc								Note: Change context for next condition to the steward
type = chancellor_csc								Note: Change context for next condition to the chancellor
type = marshal_csc								Note: Change context for next condition to the marshal
type = spymaster_csc								Note: Change context for next condition to the spymaster
type = chaplain_csc								Note: Change context for next condition to the chaplain
type = any_courtier								Note: Change context for next condition to a any courtier in the same court
type = any_vassal								Note: Change context for next condition to a any of the ruler vassal
type = any_child								Note: Change context for next condition to a any of the character child
type = any_same_culture_ruler							Note: Change context for next condition to a character
type = any_same_religion_ruler							Note: Change context for next condition to a character
type = any_ruler								Note: Change context for next condition to a character
type = any_allied_ruler								Note: Change context for next condition to a character
type = any_precursor, max = n							Note: Change context for next condition to a character, precursors are your father, your fathers father, your fathers father fathers etc...
type = any_heir, max = n							Note: Change context for next condition to a character
type = primary_heir (followed immeditately by another condition)		Note: Change context for next condition to whoever is currently listed as the first successor to the character. This is the same syntax as the standard primary_heir condition so be careful how you read/use it in events.
type = papacy_csc								Note: Change context for next condition to the holder of the PAPA tag
type = controller_csc								Note: Change context for next condition to the current papal controller
type = any_enemy								Note: Change context for next condition to any enemy of the current character

-----------
- Effects -
-----------

Character effects:
------------------

type = death value = [target char]						Note: No value field means "this character".
type = add_trait for = [target char] value = [trait type]
type = remove_trait for = [target char] value = [trait type]
type = health for = [target char] value = V					Note: Additive
type = diplomacy for = [target char] value = V					Note: Additive
type = martial for = [target char] value = V					Note: Additive
type = intrigue for = [target char] value = V					Note: Additive
type = stewardship for = [target char] value = V				Note: Additive
type = fertility for = [target char] value = V					Note: Additive
type = piety value = V / scale = factor						Note: Additive; factor is a negative or positive float multiplying [lastyear] value
type = prestige value = V / scale = factor					Note: Additive; factor is a negative or positive float multiplying [lastyear] value
type = gold value = [V/last_month/last_year] / scale = factor			Note: Additive; factor is a negative or positive float multiplying [lastyear] value
type = set_to_realm_religion							Note: Set character religion to realm ruler's religion.
type = loyalty for = [target char] value = V (0.0 - 1.0)			Note: Additive. If no "for" field is set, loyalty is affected for _this_ character.
type = badboy value = v								Note: Additive

Family effects:
---------------

Court effects:
--------------
type = [steward/marshal/spymaster/chancellor/chaplain]				Note: appoints this character to this position in his/her ruler's court
type = create_courtier value = [steward/marshal/spymaster/chancellor/chaplain/enemy_defector/bastard]
type = courtier_defect value = [target_char]					Note: If target_char = "none", the character retire to the "none" court

Ruler effects:
--------------

type = independence								Note: Renounce Liege. Liege will get a claim on all titles currently held by the departing character.

Realm effects:
--------------

type = add_next_advance value = [advance type]					Note: Gain next advance in the same group as "advance type".
type = remove_next_advance value = [advance type]				Note: Lose the best advance in the same group as "advance type".
type = add_advance value = [advance type]
type = remove_advance value = [advance type]
type = add_province_effect for = [target char] value = [effect type]		Note: A random province in target char's realm.
type = remove_province_effect for = [target char] value = [effect type]		Note: A random province in target char's realm.
type = add_improvement for = [target char] value = [improvement type]		Note: A random province in target char's realm.
type = remove_improvement for = [target char] value = [improvement type]	Note: A random province in target char's realm. No value means a random improvement.
type = set_law value = [any laws as in laws.txt]

War effects:
------------

type = add_title_claim value = [target char] 					Note: Gain a claim on the primary title of another character.
type = win_siege
type = remove_regiment								Note: Remove a random regiment of the character's.
type = mercenaries_defect
type = add_regiment strength = {..mil compos..) mercenaries = yes/no region = regionname culture = culturename techprov = prov tech use for this unit
type = peace value = [not_same_religion/same_religion]				Note: No value means a random enemy
type = declare_war value = [target char]					Note: use with extreme caution! This does not check whether character can do so, or whether target is valid (must be done via trigger conditions) and bypasses normal DOW AI logic.

External effects:
-----------------

type = trigger for = [target char] value = [event id]
type = crusade value = [provID/0]						Note: activates a crusade with spedified province as the target. Turns crusades off if set to 0.



===================
= PROVINCE EVENTS =
===================

--------------
- Conditions -
--------------

Province conditions:
--------------------

type = province value = [province id]						Note: Trigger only for this province
type = area value = [province id]						Note: Trigger only for provinces in the same area as province id.
type = region value = [region tag]						Note: Part of a certain region
type = terrain value = [terrain type]
type = has_improvement value = { [improvement type] = [yes/no] ... }
type = has_advance value = { [advancement type] = [yes/no] ... }
type = has_province_effect value = { [province effect type] = [yes/no] ... }
type = has_law value = { [law type] = [yes/no] ... }
type = capital value = yes							Note: Trigger only for the capital
type = is_besieged								Note: True if privince is currently under siege

Population conditions:
----------------------

type = religion value = [religion type]
type = culture value = [culture type]
type = noble_loyalty value = V							Note: True if >= V
type = noble_power value = V							Note: True if >= V
type = clergy_loyalty value = V							Note: True if >= V
type = clergy_power value = V							Note: True if >= V
type = burgher_loyalty value = V						Note: True if >= V
type = burgher_power value = V							Note: True if >= V
type = peasant_loyalty value = V						Note: True if >= V
type = peasant_power value = V							Note: True if >= V
type = regiment_mobilized							Note: True if the provincial levies are active.

Ruler conditions:
-----------------

type = same_religion								Note: Province has the same religion as the highest ruler?
type = same_culture								Note: Province has the same culture as the highest ruler?
type = ruler_culture value = [culture type]					Note: Check if the ruler of a province has a certain culture.
type = ruler_religion value = [religion type]					Note: Check if the ruler of a province has a certain religion.
type = ruler_stewardship value = V						Note: True if (Ruler+Steward) stewardship >= V
type = ruler_martial value = V							Note: True if (Ruler+Marshal) martial >= V
type = ruler_diplomacy value = V						Note: True if (Ruler+Chancelor) diplomacy >= V
type = ruler_intrigue value = V							Note: True if (Ruler+Spymaster) intrigue >= V
type = ruler_gold value = N
type = ruler_piety value = N
type = ruler_prestige value = N
type = trait value = [trait type]

Realm conditions:
-----------------

type = advance_focus value = [advance type]					Note: Does the realm have a certain advance focus?
type = demesne value = [tag]							Note: Check if this province is part of a certain demesne.
type = realm_regiments value = N						Note: True if the realm of the province has N or more regiments.

External conditions:
--------------------

type = neighbor_province_effect value = { [province effect type] = [yes/no] ... }
type = exists value = [tag]							Note: Does a realm exist with this tag?
type = title_exists value = [tag]						Note: Does someone hold this title?
type = ai									Note: true if the province is part of an AI realm.

-----------------------------
- Context Switch Conditions -
-----------------------------

These conditions change where the next condition is checked.

Warning:
--------
- It does not apply to effect
- Some combinations with Character/Province events do not make sense
- Some could be very CPU consuming
- They can be nested

type = owner									Note: Change context for next condition to the owning ruler
type = controller								Note: Change context for next condition to the controlling ruler

-----------
- Effects -
-----------

Province effects:
-----------------

type = add_improvement value = [improvement type]
type = remove_improvement value = [improvement type]
type = add_advance value = [advance type]
type = remove_advance value = [advance type]
type = add_province_effect value = [advance type]
type = remove_province_effect value = [advance type]
type = prosperity value = [-4 to 4]						Note: Changes the prosperity level in the province.

Population conditions:
----------------------

type = set_to_realm_religion							Note: Set province religion to realm ruler's religion.
type = set_to_realm_culture							Note: Set province religion to realm ruler's culture.
type = religion value = [religion type]						Note: Religion in province changed
type = culture value = [culture type]						Note: Culture in province changed
type = noble_loyalty value = V							Note: Additive, -1.0 to 1.0
type = noble_power value = V							Note: Additive, -1.0 to 1.0
type = clergy_loyalty value = V							Note: Additive, -1.0 to 1.0
type = clergy_power value = V							Note: Additive, -1.0 to 1.0
type = burgher_loyalty value = V						Note: Additive, -1.0 to 1.0
type = burgher_power value = V							Note: Additive, -1.0 to 1.0
type = peasant_loyalty value = V						Note: Additive, -1.0 to 1.0
type = peasant_power value = V							Note: Additive, -1.0 to 1.0
type = add_regiment country = [tag] culture = [culture type]

Ruler effects:
--------------

type = ruler_gold value = V / scale = factor					Note: Additive; factor is a negative or positive float multiplying [lastyear] value
type = ruler_piety value = V / scale = factor					Note: Additive; factor is a negative or positive float multiplying [lastyear] value
type = ruler_prestige value = V / scale = factor				Note: Additive; factor is a negative or positive float multiplying [lastyear] value 

External effects:
-----------------

type = create_tag value = [tag]


