You are on page 1of 18

#Education events for children

namespace = childhood_education

####################################################################

#0002: Acquire education points


#9001: Assign education focus
#9100: Remove guardian opinions when guardian/ward relation ends

###################################################################

#Notification event for educator about child switching focus


childhood_education.0004 = {
type = character_event
title = childhood_education.0004.t
desc = {
desc = childhood_education.0004.opening
first_valid = {
triggered_desc = {
trigger= {
has_character_flag = matching_education
}
desc = childhood_education.0004.desc1
}
triggered_desc = {
trigger= {
has_character_flag = previously_matching_education
}
desc = childhood_education.0004.desc2
}
desc = childhood_education.0004.desc_fallback
}
}
theme = education
left_portrait = scope:ward

immediate = {
random_relation = {
type = ward
save_scope_as = ward
}
if = {
limit = {
OR = {
has_education_diplomacy_trigger = yes
has_focus_diplomacy = yes
diplomacy >= high_skill_rating
}
scope:ward = {
has_focus = education_diplomacy
}
}
add_character_flag = matching_education
}
else_if = {
limit = {
OR = {
has_education_martial_trigger = yes
has_focus_martial = yes
martial >= high_skill_rating
}
scope:ward = {
has_focus = education_martial
}
}
add_character_flag = matching_education
}
else_if = {
limit = {
OR = {
has_education_stewardship_trigger = yes
has_focus_stewardship = yes
stewardship >= high_skill_rating
}
scope:ward = {
has_focus = education_stewardship
}
}
add_character_flag = matching_education
}
else_if = {
limit = {
OR = {
has_education_intrigue_trigger = yes
has_focus_intrigue = yes
intrigue >= high_skill_rating
}
scope:ward = {
has_focus = education_intrigue
}
}
add_character_flag = matching_education
}
else_if = {
limit = {
OR = {
has_education_learning_trigger = yes
has_focus_learning = yes
learning >= high_skill_rating
}
scope:ward = {
has_focus = education_learning
}
}
add_character_flag = matching_education
}
if = {
limit = {
OR = {
has_education_diplomacy_trigger = yes
has_focus_diplomacy = yes
diplomacy >= high_skill_rating
}
scope:ward = {
has_character_flag = diplomacy_previous_education
}
}
add_character_flag = previously_matching_education
}
else_if = {
limit = {
OR = {
has_education_martial_trigger = yes
has_focus_martial = yes
martial >= high_skill_rating
}
scope:ward = {
has_character_flag = martial_previous_education
}
}
add_character_flag = previously_matching_education
}
else_if = {
limit = {
OR = {
has_education_stewardship_trigger = yes
has_focus_stewardship = yes
stewardship >= high_skill_rating
}
scope:ward = {
has_character_flag = stewardship_previous_education
}
}
add_character_flag = previously_matching_education
}
else_if = {
limit = {
OR = {
has_education_intrigue_trigger = yes
has_focus_intrigue = yes
intrigue >= high_skill_rating
}
scope:ward = {
has_character_flag = intrigue_previous_education
}
}
add_character_flag = previously_matching_education
}
else_if = {
limit = {
OR = {
has_education_learning_trigger = yes
has_focus_learning = yes
learning >= high_skill_rating
}
scope:ward = {
has_character_flag = learning_previous_education
}
}
add_character_flag = previously_matching_education
}
}

option = {
name = childhood_education.0004.a
}

after = {
remove_character_flag = previously_matching_education
remove_character_flag = matching_education
scope:ward = {
remove_character_flag = martial_previous_education
remove_character_flag = intrigue_previous_education
remove_character_flag = diplomacy_previous_education
remove_character_flag = learning_previous_education
remove_character_flag = stewardship_previous_education
}
}
}

childhood_education.0005 = {
hidden = yes
trigger = {
OR = {
has_focus = education_diplomacy
has_focus = education_martial
has_focus = education_stewardship
has_focus = education_learning
has_focus = education_intrigue
}
}
immediate = {
set_focus = no
}
}

########################
# Religious and Cultural Conversion
# 1000+
# System by Petter Vilberg
########################

childhood_education.1001 = {
hidden = yes

trigger = {
any_relation = {
type = guardian
OR = {
AND = {
has_relation_flag = {
target = root
relation = ward
flag = convert_faith
}
NOT = { faith = root.faith }
}
AND = {
has_relation_flag = {
target = root
relation = ward
flag = convert_culture
}
NOT = { culture = root.culture }
}
}
}
}

immediate = {
random_relation = {
type = guardian
save_scope_as = guardian
}
if = {
limit = {
scope:guardian = {
has_relation_flag = {
target = root
relation = ward
flag = convert_faith
}
}
NOT = { faith = scope:guardian.faith }
}
if = {
limit = {
has_variable = education_faith_conversion_chance
}
change_variable = {
name = education_faith_conversion_chance
add = 20
}
random = {
chance = var:education_faith_conversion_chance
save_temporary_scope_value_as = {
name = convert_faith
value = yes
}
}
}
else = {
set_variable = {
name = education_faith_conversion_chance
value = 0
}
}
}
if = {
limit = {
scope:guardian = {
has_relation_flag = {
target = root
relation = ward
flag = convert_culture
}
}
NOT = { culture = scope:guardian.culture }
}
if = {
limit = {
has_variable = education_culture_conversion_chance
}
change_variable = {
name = education_culture_conversion_chance
add = 10
}
random = {
chance = var:education_culture_conversion_chance
save_temporary_scope_value_as = {
name = convert_culture
value = yes
}
}
}
else = {
set_variable = {
name = education_culture_conversion_chance
value = 0
}
}
}

#Check if a conversion event should be fired


if = {
limit = {
exists = scope:convert_faith
exists = scope:convert_culture
}

#Send event about converting both


trigger_event = {
id = childhood_education.1011
days = { 1 100 }
}
}
else_if = {
limit = {
exists = scope:convert_faith
}

#Send event about converting faith


trigger_event = {
id = childhood_education.1021
days = { 1 100 }
}
}
else_if = {
limit = {
exists = scope:convert_culture
}

#Send event about converting culture


trigger_event = {
id = childhood_education.1031
days = { 1 100 }
}
}
}
}
#Double conversion
childhood_education.1011 = {
type = character_event
title = childhood_education.1011.t
desc = childhood_education.1011.desc
theme = education
left_portrait = scope:guardian

trigger = {
scope:guardian = {
is_alive = yes
}
has_relation_guardian = scope:guardian
}

immediate = {
play_music_cue = "mx_cue_faith_conversion"
save_scope_as = ward
}

option = {
name = childhood_education.1011.a
set_character_faith = scope:guardian.faith
set_culture = scope:guardian.culture
hidden_effect = {
scope:guardian = {
remove_relation_flag = {
target = root
relation = ward
flag = convert_culture
}
}
scope:guardian = {
trigger_event = childhood_education.1012
}
}
}
}

#Message to Guardian
childhood_education.1012 = {
type = character_event
title = childhood_education.1012.t
desc = childhood_education.1012.desc
theme = education
left_portrait = scope:ward

immediate = {
play_music_cue = "mx_cue_faith_conversion"
scope:ward = {
set_character_faith = scope:guardian.faith
set_culture = scope:guardian.culture
}
hidden_effect = {
if = {
limit = {
exists = scope:ward.father
scope:ward.father = {
is_alive = yes
NOT = { this = root }
}
}
scope:ward.father = {
save_scope_as = father
send_interface_message = {
type = send_interface_message_as_toast
title =
child_culture_and_faith_converted.parent.message
left_icon = scope:ward
right_icon = scope:educator

show_as_tooltip = {
scope:ward = {
set_character_faith =
scope:guardian.faith
set_culture =
scope:guardian.culture
}
}
}
}
}
if = {
limit = {
exists = scope:ward.mother
scope:ward.mother = {
is_alive = yes
NOT = { this = root }
}
}
scope:ward.mother = {
save_scope_as = mother
send_interface_message = {
type = send_interface_message_as_toast
title =
child_culture_and_faith_converted.parent.message
left_icon = scope:ward
right_icon = scope:educator

show_as_tooltip = {
scope:ward = {
set_character_faith =
scope:guardian.faith
set_culture =
scope:guardian.culture
}
}
}
}
}
}
}

option = {
name = childhood_education.1012.a
trigger = {
NOT = {
is_parent_of = scope:ward
}
}
}

option = {
name = childhood_education.1012.a
trigger = {
is_parent_of = scope:ward
}
}
}

#Convert Faith
childhood_education.1021 = {
type = character_event
title = childhood_education.1021.t
desc = childhood_education.1021.desc
theme = education
left_portrait = scope:guardian

trigger = {
scope:guardian = {
is_alive = yes
}
has_relation_guardian = scope:guardian
}

immediate = {
play_music_cue = "mx_cue_faith_conversion"
save_scope_as = ward
}

option = {
name = childhood_education.1021.a
set_character_faith = scope:guardian.faith
hidden_effect = {
scope:guardian = {
trigger_event = childhood_education.1022
}
}
}
}

#Message to Guardian
childhood_education.1022 = {
type = character_event
title = childhood_education.1022.t
desc = childhood_education.1022.desc
theme = education
left_portrait = scope:ward

immediate = {
play_music_cue = "mx_cue_faith_conversion"
show_as_tooltip = {
scope:ward = {
set_character_faith = scope:guardian.faith
}
}
hidden_effect = {
if = {
limit = {
exists = scope:ward.father
scope:ward.father = {
is_alive = yes
NOT = { this = root }
}
}
scope:ward.father = {
save_scope_as = father
send_interface_message = {
type = send_interface_message_as_toast
title = child_faith_converted.parent.message
left_icon = scope:ward
right_icon = scope:educator

show_as_tooltip = {
scope:ward = {
set_character_faith =
scope:guardian.faith
}
}
}
}
}
if = {
limit = {
exists = scope:ward.mother
scope:ward.mother = {
is_alive = yes
NOT = { this = root }
}
}
scope:ward.mother = {
save_scope_as = mother
send_interface_message = {
type = send_interface_message_as_toast
title = child_faith_converted.parent.message
left_icon = scope:ward
right_icon = scope:educator

show_as_tooltip = {
scope:ward = {
set_character_faith =
scope:guardian.faith
}
}
}
}
}
}
}

option = {
name = childhood_education.1022.a
}
}

#Convert Culture
childhood_education.1031 = {
type = character_event
title = childhood_education.1031.t
desc = childhood_education.1031.desc
theme = education
left_portrait = scope:guardian

trigger = {
scope:guardian = {
is_alive = yes
}
has_relation_guardian = scope:guardian
}

immediate = {
play_music_cue = "mx_cue_faith_conversion"
save_scope_as = ward
}

option = {
name = childhood_education.1031.a
set_culture = scope:guardian.culture
hidden_effect = {
scope:guardian = {
trigger_event = childhood_education.1032
}
}
}
}

#Message to Guardian
childhood_education.1032 = {
type = character_event
title = childhood_education.1032.t
desc = childhood_education.1032.desc
theme = education
left_portrait = scope:ward

immediate = {
play_music_cue = "mx_cue_faith_conversion"
show_as_tooltip = {
scope:ward = {
set_culture = scope:guardian.culture
}
}
hidden_effect = {
if = {
limit = {
exists = scope:ward.father
scope:ward.father = {
is_alive = yes
NOT = { this = root }
}
}
scope:ward.father = {
save_scope_as = father
send_interface_message = {
type = send_interface_message_as_toast
title = child_culture_converted.parent.message
left_icon = scope:ward
right_icon = scope:educator

show_as_tooltip = {
scope:ward = {
set_culture =
scope:guardian.culture
}
}
}
}
}
if = {
limit = {
exists = scope:ward.mother
scope:ward.mother = {
is_alive = yes
NOT = { this = root }
}
}
scope:ward.mother = {
save_scope_as = mother
send_interface_message = {
type = send_interface_message_as_toast
title = child_culture_converted.parent.message
left_icon = scope:ward
right_icon = scope:educator

show_as_tooltip = {
scope:ward = {
set_culture =
scope:guardian.culture
}
}
}
}
}
}
}

option = {
name = childhood_education.1032.a
}
}

#########################
##
## EDUCATION MAINTENANCE
##
#########################

#Assign education focus


childhood_education.9001 = {
hidden = yes
immediate = {
add_character_flag = natural_education_progression
if = {
limit = {
has_education_focus_trigger = no
}
set_default_education = yes
}
}
}

#To gain education points


childhood_education.9002 = {
hidden = yes

immediate = {
education_point_acquisition_effect = yes
}
}

#Patronage-focused / scholarly spouse may add points


childhood_education.9003 = {
hidden = yes

immediate = {
add_patronage_spouse_education_points_effect = yes
}
}

# Pedagogy effect
childhood_education.9004 = {
hidden = yes

trigger = {
age >= 8
any_relation = {
type = guardian
has_perk = pedagogy_perk
}
}

immediate = {
save_scope_as = child
random_relation = {
type = guardian
limit = {
has_perk = pedagogy_perk
}
save_scope_as = guardian
}
if = {
limit = {
age >= 10
NOR = {
has_relation_friend = scope:guardian
has_relation_best_friend = scope:guardian
has_relation_rival = scope:guardian
has_relation_nemesis = scope:guardian
}
}
random = {
chance = 20
compare_modifier = {
trigger = {
age >= 14
}
value = age
multiplier = 2
}
save_scope_value_as = {
name = set_friendship
value = yes
}
}
}
random_list = {
80 = { }
4 = { # Gain Diplomacy
send_interface_toast = {
title = childhood_education.9004.child_message
left_icon = scope:guardian

add_diplomacy_skill = 1
if = {
limit = {
exists = scope:set_friendship
}
set_relation_friend = scope:guardian
}
}
scope:guardian = {
send_interface_message = {
type = event_diplomacy_good
title =
childhood_education.9004.guardian_message
left_icon = scope:child

show_as_tooltip = {
scope:child = {
add_diplomacy_skill = 1
}
if = {
limit = {
exists = scope:set_friendship
}
set_relation_friend = scope:child
}
}
}
}
}
4 = { # Gain Martial
send_interface_toast = {
title = childhood_education.9004.child_message
left_icon = scope:guardian

add_martial_skill = 1
if = {
limit = {
exists = scope:set_friendship
}
set_relation_friend = scope:guardian
}
}
scope:guardian = {
send_interface_message = {
type = event_martial_good
title =
childhood_education.9004.guardian_message
left_icon = scope:child

show_as_tooltip = {
scope:child = {
add_martial_skill = 1
}
if = {
limit = {
exists = scope:set_friendship
}
set_relation_friend = scope:child
}
}
}
}
}
4 = { # Gain Learning
send_interface_toast = {
title = childhood_education.9004.child_message
left_icon = scope:guardian

add_learning_skill = 1
if = {
limit = {
exists = scope:set_friendship
}
set_relation_friend = scope:guardian
}
}
scope:guardian = {
send_interface_message = {
type = event_learning_good
title =
childhood_education.9004.guardian_message
left_icon = scope:child

show_as_tooltip = {
scope:child = {
add_learning_skill = 1
}
if = {
limit = {
exists = scope:set_friendship
}
set_relation_friend = scope:child
}
}
}
}
}
4 = { # Gain Intrigue
send_interface_toast = {
title = childhood_education.9004.child_message
left_icon = scope:guardian

add_intrigue_skill = 1
if = {
limit = {
exists = scope:set_friendship
}
set_relation_friend = scope:guardian
}
}
scope:guardian = {
send_interface_message = {
type = event_intrigue_good
title =
childhood_education.9004.guardian_message
left_icon = scope:child

show_as_tooltip = {
scope:child = {
add_intrigue_skill = 1
}
if = {
limit = {
exists = scope:set_friendship
}
set_relation_friend = scope:child
}
}
}
}
}
4 = { # Gain Stewardship
send_interface_toast = {
title = childhood_education.9004.child_message
left_icon = scope:guardian

add_stewardship_skill = 1
if = {
limit = {
exists = scope:set_friendship
}
set_relation_friend = scope:guardian
}
}
scope:guardian = {
send_interface_message = {
type = event_stewardship_good
title =
childhood_education.9004.guardian_message
left_icon = scope:child

show_as_tooltip = {
scope:child = {
add_stewardship_skill = 1
}
if = {
limit = {
exists = scope:set_friendship
}
set_relation_friend = scope:child
}
}
}
}
}
2 = { # Gain Prowess
send_interface_toast = {
title = childhood_education.9004.child_message
left_icon = scope:guardian

add_prowess_skill = 1
if = {
limit = {
exists = scope:set_friendship
}
set_relation_friend = scope:guardian
}
}
scope:guardian = {
send_interface_message = {
type = event_prowess_good
title =
childhood_education.9004.guardian_message
left_icon = scope:child

show_as_tooltip = {
scope:child = {
add_prowess_skill = 1
}
if = {
limit = {
exists = scope:set_friendship
}
set_relation_friend = scope:child
}
}
}
}
}
}
}
}

#To check if character needs education boost or not


childhood_education.9103 = {
hidden = yes

trigger = {
NOT = { has_character_flag = natural_education_progression }
}
immediate = {
set_variable = {
name = years_missing_from_education
value = root.age
}
while = {
limit = {
var:years_missing_from_education > 6
}
education_point_acquisition_effect = yes
change_variable = {
name = years_missing_from_education
add = -1
}
}
add_character_flag = natural_education_progression
remove_variable = years_missing_from_education
}
}

You might also like