("initialize_aristocracy",
[
#LORD OCCUPATIONS, BLOOD RELATIONSHIPS, RENOWN AND REPUTATIONS
## King ages
# (try_for_range, ":cur_troop", kings_begin, kings_end),
# (troop_set_slot, ":cur_troop", slot_troop_occupation, slto_kingdom_hero),
# (store_random_in_range, ":age", 50, 60),
# (troop_set_slot, ":cur_troop", slot_troop_age, ":age"),
# (eq, ":cur_troop", "trp_kingdom_2_lord"),
# (troop_set_slot, ":cur_troop", slot_troop_age, 47),
# (try_end),
(troop_set_slot, "trp_kingdom_1_lord", slot_troop_age, 33), #Charles V
(troop_set_slot, "trp_kingdom_1_lord", slot_troop_spouse, "trp_kingdom_1_lady_12"),
(troop_set_slot, "trp_kingdom_1_lady_12", slot_troop_age, 33), #Joanna of bourbon
(troop_set_slot, "trp_kingdom_1_lady_12", slot_troop_father, "trp_kingdom_l_lady_13"),
(troop_set_slot, "trp_kingdom_l_lady_13", slot_troop_age, 58), #Isabella of Valois
#START PLANTAGENATE FAMILY
(troop_set_slot, "trp_kingdom_2_lord", slot_troop_age, 59), #edward III
(troop_set_slot, "trp_kingdom_2_lord", slot_troop_spouse, "trp_kingdom_1_lady_6"),
(troop_set_slot, "trp_kingdom_1_lady_6", slot_troop_age, 57), #philipa
(troop_set_slot, "trp_knight_2_7", slot_troop_age, 41), #black prince
(troop_set_slot, "trp_knight_2_7", slot_troop_father, "trp_kingdom_2_lord"),
(troop_set_slot, "trp_knight_2_7", slot_troop_mother, "trp_kingdom_1_lady_6"),
(troop_set_slot, "trp_knight_2_7", slot_troop_spouse, "trp_kingdom_1_lady_2"),
(troop_set_slot, "trp_kingdom_1_lady_2", slot_troop_age, 43), #joan #Thomas Holland "knight_4_20" is her son but not the black prince's
(troop_set_slot, "trp_kingdom_1_lady_2", slot_troop_spouse, "trp_knight_2_7"),
(troop_set_slot, "trp_knight_4_20", slot_troop_age, 41), #Thomas Holland
(troop_set_slot, "trp_knight_4_20", slot_troop_mother, "trp_kingdom_1_lady_2"),
(troop_set_slot, "trp_knight_4_20", slot_troop_spouse, "trp_kingdom_1_lady_11"),
(troop_set_slot, "trp_kingdom_1_lady_11", slot_troop_age, 43), #Alice Holland
(troop_set_slot, "trp_kingdom_1_lady_11", slot_troop_spouse, "trp_knight_4_20"),
(troop_set_slot, "trp_knight_4_2", slot_troop_age,28), #John of Gaunt
(troop_set_slot, "trp_knight_4_2", slot_troop_spouse, "trp_knight_1_lady_3"),
(troop_set_slot, "trp_knight_4_2", slot_troop_father, "trp_kingdom_2_lord"),
(troop_set_slot, "trp_knight_4_2", slot_troop_mother, "trp_kingdom_1_lady_6"),
(troop_set_slot, "trp_knight_1_lady_3", slot_troop_age, 43), #Beatrice de Chalon
(troop_set_slot, "trp_knight_1_lady_3", slot_troop_spouse, "trp_knight_4_2"),
(troop_set_slot, "trp_knight_1_16", slot_troop_age,31), #Enguerrand de Coucy
(troop_set_slot, "trp_knight_1_16", slot_troop_spouse, "trp_kingdom_1_lady_7"),
(troop_set_slot, "trp_knight_1_16", slot_troop_father, "trp_kingdom_2_lord"),
(troop_set_slot, "trp_knight_1_16", slot_troop_mother, "trp_kingdom_1_lady_6"),
(troop_set_slot, "trp_kingdom_1_lady_7", slot_troop_age,39), #Isabella de Coucy
(troop_set_slot, "trp_kingdom_1_lady_7", slot_troop_spouse, "trp_knight_1_16"),
(troop_set_slot, "trp_knight_4_4", slot_troop_age,33), #Lionel of Antwerp *died in 68, before mod start
(troop_set_slot, "trp_knight_4_4", slot_troop_father, "trp_kingdom_2_lord"),
(troop_set_slot, "trp_knight_4_4", slot_troop_mother, "trp_kingdom_1_lady_6"),
(troop_set_slot, "trp_knight_4_4", slot_troop_spouse, "trp_kingdom_1_lady_8"),
(troop_set_slot, "trp_kingdom_1_lady_8", slot_troop_age,18), #Violante, italian wife
(troop_set_slot, "trp_kingdom_1_lady_8", slot_troop_spouse, "trp_knight_4_4"),
(troop_set_slot, "trp_knight_2_5", slot_troop_age,33), #Edmund of Langley
(troop_set_slot, "trp_knight_2_5", slot_troop_father, "trp_kingdom_2_lord"),
(troop_set_slot, "trp_knight_2_5", slot_troop_mother, "trp_kingdom_1_lady_6"),
(troop_set_slot, "trp_knight_2_5", slot_troop_spouse, "trp_kingdom_1_lady_8"),
(troop_set_slot, "trp_kingdom_1_lady_9", slot_troop_age,16), #Infanta Isabella of Castile *Married him in '72, after the mod time.
(troop_set_slot, "trp_kingdom_1_lady_9", slot_troop_spouse, "trp_knight_2_5"),
#END PLANTAGENATE FAMILY
(troop_set_slot, "trp_knight_1_1", slot_troop_age, 20),# Alain de Rohan
(troop_set_slot, "trp_knight_1_1", slot_troop_spouse, "trp_kingdom_1_lady_1"),
(troop_set_slot, "trp_kingdom_1_lady_1", slot_troop_age, 15), #Lady Beatrice de Clisson
(troop_set_slot, "trp_kingdom_1_lady_1", slot_troop_father, "trp_knight_5_11"), #father Olivier de Clisson
(troop_set_slot, "trp_knight_1_2", slot_troop_age,28),
(troop_set_slot, "trp_knight_1_2", slot_troop_spouse, "trp_knight_1_lady_3"),
(troop_set_slot, "trp_knight_1_4", slot_troop_age, 33),
(troop_set_slot, "trp_knight_1_4", slot_troop_spouse, "trp_kingdom_l_lady_5"),
(troop_set_slot, "trp_kingdom_l_lady_5", slot_troop_spouse, "trp_knight_1_4"),
(troop_set_slot, "trp_knight_1_5", slot_troop_age,66),
(troop_set_slot, "trp_knight_1_6", slot_troop_age,50),
(troop_set_slot, "trp_knight_1_6", slot_troop_spouse, "trp_kingdom_1_lady_8"),
(troop_set_slot, "trp_knight_1_8", slot_troop_age,36),
(troop_set_slot, "trp_knight_1_8", slot_troop_spouse, "trp_kingdom_1_lady_10"),
#########$
(troop_set_slot, "trp_knight_1_9", slot_troop_age,51), #du guesclin
(troop_set_slot, "trp_knight_1_9", slot_troop_spouse, "trp_kingdom_1_lady_12"),
# (troop_set_slot, "trp_kingdom_1_lady_1", slot_troop_father, "trp_knight_1_9"),
# (troop_set_slot, "trp_knight_1_lady_3", slot_troop_father, "trp_knight_1_9"),
(troop_set_slot, "trp_knight_1_10", slot_troop_age,66),
(troop_set_slot, "trp_knight_1_11", slot_troop_age,66),
(troop_set_slot, "trp_knight_1_12", slot_troop_age,18),
(troop_set_slot, "trp_knight_1_13", slot_troop_age,66),
(troop_set_slot, "trp_knight_1_14", slot_troop_age,66),
#The first thing - family structure
#lords 1 to 8 are patriarchs with one live-at-home son and one daughter. They come from one of six possible ancestors, thus making it likely that there will be two sets of siblings
#lords 9 to 12 are unmarried landowners with sisters
#lords 13 to 20 are sons who still live in their fathers' houses
#For the sake of simplicity, we can assume that all male aristocrats in prior generations either married commoners or procured their brides from the Old Country, thus discounting intermarriage
(try_for_range, ":cur_troop", kingdom_ladies_begin, kingdom_ladies_end),
(troop_set_slot, ":cur_troop", slot_troop_occupation, slto_kingdom_lady),
(try_end),
#
# (assign, ":cur_lady", "trp_kingdom_1_lady_1"),
#
(try_for_range, ":cur_troop", kings_begin, lords_end),
#
(troop_set_slot, ":cur_troop", slot_troop_occupation, slto_kingdom_hero),
(try_end),
# (store_random_in_range, ":father_age_at_birth", 23, 26),
## (store_random_in_range, ":mother_age_at_birth", 19, 22),
#
# #(try_begin),
# # (is_between, ":cur_troop", "trp_knight_1_1", "trp_knight_2_1"),
# # (store_sub, ":npc_seed", ":cur_troop", "trp_knight_1_1"),
# # (assign, ":ancestor_seed", 1),
##
## (else_try),
## (is_between, ":cur_troop", "trp_knight_2_1", "trp_knight_3_1"),
## (store_sub, ":npc_seed", ":cur_troop", "trp_knight_2_1"),
## (assign, ":ancestor_seed", 7),
##
## (else_try),
## (is_between, ":cur_troop", "trp_knight_3_1", "trp_knight_4_1"),
## (store_sub, ":npc_seed", ":cur_troop", "trp_knight_3_1"),
## (assign, ":ancestor_seed", 13),
##
## (else_try),
## (is_between, ":cur_troop", "trp_knight_4_1", "trp_knight_5_1"),
## (store_sub, ":npc_seed", ":cur_troop", "trp_knight_4_1"),
## (assign, ":ancestor_seed", 19),
##
## (else_try),
## (is_between, ":cur_troop", "trp_knight_5_1", "trp_knight_6_1"),
## (store_sub, ":npc_seed", ":cur_troop", "trp_knight_5_1"),
## (assign, ":ancestor_seed", 25),
##
## (else_try),
## (is_between, ":cur_troop", "trp_knight_6_1", "trp_kingdom_1_pretender"),
## (store_sub, ":npc_seed", ":cur_troop", "trp_knight_6_1"),
## (assign, ":ancestor_seed", 31),
##
##
#
# (try_begin),
# (lt, ":npc_seed", 8), #NPC seed is the order in the faction
# (assign, ":reputation", ":npc_seed"),
# (store_random_in_range, ":age", 45, 64),
#
# #(store_random_in_range, ":father", 0, 6), #six possible fathers
# #(val_add, ":father", ":ancestor_seed"),
# #(troop_set_slot, ":cur_troop", slot_troop_father, ":father"),
#
# #wife
# (troop_set_slot, ":cur_troop", slot_troop_spouse, ":cur_lady"),
# (troop_set_slot, ":cur_lady", slot_troop_spouse, ":cur_troop"),
# (store_random_in_range, ":wife_reputation", 20, 26),
# (try_begin),
# (eq, ":wife_reputation", 20),
# (assign, ":wife_reputation", lrep_conventional),
# (try_end),
# (troop_set_slot, ":cur_lady", slot_lord_reputation_type, ":wife_reputation"),
#
#
# (call_script, "script_init_troop_age", ":cur_lady", 49),
# (call_script, "script_add_lady_items", ":cur_lady"),
#
# (val_add, ":cur_lady", 1),
#
# #daughter
# (troop_set_slot, ":cur_lady", slot_troop_father, ":cur_troop"),
# (store_sub, ":mother", ":cur_lady", 1),
# (call_script, "script_init_troop_age", ":cur_lady", 19),
# (troop_set_slot, ":cur_lady", slot_troop_mother, ":cur_lady"),
# (store_random_in_range, ":lady_reputation", lrep_conventional, 34), #33% chance of father-derived
# (try_begin),
# (le, ":lady_reputation", 25),
# (troop_set_slot, ":cur_lady", slot_lord_reputation_type, ":lady_reputation"),
# (else_try),
# (eq, ":lady_reputation", 26),
# (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_conventional),
# (else_try),
# (eq, ":lady_reputation", 27),
# (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_moralist),
# (else_try),
# (assign, ":guardian_reputation", ":reputation"),
# (try_begin),
# (this_or_next|eq, ":guardian_reputation", lrep_martial),
# (eq, ":guardian_reputation", 0),
# (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_conventional),
# (else_try),
# (eq, ":guardian_reputation", lrep_quarrelsome),
# (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_otherworldly),
# (else_try),
# (eq, ":guardian_reputation", lrep_selfrighteous),
# (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_ambitious),
# (else_try),
# (eq, ":guardian_reputation", lrep_cunning),
# (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_adventurous),
# (else_try),
# (eq, ":guardian_reputation", lrep_goodnatured),
# (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_adventurous),
# (else_try),
# (eq, ":guardian_reputation", lrep_debauched),
# (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_ambitious),
# (else_try),
# (eq, ":guardian_reputation", lrep_upstanding),
# (troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_moralist),
# (try_end),
# (try_end),
#
# (call_script, "script_add_lady_items", ":cur_lady"),
# (val_add, ":cur_lady", 1),
# #high renown
#
# (else_try), #Older unmarried lords
# (is_between, ":npc_seed", 8, 12),
#
# (store_random_in_range, ":age", 25, 36),
# (store_random_in_range, ":reputation", 0, 8),
#
# (store_random_in_range, ":sister_reputation", 20, 26),
# (try_begin),
# (eq, ":sister_reputation", 20),
# (assign, ":sister_reputation", lrep_conventional),
# (try_end),
# (troop_set_slot, ":cur_lady", slot_lord_reputation_type, ":sister_reputation"),
#
# (troop_set_slot, ":cur_lady", slot_troop_guardian, ":cur_troop"),
#
# (call_script, "script_init_troop_age", ":cur_lady", 21),
# (call_script, "script_add_lady_items", ":cur_lady"),
#
# (val_add, ":cur_lady", 1),
#
# (else_try), #Younger unmarried lords
# #age is father's minus 20 to 25
# (store_sub, ":father", ":cur_troop", 12),
# (troop_set_slot, ":cur_troop", slot_troop_father, ":father"),
# (troop_get_slot, ":mother", ":father", slot_troop_spouse),
# (troop_set_slot, ":cur_troop", slot_troop_mother, ":mother"),
#
# (troop_get_slot, ":father_age", ":father", slot_troop_age),
# (store_sub, ":age", ":father_age", ":father_age_at_birth"),
#
# (try_begin), #50% chance of having father's rep
# (store_random_in_range, ":reputation", 0, 16),
#
# (gt, ":reputation", 7),
# (troop_get_slot, ":reputation", ":father", slot_lord_reputation_type),
# (try_end),
# (try_end),
(try_for_range, ":cur_lady", kingdom_ladies_begin, kingdom_ladies_end),
(store_random_in_range, ":lady_reputation", lrep_conventional, 34), #33% chance of father-derived
(try_begin),
(le, ":lady_reputation", 25),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, ":lady_reputation"),
(else_try),
(eq, ":lady_reputation", 26),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_conventional),
(else_try),
(eq, ":lady_reputation", 27),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_moralist),
(else_try),
(assign, ":guardian_reputation", ":reputation"),
(try_begin),
(this_or_next|eq, ":guardian_reputation", lrep_martial),
(eq, ":guardian_reputation", 0),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_conventional),
(else_try),
(eq, ":guardian_reputation", lrep_quarrelsome),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_otherworldly),
(else_try),
(eq, ":guardian_reputation", lrep_selfrighteous),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_ambitious),
(else_try),
(eq, ":guardian_reputation", lrep_cunning),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_adventurous),
(else_try),
(eq, ":guardian_reputation", lrep_goodnatured),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_adventurous),
(else_try),
(eq, ":guardian_reputation", lrep_debauched),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_ambitious),
(else_try),
(eq, ":guardian_reputation", lrep_upstanding),
(troop_set_slot, ":cur_lady", slot_lord_reputation_type, lrep_moralist),
(try_end),
(try_end),
(call_script, "script_add_lady_items", ":cur_lady"),
(val_add, ":cur_lady", 1),
(try_begin),
(eq, ":reputation", 0),
(assign, ":reputation", 1),
(try_end),
(troop_set_slot, ":cur_troop", slot_lord_reputation_type, ":reputation"),
(call_script, "script_init_troop_age", ":cur_troop", ":age"),
(try_end),
(try_begin),
(eq, "$cheat_mode", 1),
(assign, reg3, "$cheat_mode"),
(display_message, "@{!}DEBUG -- Assigned lord reputation and relations"),
# (display_message, "str_assigned_lord_reputation_and_relations_cheat_mode_reg3"), #This string can be removed
(try_end),
(try_for_range, ":cur_troop", pretenders_begin, pretenders_end),
(troop_set_slot, ":cur_troop", slot_troop_occupation, slto_inactive_pretender),
(store_random_in_range, ":age", 25, 30),
(troop_set_slot, ":cur_troop", slot_troop_age, ":age"),
(eq, ":cur_troop", "trp_kingdom_5_pretender"),
(troop_set_slot, ":cur_troop", slot_troop_age, 45),
(try_end),
]),