Scripted effect
game_rule_create_spouse_and_children
game_rule_create_spouse_and_children = { CHARACTER = … LOCATION = … }game/common/scripted_effects/00_game_rule_effects.txt, line 5 (390 lines). Parameters: $CHARACTER$, $LOCATION$.
game_rule_create_spouse_and_children is a scripted effect in Crusader Kings III, written at line 5 of its file. A call passes 2 parameters: CHARACTER and LOCATION. The game's script calls it in 5 places, among them Far From Home (event yearly.1090), game_rule.1001 (event) and event_0101_spawn_criminal_effect (local effect). Patch 1.20.1.2, from game/common/scripted_effects/00_game_rule_effects.txt.
What it does
Every line of it is script with no tooltip text: the script is below.
The script as written (120 lines of game script)
game_rule_create_spouse_and_children = {
$CHARACTER$ = {
#If not married, create spouse
if = {
limit = {
is_married = no
}
create_character = {
dynasty = none
location = $LOCATION$.location
culture = $CHARACTER$.culture
faith = $CHARACTER$.faith
rite = $CHARACTER$.rite
gender_female_chance = $CHARACTER$.marriage_gender_adjusted_female_chance
age = $CHARACTER$.age
save_scope_as = spouse
}
if = {
limit = { is_male = yes }
marry = scope:spouse
}
else = {
marry_matrilineal = scope:spouse
}
if = {
limit = {
has_trait = nomadic_philosophy
}
scope:spouse = {
add_trait = nomadic_philosophy
}
}
if = {
limit = {
NOT = { exists = scope:spouse.employer }
$LOCATION$ = { is_ruler = yes }
}
$LOCATION$ = { add_courtier = scope:spouse }
}
}
else = {
primary_spouse = { save_scope_as = spouse }
}
if = {
limit = { is_male = yes }
save_scope_as = father
scope:spouse = {
if = {
limit = {
is_female = yes
}
save_scope_as = mother
}
}
}
else = {
save_scope_as = mother
scope:spouse = {
if = {
limit = {
is_male = yes
}
save_scope_as = father
}
}
}
#Create child 1 (mother age 17+)
if = {
limit = {
exists = scope:mother
scope:mother.age >= 17
}
if = { #Do we have a father saved?
limit = {
exists = scope:father
}
create_character = {
location = $LOCATION$.location
culture = $CHARACTER$.culture
faith = $CHARACTER$.faith
rite = $CHARACTER$.rite
gender_female_chance = {
if = {
limit = {
is_ruler = yes
$CHARACTER$ = { has_realm_law = male_only_law }
}
value = 0
}
else_if = {
limit = {
is_ruler = yes
$CHARACTER$ = { has_realm_law = female_only_law }
}
value = 100
}
else = {
value = 50
}
}
age = {
value = scope:mother.age
subtract = 17
}
father = scope:father
mother = scope:mother
dynasty = inherit
save_scope_as = child_1
}
}
else = { #If we don't have a father we generate a child without
create_character = {
location = $LOCATION$.location
culture = $CHARACTER$.culture
faith = $CHARACTER$.faith
rite = $CHARACTER$.rite
gender_female_chance = {As written in game/common/scripted_effects/00_game_rule_effects.txt.
The first 120 of its 390 lines; the rest is in game/common/scripted_effects/00_game_rule_effects.txt from line 5.
Where it is used
Every place in common/, events/ and history/ that calls game_rule_create_spouse_and_children.
Events (2)
- Far From Home
yearly.1090 - game_rule.1001
Scripted effects inside an event file (1)
- event_0101_spawn_criminal_effect
On actions (the game's own hooks) (1)
- on_game_start_with_tutorial
Scripted effects (1)
Source: game/common/scripted_effects/00_game_rule_effects.txt and every file of common/, events/ and history/ that calls it, Crusader Kings III 1.20.1.2.