





🌟 Special thanks to our amazing supporters:
✨ $10 Tier: [Geeks Love Detail]
🌈 $5 Tier: [Benedikt][David Martínez Martí]
Hello everyone and welcome to this Development Diary! For those that don’t know me, I am Trin Tragula, Content Designer of Europa Universalis, and today I will be the one writing the Tuesday Development Diary. As a Content Designer I am the one who plans and writes the events, decisions, maps, and similar things for the game. The subject of this diary will be the added content in the 1.21 “Hungary” Patch.
variable_arithmetic_trigger = {
custom_tooltip = HAS_HALF_THEIR_MANPOWER
export_to_variable = {
variable_name = my_manpower
value = manpower
}
export_to_variable = {
variable_name = their_manpower
value = manpower
who = FROM
}
multiply_variable = {
which = my_manpower
value = 2
}
check_variable = {
which = my_manpower
value = their_manpower
}
}
One of the smart things with this design is that you can create conditional statements by utilizing the fact that AND and OR triggers stop evaluation when one child returns false and true, respectively. Check the following, more advanced, example:
variable_arithmetic_trigger = {
custom_tooltip = HAS_MORE_MANPOWER_OR_HALF_IF_CATHOLIC
export_to_variable = {
variable_name = my_manpower
value = manpower
}
export_to_variable = {
variable_name = their_manpower
value = manpower
who = FROM
}
OR =
{
NOT = { religion = catholic }
variable_arithmetic_trigger =
{
multiply_variable = {
which = my_manpower
value = 2
}
always = yes # This line is superfluous
}
}
check_variable = {
which = my_manpower
value = their_manpower
}
}
In pseudo code, this is equivalent to:
float my_manpower = GetManpower(THIS)
float their_manpower = GetManpower(FROM)
if religion == catholic
My_manpower *= 2
Return my_manpower >= their_manpower
Although the syntax is horrible, this can be nested as much as you want to create really complicated logical conditions. It should be noted that variables are performance heavy, especially the export_to_variable, although that has been significantly improved in 1.20 and 1.21.
Scriptable Subject Types
Some modders may have noticed in 1.20 that we moved most of the differences between subject types to a script file. As of 1.21, entirely new subject types can be added just by adding entries in common/subject_types. The old subject types are still referred to in the code however, and can’t be removed. Just adding them there won’t make them visible in the game however. For that I added scriptable diplomatic actions.
Scriptable Diplomatic Action
In 1.21 you will be able to see a new folder in common called new_diplomatic_actions. This system is currently independent of what happens in diplomatic_actions, and they can’t be combined. One diplomatic action has been added there, and it might be easiest to learn how it works by checking that example, which asks someone to become your Dummy. Two things should be noted though. First, the AI will as it is never send these actions. I’m thinking of a way to make that work for a future patch. Second there is an entry called ai_acceptance. This is how it works:
dummy =
{
copy_from = default
}
In new_diplomatic_actions, this:
demand_dummy = {
category = influence
alert_index = 40
alert_tooltip = demand_dummy_alert_tooltip
require_acceptance = yes # Whether the recipient gets an option to decline
is_visible = {
religion_group = christian
is_subject = no
FROM = {
is_subject = no
}
}
is_allowed = {
variable_arithmetic_trigger = {
custom_tooltip = HAS_MORE_MANPOWER
export_to_variable = {
variable_name = my_manpower
value = manpower
}
export_to_variable = {
variable_name = their_manpower
value = manpower
who = FROM
}
subtract_variable = {
which = my_manpower
which = their_manpower
}
check_variable = {
which = my_manpower
value = 0
}
}
religion = catholic
}
on_accept = {
add_trust = {
who = FROM
value = 20
mutual = yes
}
create_subject = {
subject_type = dummy
subject = FROM
}
}
on_decline =
{
add_trust = {
who = FROM
value = -100
mutual = no
}
}
ai_acceptance = {
add_entry = {
name = ALWAYS_TEN
export_to_variable = {
variable_name = ai_value # Mandatory to use this name
value = 10
}
}
add_entry = {
name = OPINION
export_to_variable = {
variable_name = ai_value
#value = opinion who = FROM with = THIS # This is supposed to work in the future
value = 10 # Temporary value until then
}
divide_variable = {
which = ai_value
value = 4
}
}
}
}
The result looks like this (I didn’t bother localizing ALWAYS_TEN):
- Added new country modifier 'sailor_maintenance_modifer'
- Added defines BANKRUPTCY_BUILDING_DESTRUCTION_THRESHOLD, BANKRUPTCY_PROVINCE_DEVASTATION_GAIN.
- Added the attribute "indestructible" to buildings, setting it to yes will exempt that type of building from being destroyed by bankruptcy.
- Added add_adm_tech, add_dip_tech, add_mil_tech effects.
- Added revanchism trigger.
- Added log effect and trigger.
- Added add_active_policy and had_active_policy effect and trigger.
- Added scripted function can_declare_bankruptcy.
- Added scripted function can_colonize_province.
- Added add_next_institution_embracement = province effect.
Have fun!
That was all for today about the Hungary patch and the content related to to Hungary and its European surroundings. Next Tuesday we will be sharing the complete changelist for the upcoming patch, which will be released in late april.
Read the original post
[quote]Useful links
Official Website
Europa Universalis IV Wiki
Europa Universalis IV Development Diary Archive[ 6277 ]
[ 2274 ]
[ 1932 ]