• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.
Anytime that you need to set a variable that needs to increase or decrease or be checked.

EDIT: for example, you could trigger a post-battle event to increase the number of battles a general won by one each time, with a certain reward for winning say ten battles, which could be checked as a variable. Just an idea. :)

hmm i think i get it, thanks again!
 
hmm i think i get it, thanks again!

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
		}
	}
}
 
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
        }
    }
}

awesome explanation! thankyou.

the set_variable can also be used in events as well as decisions yes?
 
awesome explanation! thankyou.

the set_variable can also be used in events as well as decisions yes?

Yeah. Download the Magna Mundi mod to see what they were able to do with it for EU3. Keep in mind that variables work on characters and provinces. My decisions do not work yet, but I need to fine tune them.

For you, you can use variables for triggering province modifiers: for example, you have commercial hubs. If you have a large city, you could increase a variable to trigger a modifier like 'entrepot'.
 
For you, you can use variables for triggering province modifiers: for example, you have commercial hubs. If you have a large city, you could increase a variable to trigger a modifier like 'entrepot'.

yes thats along the lines of what i was thinking, the problem for myself being though is that has_building doesn't seem to be a viable trigger (and iv tried it in title scope - where in title scope add_building and remove_building work) so i suppose i would just have to fire an event using other means to determine when a province recieves an increase in the variable and then becomes said entrepot.
 
yes thats along the lines of what i was thinking, the problem for myself being though is that has_building doesn't seem to be a viable trigger (and iv tried it in title scope - where in title scope add_building and remove_building work) so i suppose i would just have to fire an event using other means to determine when a province recieves an increase in the variable and then becomes said entrepot.

That explains a few event failures that I've experienced.

You should think of variables as character or province flags that have a magnitude. That's really all that they are.
 
Where can I find the characters and at what court they are?
Sort like in the savegames when you have

id = NNNNNN

...

Employer = NNNNNN

You mean in the history files? That's in /history/characters/[culture of characters]. Their actual residence is based on whether they have a relative who is ruling somewhere. Unless I'm missing something. :)
 
In my titular kingdoms mod I was planning on including the Grand Duchy of Luxembourg and for the life of me I can't figure out why I can't make the localisation work so it shows Grand Duchess/Duke instead of Prince/Princess Consort

Code:
GRANDDUKE;Grand Duke;Grand Duke;Grand Duke;;Grand Duke;;;;;;;;x;
GRANDDUKE_title_ruler_consort;Grand Duke;Grand Duke;Grand Duke;;Grand Duke;;;;;;;;x;
GRANDDUKE_female;Grand Duchess;Grand Duchess;Grand Duchess;;Grand Duchess;;;;;;;;x;
GRANDDUKE_title_ruler_consort_female;Grand Duchess;Grand Duchess;Grand Duchess;;Grand Duchess;;;;;;;;x;
GRANDDUKE_OF;Grand Duchy of;Grand-Duché de;Großherzogtum;;Grand Duchy of;;;;;;;;x;

Code:
k_luxembourg = {
	color = { 210 100 100 }
	capital = 115 # Luxembourg
	culture = german
	allow = {
				culture = german
				religion = catholic
	}
	title_prefix = "GRANDDUKE_OF"
	title = "GRANDDUKE"
}

Any ideas?
 
Seems that is the truth. That or PI changed the how to on it and told no one :p

Thanks though :)

Anyone know if AI republics can form titular kingdom titles? I know k_venice for example has the republic restriction built it, but I've yet to see a custom one form on its' own and I am unsure if there is something else I may need to do
 
Seems that is the truth. That or PI changed the how to on it and told no one :p

Thanks though :)

Anyone know if AI republics can form titular kingdom titles? I know k_venice for example has the republic restriction built it, but I've yet to see a custom one form on its' own and I am unsure if there is something else I may need to do
I believe the problem is that you are useing GRANDDUKE I think you still can only use king/duke etc. Because I have always had success modding it that way.
 
is there a scope for 'any barony' like - 'any_demesne_barony' or something along those lines?

There is any_province_lord (look in rebel_events.txt) and to give any of your baronies a building, I use this little number:

Code:
random_demesne_title = {
	limit = {
		location = {
			province_id = 157
		}
		tier = baron
		}
	add_building = ca_priory_cluniac_1
	add_building = ca_priory_santiago_1
	}