Okay, apg, here's something more concrete to look over. Two decisions, the first to establish a grand priory of the Order of Santiago in your capital if you hold the title King/Queen of Galicia. Could add more effects, and I haven't tested it, but just for demonstrative purposes.
The second allows you to establish a small priory for the order once the King of Galicia has established the order and its grand priory in his realm. That is where the variable comes in: the second event checks that the variable order_santiago_strength (referring to province 157: Santiago) is at least 1.0. Taking this decision fires a province event for 157 (Santiago) that will increase this variable by 1.0. Each priory of Santiago established in Christendom will increase this variable by one. Each ruler who closes a priory reduces it by one. I can do all kinds of things with the variable, like tie it to the order's levies and finances.
Code:
decisions = {
build_priory_santiago_grand = {
potential = {
ai = no
}
allow = {
OR = { culture_group = latin culture_group = iberian }
has_landed_title = k_galicia
capital_scope = { NOT = { has_building = priory_santiago_grand } }
}
effect = {
location = {
set_variable = {
which = order_santiago_strength
value = 1.0
}
{ add_building = priory_santiago_grand }
}
}
ai_will_do = {
factor = 1
}
}
build_priory_santiago_base = {
potential = {
religion = catholic
OR = { culture_group = latin culture_group = iberian }
}
allow = { check_variable = { which = order_santiago_strength value = 1.0 } }
effect = {
location = {
add_building = priory_santiago_base
}
scaled_wealth = -0.5
157 = { province_event = santiago.1 }
}
ai_will_do = {
factor = 1
}
}
}