Good morning all. Today we bring another dev diary for the upcoming 1.23 Persia update and its accompanying expansion Cradle of Civilization. We've got a mixed bag of information and features to share with you so let's get to it!
Firstly, while we're still a while away from the release of 1.23 and Cradle of Civilization, we want to make it clear that this update will not be save game compatible. This is always an unfortunate development and where possible we try to keep our updates compatible with old save games, but for many reasons it has not been feasible to keep this update compatible with 1.22 and earlier savegames. What this means for you is that if you are currently knee-deep in a campaign then you will have to finish that campaign on the 1.22 Russia version. If you update to the 1.23 Persia version then you will not be able to continue that game.
Thankfully, we have a solution for people who want to continue their campaigns before updating to 1.23 when it is available. This link will show you how to revert to an earlier version, which will allow you to finish that run before embracing the new goodies with the Persia Update.
Again, this is something we try to avoid when making updates to our game, but in this case it was just not possible to maintain save game compatibility with all the changes we have made, some of which have yet to be announced.
Moving on from that, there are a couple of small additions to the game to talk about today: Startup Screen and Missionaries in Subjects.
As part of the free 1.23 Persia Update the game will now start with a Startup Screen detailing the situation of your country and the areas around it. It will help introduce the mechanics available to your nation and explain some of the more important nuances about the country.
Expansion-related features will also be detailed with its icon next to the text.
Major countries will have specialised startup text for them to set the scene of the nation you are playing. This can also be disabled/enabled from the options menu if you want to jump in blind or already know the ins and outs of your nation.
A feature that is part of the Cradle of Civilization expansion is the oft-requested ability to use Missionaries in Subjects. If your subject has lands that they consider to be not of their true faith, then you can use one of your own missionary envoys to help them spread their true faith. This missionary will use the overlord's conversion strength, but also have to tackle any malus from the subject's province, such as a difficult to convert religion or a provincial modifier.
You are able to toggle your subject's wrong-religion provinces in the Religion tab, and also send a missionary directly from the province screen. Note that this will spread your subject's religion rather than your own, so if your subject is a heathen, you will have to weigh up their own internal stability against the proliferation of an intolerable faith.
I'm now going to hand the rest of this dev diary over to @Groogy as we would also like to talk about support we have in store for the modding community in the 1.23 Persia Update. We pride ourselves on the work we do to keep accessibility for modding high and this update will be no exception. Take it away, Groogy!
=====================================
Hey everyone! During PdxCon I met with the awesome team from MEIOU&Taxes where they nearly drowned me with requests. Though thanks to that I did end up adding some cool new tools for our content designers to use, and of course by extension the modders.
Let’s start with the first big one. The Script Profiler.
With the next patch, together with your executable you normally use to play the game, we are adding an extra executable to be packaged with it for the modders called eu4_profiling. This version of the game has had extra code added to it that tracks how much time the CPU spends on each part of the script. It can track anything from events to missions. The reason it is a separate executable is because this extra code slows down the game a bit (though not by much). But even if it only slows down by that little we don’t want people playing the game to be affected. Otherwise the two versions of the game are identical. The profiling version is built and packaged automatically by our build system just like our normal releases so you can expect this to always be up to date with the latest version.
To start profiling as a modder all you have to do is navigate to where EU4 is installed, start the eu4_profiling executable and test the features you want or just play the game like normal. Then when you feel you have stress tested it enough open up the in-game console and type “dump_script_profiling”. This will prompt the game to flush all the data it has collected to profiling.log in your user directory. This is where you usually find the logs for everything else as well.
For some more technical stuff let’s explain some terms in this file. The file will consist of columns of various values that I will cover further down but most important is the hierarchy of nodes you can see on the left side. Highest up in the file you should see what effect or trigger root that took most time. But the nodes of the script under the root will be organized as they appear in the script and not which is the slowest. All so you can more easily find which “NOT” trigger of the 10 in your script caused that slowdown. The Root% and Parent% shows how much of its root node and the trigger/effect above it this part of the script took. This can show somewhat wonky numbers for recursive things like on_actions being triggered or scripted triggers/effects. The Others% will usually be when it is something outside of the script eating up CPU time, if this is lower than a 100%, it means something in the script seems to be taking time making this part of the script run slower potentially. The ‘hits’ column is how many times this part of the script was invoked, this can help you narrow down why “does this every_province take so long time to process?”
I have myself used this to profile our game when optimizing the game and I was pleasantly surprised with the amount of data it collects, and that it was capable of running from 1444 to 1821. That run ended up telling me that our missions are super freaking expensive…. More on that later though
Next up is a rework of Scripted Triggers and Effects that I call Meta Scripts.
Long story short, scripted triggers and effects now support arguments. Whatever provided to the argument list will be pasted in to where it can find the corresponding key in the script. Note that this is done during loading time and you are technically just copy-pasting around text so you can’t actually transfer values. If you somehow accidentally write something invalid that doesn’t work, check the error.log, you should get a message telling you how the script looks when expanded with the given values and where it goes wrong.
And here’s an example of @Trin Tragula 's usage of this new feature.
Here's a simpler example of something he also used it for:
What this does is simply allowing you to easily add an opinion both ways in an event like this:
I understand some of these concepts might feel quite alien to non-programmers reading this but don’t worry: @Trin Tragula and I will be in the thread and answer any questions you have.
And here are some other super cool niceties we’ve managed to squeeze in that we want to highlight.
There are still some more pretty cool features I would love to add eventually but sadly there’s only twenty four hours in a day. Among these, and don’t take this as a promise of it coming, would be triggered province modifiers to ease MEIOU&Taxes insane custom made mapmode and conditional execution in the Meta scripts letting you make a lot smarter triggers/effects.
Last but not least, a little changelog of what has been added for you to scour through.
Firstly, while we're still a while away from the release of 1.23 and Cradle of Civilization, we want to make it clear that this update will not be save game compatible. This is always an unfortunate development and where possible we try to keep our updates compatible with old save games, but for many reasons it has not been feasible to keep this update compatible with 1.22 and earlier savegames. What this means for you is that if you are currently knee-deep in a campaign then you will have to finish that campaign on the 1.22 Russia version. If you update to the 1.23 Persia version then you will not be able to continue that game.
Thankfully, we have a solution for people who want to continue their campaigns before updating to 1.23 when it is available. This link will show you how to revert to an earlier version, which will allow you to finish that run before embracing the new goodies with the Persia Update.
Again, this is something we try to avoid when making updates to our game, but in this case it was just not possible to maintain save game compatibility with all the changes we have made, some of which have yet to be announced.
Moving on from that, there are a couple of small additions to the game to talk about today: Startup Screen and Missionaries in Subjects.
As part of the free 1.23 Persia Update the game will now start with a Startup Screen detailing the situation of your country and the areas around it. It will help introduce the mechanics available to your nation and explain some of the more important nuances about the country.
Expansion-related features will also be detailed with its icon next to the text.
Major countries will have specialised startup text for them to set the scene of the nation you are playing. This can also be disabled/enabled from the options menu if you want to jump in blind or already know the ins and outs of your nation.
A feature that is part of the Cradle of Civilization expansion is the oft-requested ability to use Missionaries in Subjects. If your subject has lands that they consider to be not of their true faith, then you can use one of your own missionary envoys to help them spread their true faith. This missionary will use the overlord's conversion strength, but also have to tackle any malus from the subject's province, such as a difficult to convert religion or a provincial modifier.
You are able to toggle your subject's wrong-religion provinces in the Religion tab, and also send a missionary directly from the province screen. Note that this will spread your subject's religion rather than your own, so if your subject is a heathen, you will have to weigh up their own internal stability against the proliferation of an intolerable faith.
I'm now going to hand the rest of this dev diary over to @Groogy as we would also like to talk about support we have in store for the modding community in the 1.23 Persia Update. We pride ourselves on the work we do to keep accessibility for modding high and this update will be no exception. Take it away, Groogy!
=====================================
Hey everyone! During PdxCon I met with the awesome team from MEIOU&Taxes where they nearly drowned me with requests. Though thanks to that I did end up adding some cool new tools for our content designers to use, and of course by extension the modders.
Let’s start with the first big one. The Script Profiler.
With the next patch, together with your executable you normally use to play the game, we are adding an extra executable to be packaged with it for the modders called eu4_profiling. This version of the game has had extra code added to it that tracks how much time the CPU spends on each part of the script. It can track anything from events to missions. The reason it is a separate executable is because this extra code slows down the game a bit (though not by much). But even if it only slows down by that little we don’t want people playing the game to be affected. Otherwise the two versions of the game are identical. The profiling version is built and packaged automatically by our build system just like our normal releases so you can expect this to always be up to date with the latest version.
To start profiling as a modder all you have to do is navigate to where EU4 is installed, start the eu4_profiling executable and test the features you want or just play the game like normal. Then when you feel you have stress tested it enough open up the in-game console and type “dump_script_profiling”. This will prompt the game to flush all the data it has collected to profiling.log in your user directory. This is where you usually find the logs for everything else as well.
For some more technical stuff let’s explain some terms in this file. The file will consist of columns of various values that I will cover further down but most important is the hierarchy of nodes you can see on the left side. Highest up in the file you should see what effect or trigger root that took most time. But the nodes of the script under the root will be organized as they appear in the script and not which is the slowest. All so you can more easily find which “NOT” trigger of the 10 in your script caused that slowdown. The Root% and Parent% shows how much of its root node and the trigger/effect above it this part of the script took. This can show somewhat wonky numbers for recursive things like on_actions being triggered or scripted triggers/effects. The Others% will usually be when it is something outside of the script eating up CPU time, if this is lower than a 100%, it means something in the script seems to be taking time making this part of the script run slower potentially. The ‘hits’ column is how many times this part of the script was invoked, this can help you narrow down why “does this every_province take so long time to process?”
I have myself used this to profile our game when optimizing the game and I was pleasantly surprised with the amount of data it collects, and that it was capable of running from 1444 to 1821. That run ended up telling me that our missions are super freaking expensive…. More on that later though
Next up is a rework of Scripted Triggers and Effects that I call Meta Scripts.
Code:
my_test_trigger = {
OR = {
has_country_modifier = $arg1$_modifier
AND = {
has_country_modifier = $arg2$_modifier
$context$ = {
NOT = { has_country_modifier = $arg1$_modifier }
}
}
}
}
my_test_trigger = { arg1=foo arg2=bar context=FROM }
Long story short, scripted triggers and effects now support arguments. Whatever provided to the argument list will be pasted in to where it can find the corresponding key in the script. Note that this is done during loading time and you are technically just copy-pasting around text so you can’t actually transfer values. If you somehow accidentally write something invalid that doesn’t work, check the error.log, you should get a message telling you how the script looks when expanded with the given values and where it goes wrong.
And here’s an example of @Trin Tragula 's usage of this new feature.
Code:
Trin Tragula:
This is a (somewhat shortened and still WIP) example of how we will now be randomizing the religions for advisors granted through old and new events:
# Death of a Merchant
country_event = {
id = 736
title = "EVTNAME736"
desc = "EVTDESC736"
picture = MERCHANTS_TALKING_eventPicture
is_triggered_only = yes
trigger = {
always = yes
}
mean_time_to_happen = {
days = 1
}
immediate = {
check_if_non_state_advisor_effect = { #Hidden scripted effect, is used by scripted effect and must always be cleared in after = { } using erase_advisor_flags_effect.
chance_of_primary = 75 #Not percentages!
chance_of_tertiary = 10
chance_of_secondary = 25
}
hidden_effect = {
random_list = {
33 = { set_country_flag = theologian_flag }
33 = { set_country_flag = artist_flag }
33 = { set_country_flag = philosopher_flag }
}
}
}
option = {
name = "EVTOPTA736"
ai_chance = {
factor = 50
}
add_years_of_income = 0.25
}
option = {
name = "EVTOPTB736"
ai_chance = {
factor = 50
}
add_meritocracy_effect = yes
trigger_switch = {
on_trigger = has_country_flag
theologian_flag = {
generate_advisor_of_type_and_semi_random_religion_effect = {
advisor_type=theologian
advisor_type_if_not_state=natural_scientist
skill=1
scaled_skill = no
discount=yes
}
}
artist_flag = {
generate_advisor_of_type_and_semi_random_religion_effect = {
advisor_type=artist
advisor_type_if_not_state=artist
scaled_skill = no
skill=1
discount=yes
}
}
philosopher_flag = {
generate_advisor_of_type_and_semi_random_religion_effect = {
advisor_type=philosopher
advisor_type_if_not_state=philosopher
skill=1
scaled_skill = no
discount=yes
}
}
}
add_prestige = 15
}
}
So first we use a scripted effect called check_if_non_state_advisor_effect which sets the chances for a minority religion popping up, and specifies which ones. The reason we do this in immediate and not all in the optionbutton effect is that we want the advisor to be displayed in the tooltip when you pick him :)
What this scripted effect does with those chances depends on where in the world you are playing so I will just show the relevant part here for someone playing as Poland.
check_if_non_state_advisor_effect = {
#Needs these arguments:
#chance_of_primary = State religion
#chance_of_secondary =
#chance_of_tertiary = Remaining Heathen Religions
#Note: These are not actual chances, they are just weights, the script then uses them differently depending on what region you are in. There is a higher or lower chance of variety depending on where minorities where big historically.
hidden_effect = { #Variety - Religious Minorities
if = {
limit = {
#Lots of WIP stuff here
}
random_list = {
$chance_of_secondary$ = { set_country_flag = jewish_advisor }
$chance_of_primary$ = { set_country_flag = state_religion_advisor }
$chance_of_secondary$ = { set_country_flag = protestant_or_coptic_advisor }
$chance_of_secondary$ = { set_country_flag = reformed_or_orthodox_advisor }
$chance_of_tertiary$ = { set_country_flag = heathen_advisor }
}
}
#else_if
#else_if
#Lots of other places in the world will use these chances for other things
}
}
Now that a flag has been set in the immediate, the game will use the scripted generate_advisor_of_type_and_semi_random_religion_effect effect to actually generate the advisor, this one is actually in two steps:
generate_advisor_of_type_and_semi_random_religion_effect = {
#Actual work is done by internal_advisor_generation_effect above but it goes through this first.
#Requires check_if_non_state_advisor_effect in immediate.
#$advisor_type$ = Advisor type if state religion.
#$advisor_type_if_not_state$ = Advisor type if non-state religion.
#$scaled_skill$ = yes/no
#$skill$ = Skill Level
#$discount$ = yes/no for discount
set_country_flag = $scaled_skill$_scaled_skill_flag #Must be cleared in this effect, or we won't find it again.
if = { #If scaled skill is yes we continue after checking what level is apropriate
limit = { has_country_flag = yes_scaled_skill_flag }
if = {
limit = {
NOT = { monthly_income = 15 }
}
internal_advisor_generation_effect = {
advisor_type = $advisor_type$
advisor_type_if_not_state = $advisor_type_if_not_state$
skill = 1
discount = $discount$
}
}
else_if = {
limit = {
NOT = { monthly_income = 25 }
}
internal_advisor_generation_effect = {
advisor_type = $advisor_type$
advisor_type_if_not_state = $advisor_type_if_not_state$
skill = 2
discount = $discount$
}
}
else = {
internal_advisor_generation_effect = {
advisor_type = $advisor_type$
advisor_type_if_not_state = $advisor_type_if_not_state$
skill = 3
discount = $discount$
}
}
}
else = { #If we didn't set scaled skill to yes then we just take the skill you specified.
internal_advisor_generation_effect = {
advisor_type = $advisor_type$
advisor_type_if_not_state = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
}
}
clr_country_flag = $scaled_skill$_scaled_skill_flag #Important, unless cleared like this you will be unable to find it again.
}
This then sends the arguments provided by the event onwards to the scripted effect internal_advisor_generation_effect together with either a decided scaled skill or one provided by the event where generate_advisor_of_type_and_semi_random_religion_effect was used.
internal_advisor_generation_effect = { #Only used within generate_advisor_of_type_and_semi_random_religion_effect
#Requires check_if_non_state_advisor_effect in immediate as that gives the arguments to generate_advisor_of_type_and_semi_random_religion_effect that then passes it on to this.
#$advisor_type$ = Advisor type if state religion.
#$advisor_type_if_not_state$ = Advisor type if non-state religion.
#$skill$ = Skill Level
#$discount$ = yes/no for discount
trigger_switch = {
on_trigger = has_country_flag #Flags set by check_if_non_state_advisor_effect
state_religion_advisor = {
define_advisor = {
type = $advisor_type$
skill = $skill$
discount = $discount$
}
}
jewish_advisor = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = jewish
}
}
protestant_or_coptic_advisor = {
if = {
limit = {
OR = {
religion = catholic
religion = reformed
}
is_religion_enabled = protestant
}
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = protestant
}
}
else_if = {
limit = {
religion = catholic
NOT = { is_religion_enabled = protestant }
}
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = orthodox
}
}
else_if = {
limit = {
religion = protestant
}
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = catholic
}
}
else_if = {
limit = {
religion = orthodox
}
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = coptic
}
}
else_if = {
limit = {
religion = coptic
}
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = jewish
}
}
else = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
}
}
}
reformed_or_orthodox_advisor = {
if = {
limit = {
OR = {
religion = catholic
religion = protestant
}
is_religion_enabled = reformed
}
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = reformed
}
}
else_if = {
limit = {
religion = catholic
NOT = { is_religion_enabled = reformed }
}
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = orthodox
}
}
else_if = {
limit = {
religion = reformed
}
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = catholic
}
}
else_if = {
limit = {
religion = orthodox
}
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = coptic
}
}
else_if = {
limit = {
religion = coptic
}
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = orthodox
}
}
else = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
}
}
}
heathen_advisor = {
if = {
limit = {
religion_group = christian
capital_scope = { continent = europe }
}
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = jewish
}
}
else_if = {
limit = {
religion_group = christian
capital_scope = { continent = asia }
}
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = sunni
}
}
else_if = {
limit = {
religion_group = christian
capital_scope = { continent = africa }
}
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = sunni
}
}
else_if = {
limit = {
religion_group = muslim
continent = europe
}
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = catholic
}
}
else_if = {
limit = {
religion_group = muslim
}
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = coptic
}
}
else_if = {
limit = {
religion_group = eastern #Most likely won't come here but could.
}
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = animism
}
}
else_if = {
limit = {
religion_group = dharmic #Most likely won't come here but could.
}
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = animism
}
}
else_if = {
limit = {
religion_group = dharmic #Most likely won't come here but could.
}
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = animism
}
}
else = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
}
}
}
heathen_advisor = {
if = {
limit = { religion_group = christian }
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = sunni
}
}
else_if = {
limit = {
religion_group = muslim
capital_scope = {
OR = {
superregion = near_east_superregion
continent = europe
region = horn_of_africa_region
}
}
}
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = catholic
}
}
else_if = {
limit = { religion_group = muslim }
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = zoroastrian
}
}
else_if = {
limit = { religion_group = dharmic }
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
religion = shiite
culture = persian
}
}
else = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
}
}
}
zoroastrian_advisor = {
if = {
limit = { NOT = { religion = zoroastrian } }
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = zoroastrian
discount = $discount$
}
}
else = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = hinduism
discount = $discount$
}
}
}
sikh_advisor = {
if = {
limit = { religion = sikhism }
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = hinduism
discount = $discount$
}
}
else_if = {
limit = { is_religion_enabled = sikhism }
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = sikhism
discount = $discount$
}
}
else_if = {
limit = { religion = hinduism }
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = zoroastrian
discount = $discount$
}
}
else_if = {
limit = { religion_group = muslim }
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = hinduism
discount = $discount$
}
}
else = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
}
}
}
confucian_advisor = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = confucianism
discount = $discount$
}
}
shinto_advisor = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = shinto
discount = $discount$
}
}
theravada_advisor = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = buddhism
discount = $discount$
}
}
mahayana_advisor = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = mahayana
discount = $discount$
}
}
vajrayana_advisor = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = vajrayana
discount = $discount$
}
}
catholic_advisor = {
if = {
limit = {
any_province = {
religion = catholic
has_discovered = ROOT
}
}
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = catholic
discount = $discount$
}
}
else = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
discount = $discount$
}
}
}
hinduism_advisor = {
if = {
limit = { NOT = { religion = hinduism } }
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = hinduism
discount = $discount$
}
}
else = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = sunni
discount = $discount$
}
}
}
ibadi_advisor = {
if = {
limit = { NOT = { religion = ibadi } }
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = ibadi
discount = $discount$
}
}
else = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = shiite
discount = $discount$
}
}
}
shia_advisor = {
if = {
limit = { NOT = { religion = shiite } }
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = shiite
discount = $discount$
}
}
else = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = ibadi
discount = $discount$
}
}
}
sunni_advisor = {
if = {
limit = { NOT = { religion = sunni } }
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = sunni
discount = $discount$
}
}
else = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = shiite
discount = $discount$
}
}
}
coptic_advisor = {
if = {
limit = { NOT = { religion = coptic } }
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = coptic
discount = $discount$
}
}
else = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = jewish
discount = $discount$
}
}
}
norse_advisor = {
if = {
limit = { NOT = { religion = norse_pagan_reformed } }
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = norse_pagan_reformed
discount = $discount$
}
}
else = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = totemism
discount = $discount$
}
}
}
animism_advisor = {
if = {
limit = { NOT = { religion = animism } }
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = animism
discount = $discount$
}
}
else = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = totemism
discount = $discount$
}
}
}
totemism_advisor = {
if = {
limit = { NOT = { religion = totemism } }
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = totemism
discount = $discount$
}
}
else = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = animism
discount = $discount$
}
}
}
mayan_advisor = {
if = {
limit = { NOT = { religion = mesoamerican_religion } }
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = mesoamerican_religion
discount = $discount$
}
}
else = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = nahuatl
discount = $discount$
}
}
}
nahuatl_advisor = {
if = {
limit = { NOT = { religion = nahuatl } }
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = nahuatl
discount = $discount$
}
}
else = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = mesoamerican_religion
discount = $discount$
}
}
}
inca_advisor = {
if = {
limit = { NOT = { religion = inti } }
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = inti
discount = $discount$
}
}
else = {
define_advisor = {
type = $advisor_type_if_not_state$
skill = $skill$
religion = animism
discount = $discount$
}
}
}
}
}
This effect actually creates an advisor (and it is this advisor that is shown in the tooltip on the event option button.
Last of all I use the after effect to clear the flags set by the check_if_non_state_advisor_effect
erase_advisor_flags_effect = { #Goes into the after = {} effect after check_if_non_state_advisor_effect
trigger_switch = {
on_trigger = has_country_flag
state_religion_advisor = { clr_country_flag = state_religion_advisor }
jewish_advisor = { clr_country_flag = jewish_advisor }
protestant_or_coptic_advisor = { clr_country_flag = protestant_or_coptic_advisor }
reformed_or_orthodox_advisor = { clr_country_flag = reformed_or_orthodox_advisor }
heathen_advisor = { clr_country_flag = heathen_advisor }
zoroastrian_advisor = { clr_country_flag = zoroastrian_advisor }
sikh_advisor = { clr_country_flag = sikh_advisor }
confucian_advisor = { clr_country_flag = confucian_advisor }
shinto_advisor = { clr_country_flag = shinto_advisor }
theravada_advisor = { clr_country_flag = theravada_advisor }
mahayana_advisor = { clr_country_flag = mahayana_advisor }
vajrayana_advisor = { clr_country_flag = vajrayana_advisor }
catholic_advisor = { clr_country_flag = catholic_advisor }
hinduism_advisor = { clr_country_flag = hinduism_advisor }
ibadi_advisor = { clr_country_flag = ibadi_advisor }
shia_advisor = { clr_country_flag = shia_advisor }
sunni_advisor = { clr_country_flag = sunni_advisor }
coptic_advisor = { clr_country_flag = coptic_advisor }
norse_advisor = { clr_country_flag = norse_advisor }
animism_advisor = { clr_country_flag = animism_advisor }
totemism_advisor = { clr_country_flag = totemism_advisor }
inca_advisor = { clr_country_flag = inca_advisor }
nahuatl_advisor = { clr_country_flag = nahuatl_advisor }
mayan_advisor = { clr_country_flag = mayan_advisor }
}
}
Here's a simpler example of something he also used it for:
Code:
add_mutual_opinion_modifier_effect = {
add_opinion = {
who = $scope_country$
modifier = $opinion_modifier$
}
reverse_add_opinion = {
who = $scope_country$
modifier = $opinion_modifier$
}
}
Code:
add_mutual_opinion_modifier_effect = {
scope_country = ROOT
modifier = converted_to_islam
}
And here are some other super cool niceties we’ve managed to squeeze in that we want to highlight.
- Missions can now be scripted to target specific provinces for performance boost. Added lists are target_provinces_list, target_areas_list, target_colonial_region_list, target_trade_company_list, target_trade_node_list.
- export_to_variable now supports "value = trigger_value:[trigger_name]" to extract the limit value for a trigger. This works with all triggers of the form "[trigger_name] = [value]", where [value] is an integer, a decimal value or "yes"/"no". Caution: If the trigger evaluates as true for all values (or no values), the extracted value will be 2147483 (or -2147483).
- Added support for "else_if" and "else". If one of these is placed after an "if" or "else_if", it will be executed if the "if"/"else_if" limit returns false. Example:
if = { limit = { something = yes } do_something = yes }
else_if = { limit = { something_else = yes } do_something_else = yes }
else = { do_another_thing = yes }
The old method of nested else still works as well. - Centers of Reformations are a lot more moddable now.
- Added so you can hook in script to run when a building gets built, made obsolete or destroyed.
- Country modifier that is unit-specific so that it only applies to janissary units (kind of experimental, might be extended on later)
- We have added "Event Scope Value" which is currently only used in a few triggers and effects, but should be expanded to more in the future. It supports fancy stuff like "something = variable:FROM: previously_saved_variable" and "something_else = new_variable:ROOT:num_of_rebel_armies" (which gets the value that a new export_to_variable would get). Event scope values are supported by: All religion and culture entries; location in define_advisor_effect; all entries in is_in_war that refer to a country or a province.
There are still some more pretty cool features I would love to add eventually but sadly there’s only twenty four hours in a day. Among these, and don’t take this as a promise of it coming, would be triggered province modifiers to ease MEIOU&Taxes insane custom made mapmode and conditional execution in the Meta scripts letting you make a lot smarter triggers/effects.
Last but not least, a little changelog of what has been added for you to scour through.
- years_under_vassalage trigger now supports "all_subject_country = yes" to not limit for certain subject types.
- Advisor portraits now look for "GFX_advisor_[culture_group]_[...]" before the 'GfxCulture' sprite.
- Building AI now done entirely in code. Script can still modify/override the result though. See 00_buildings.txt.
- For custom subject types with has_overlords_ruler, can_be_integrated now also determines whether spontaneous inheritance can happen.
- Added set_saved_name feature. Supprts "type = simple name = Paradox" and "type = advisor scope = FROM". Should be coupled with clear_saved_name.
- Saved Names can be accessed in localization through "[Scope.key.GetName]"
- Saved Names can be used for defining rulers, heirs, consorts, leaders, advisors and rebel leaders.
- Effects for creating rulers, heirs and consorts now support "hide_skills = yes" (same as "hidden = yes") for heirs.
- define_advisor effect now supports "location = *scope*"
- Added export_to_variable for ruler_culture, heir_culture, consort_culture, adm_advisor_culture, dip_advisor_culture, mil_advisor_culture. They will get the index of the character's religion, so can be compared to each other. The culture name can also be accessed with [Root.variable.GetCultureName] syntax.
- Added exactly same system as explained above but for religion.
- Also added export_to_variable for primary_culture, dominant_culture, religion, dominant_religion and secondary_religion for country scopes; and culture, and religion for province scopes.
- All culture and religion triggers and effects of the form "x = y" now support "variable:variable_name" (as well as scopes) as y. Triggers and effects for culture and religion groups work similarly, and implicitly take the group of the culture with the given index.
- variable_arithmetic_trigger and ai_acceptance entries will now set all export_to_variable to their original value before generating the tooltip.
- Triggers and effects that support "variable:" syntax now also support "variable:FROM:" etc.
- Modifier descriptions now support localization of the [Scope. ...] form.
- is_in_war trigger now supports scopes for defenders, attackers, participants, and war_goal_province.
- events now support "after = {}", similar to "immediate = {}" but is executed after any event option.
- Triggers and effects supporting "variable:" syntax now also support "new_variable:" syntax, calculating the would-be value if the following string was exported from. Doesn't work for the more advanced exports.
- Localization keys now also support [Root.variable_name.GetCultureGroupName] and [Root.variable_name.GetReligionGroupName] syntax.
- spawn_rebels effect now supports specifying what religion/culture they will get.
- export_to_variable now supports "value = trigger_value:[trigger_name]" to extract the limit value for a trigger. This works with all triggers of the form "[trigger_name] = [value]", where [value] is an integer, a decimal value or "yes"/"no". Caution: If the trigger evaluates as true for all values (or no values), the extracted value will be 2147483 (or -2147483).
- Added on_build effect for buildings
- Added on_destroy effect for buildings
- Added on_obsolete effect for buildings
- Added on actions for on_leader_recruited, on_general_recruited, on_admiral_recruited, on_conquistador_recruited, on_explorer_recruited
- Added support for "else_if" and "else". If one of these is placed after an "if" or "else_if", it will be executed if the "if"/"else_if" limit returns false. Example:
if = { limit = { something = yes } do_something = yes }
else_if = { limit = { something_else = yes } do_something_else = yes }
else = { do_another_thing = yes }
"else" inside an "if" still works as before, so as to not break existing script*
- Added new country trigger 'heir_culture = x', where x is culture, province, tag or rebel.
- Added new country trigger 'consort_culture = x', where x is culture, province, tag or rebel.
- Added new country trigger 'ruler_culture = x', where x is culture, province, tag or rebel.
- Added new country trigger 'heir_religion = x', where x is religion, province, tag or rebel.
- Added new country trigger 'consort_religion = x', where x is religion, province, tag or rebel.
- Added new country trigger 'ruler_religion = x', where x is religion, province, tag or rebel.
- Added new country effect 'set_heir_culture = x' , where x is culture, province, tag or rebel.
- Added new country effect 'set_consort_culture = x' , where x is culture, province, tag or rebel.
- Added new country effect 'set_ruler_culture = x' , where x is culture, province, tag or rebel.
- Added new country effect 'set_heir_religion = x' , where x is religion, province, tag or rebel.
- Added new country effect 'set_consort_religion = x' , where x is religion, province, tag or rebel.
- Added new country effect 'set_ruler_religion = x' , where x is religion, province, tag or rebel.
- Added trigger current_institution_growth.
- Advisor portraits now look for "GFX_advisor_[culture_group]_[...]" before the 'GfxCulture' sprite.
- Building AI now done entirely in code. Script can still modify/override the result though. See 00_buildings.txt.
- For custom subject types with has_overlords_ruler, can_be_integrated now also determines whether spontaneous inheritance can happen.
- Added set_saved_name feature. Supprts "type = simple name = Paradox" and "type = advisor scope = FROM". Should be coupled with clear_saved_name.
- Saved Names can be accessed in localization through "[Scope.key.GetName]"
- Saved Names can be used for defining rulers, heirs, consorts, leaders, advisors and rebel leaders.
- Effects for creating rulers, heirs and consorts now support "hide_skills = yes" (same as "hidden = yes") for heirs.
- define_advisor effect now supports "location = *scope*"
- Added export_to_variable for ruler_culture, heir_culture, consort_culture, adm_advisor_culture, dip_advisor_culture, mil_advisor_culture. They will get the index of the character's religion, so can be compared to each other. The culture name can also be accessed with [Root.variable.GetCultureName] syntax.
- Added exactly same system as explained above but for religion.
- Also added export_to_variable for primary_culture, dominant_culture, religion, dominant_religion and secondary_religion for country scopes; and culture, and religion for province scopes.
- All culture and religion triggers and effects of the form "x = y" now support "variable:variable_name" (as well as scopes) as y. Triggers and effects for culture and religion groups work similarly, and implicitly take the group of the culture with the given index.
- variable_arithmetic_trigger and ai_acceptance entries will now set all export_to_variable to their original value before generating the tooltip.
- Triggers and effects that support "variable:" syntax now also support "variable:FROM:" etc.
- Modifier descriptions now support localization of the [Scope. ...] form.
- is_in_war trigger now supports scopes for defenders, attackers, participants, and war_goal_province.
- events now support "after = {}", similar to "immediate = {}" but is executed after any event option.
- Triggers and effects supporting "variable:" syntax now also support "new_variable:" syntax, calculating the would-be value if the following string was exported from. Doesn't work for the more advanced exports.
- Localization keys now also support [Root.variable_name.GetCultureGroupName] and [Root.variable_name.GetReligionGroupName] syntax.
- spawn_rebels effect now supports specifying what religion/culture they will get.
- export_to_variable now supports "value = trigger_value:[trigger_name]" to extract the limit value for a trigger. This works with all triggers of the form "[trigger_name] = [value]", where [value] is an integer, a decimal value or "yes"/"no". Caution: If the trigger evaluates as true for all values (or no values), the extracted value will be 2147483 (or -2147483).
- Added on_build effect for buildings
- Added on_destroy effect for buildings
- Added on_obsolete effect for buildings
- Added on actions for on_leader_recruited, on_general_recruited, on_admiral_recruited, on_conquistador_recruited, on_explorer_recruited
- Added support for "else_if" and "else". If one of these is placed after an "if" or "else_if", it will be executed if the "if"/"else_if" limit returns false. Example:
if = { limit = { something = yes } do_something = yes }
else_if = { limit = { something_else = yes } do_something_else = yes }
else = { do_another_thing = yes }
"else" inside an "if" still works as before, so as to not break existing script*
- Added new country trigger 'heir_culture = x', where x is culture, province, tag or rebel.
- Added new country trigger 'consort_culture = x', where x is culture, province, tag or rebel.
- Added new country trigger 'ruler_culture = x', where x is culture, province, tag or rebel.
- Added new country trigger 'heir_religion = x', where x is religion, province, tag or rebel.
- Added new country trigger 'consort_religion = x', where x is religion, province, tag or rebel.
- Added new country trigger 'ruler_religion = x', where x is religion, province, tag or rebel.
- Added new country effect 'set_heir_culture = x' , where x is culture, province, tag or rebel.
- Added new country effect 'set_consort_culture = x' , where x is culture, province, tag or rebel.
- Added new country effect 'set_ruler_culture = x' , where x is culture, province, tag or rebel.
- Added new country effect 'set_heir_religion = x' , where x is religion, province, tag or rebel.
- Added new country effect 'set_consort_religion = x' , where x is religion, province, tag or rebel.
- Added new country effect 'set_ruler_religion = x' , where x is religion, province, tag or rebel.
- Added trigger current_institution_growth.