Methods for Dealing With The Aristocracy

Users who are viewing this thread

Coal Field

Knight at Arms
So, I briefly mentioned this in another post, but since this is a problem that has plagued tons of mods, I'd like to discuss it and find ways to deal with it.

The problem arises out of the "initialize_aristocracy" function and related scripts. If you change the number of lords, ladies, add in new factions, there seems to be an issue with it not generating ages, relationships, families, or other things very well.

For me, I have in my module_constants, this...
kingdom_titles_male_begin = "str_faction_title_male_player"
kingdom_titles_female_begin = "str_faction_title_female_player"

kingdoms_begin = "fac_player_supporters_faction"
kingdoms_end = "fac_kingdoms_end"

npc_kingdoms_begin = "fac_kingdom_1"
npc_kingdoms_end = kingdoms_end

bandits_begin = "trp_bandit"
bandits_end = "trp_black_khergit_horseman"

kingdom_ladies_begin = "trp_knight_1_1_wife"
kingdom_ladies_end = "trp_heroes_end"

#active NPCs in order: companions, kings, lords, pretenders

pretenders_begin = "trp_kingdom_1_pretender"
pretenders_end = kingdom_ladies_begin

lords_begin = "trp_knight_1_1"
lords_end = pretenders_begin

kings_begin = "trp_kingdom_1_lord"
kings_end = lords_begin

companions_begin = "trp_npc1"
companions_end = kings_begin

active_npcs_begin = "trp_npc1"
active_npcs_end = kingdom_ladies_begin

active_npcs_including_player_begin = "trp_kingdom_heroes_including_player_begin"
original_kingdom_heroes_begin = "trp_kingdom_1_lord"

heroes_begin = active_npcs_begin
heroes_end = kingdom_ladies_end

soldiers_begin = "trp_farmer"
soldiers_end = "trp_town_walker_1"


Originally, in 1776, we had 22 lords in the first faction, 20 lords in factions 2-6, then 5 lords in five other factions, and 10 lords in the last. There were as many ladies for each faction as there were lords, plus a few extra for daughters.

The problem I'm having is that people's ages are appearing as things like -19, -129, 9, 15, -276, etc. I have some lords related to people in other factions. I have some lords with "she" as their title.

None of the constants have been changed.

I assumed this problem was due to each faction not having 20 lords/20 ladies, so I changed that. Now the problem's even worse and in the "Notes" "Characters" screen, clicking on some of the pretenders, some lords, some ladies, causes the game to crash to the desktop.

Every lady and lord is correctly assigned to their faction, but the patriarchs are often fathers of sons in other factions (for instance, I have a Dutch General  who is the son of an Iroquois father. The father's age is 19, the son's is -29).

I know this has been a serious issue for many mods and some have gone so far as to just remove the entire function. I actually really like the marriage function, and the family relations. With the Diplomacy Mod we have in, it makes familial relationships seem more real and life-like.

My questions are:
1. Am I doing something wrong?
2. Is there a way to make this work with extra factions? (we have 12)
3. Are there ways to deal with this?

I'm sorta new to the Module System, but I'm not new to Python.

Thanks in advance, and I appreciate any help you offer. It's really, really stumping me.

Celestialred
 
script_initialize_aristocracy asumes that every faction has 20 lords and 20 ladies. First 8 (no 0 to 7) lords are senior lords that have wife (lady no 0, 2, 4, 6, 8, 10, 12, 14) and a daughter (lady no 1, 3, 5, 7, 9, 11, 13, 15) and a son (lord no 12 to 19).
Lords number 8 to 11 (4 lords) are not married yet middle age lords and each of them always have a sister (lady no 16 to 19). The rest of lords (no 12 to 19)  are young lords and they are son of the first 8 lords.
You must edit the script to support different number of lords/ladies.
 
I would suggest a copy/past/edit method

What i mean is, you want an old lord just copy and old existing lord and paste under the original, then, just edit to your preferences and, if you like, delete the original one. It take some time but, when you're done it'll work perfectly with no crashes at all. I just made this way and worked nice for me so far. Of course it would take you doing this in every py archive but, the no crash bonus is worth the work. For curiosity sake may i ask what mod are you working at? Sounds interesting
 
The advantage using the native script are predictible and balanced family relationship for all faction. Your problem actualy come from that you have 12 factions and native's script only seeds for 6 factions.
This is what you must do :

1. Deal with the seed
          (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),
              (assign, ":king", "trp_kingdom_1_lord"),
            (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),
(assign, ":king", "trp_kingdom_2_lord"),
            (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),
(assign, ":king", "trp_kingdom_3_lord"),
            (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),
              (assign, ":king", "trp_kingdom_4_lord"),
            (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),
(assign, ":king", "trp_kingdom_5_lord"),

<expand this else_try to cover 12 faction, see the limit of is_between  operations are first lords of every factions>
<except the last else_try, the upper limit is 1st pretender. Add the xx of (assign, ":ancestor_seed", xx), by 6 for next faction>


          (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),
              (assign, ":king", "trp_kingdom_6_lord"),
          (try_end),


2. You should have 20 ladies for each faction.
3. If you have more then 20 lords for specific faction, you can add this line : ( I asume you don't have more than 28 lords for the big faction)
  The adition will make the aditional lords as 2nd son of the first 8 lords.

    (else_try), #Younger unmarried lords
    #age is father's minus 20 to 25
        (store_sub, ":father", ":cur_troop", 12),
        ########## ADD THIS LINES ###################
        (store_sub, ":scond_son", ":npc_seed", 19),
        (val_max,  ":scond_son", 0),
        (try_begin),
            (gt, ":scond_son", 0),
            (store_sub, ":father", ":cur_troop", ":npc_seed"),
            (val_sub, ":father", 1),
            (val_add, ":father", ":scond_son"),
        (try_end),
        ########## LINES END ###################
        (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"),
        ########## ADD THIS LINES ###################
        (try_begin),
            (gt, ":scond_son", 0),
            (store_random_in_range, ":rand", 1, 3),
            (val_sub,, ":age", ":rand"),
        (try_end),
        ########## LINES END ###################
 
Thank you all for such quick replies!

Hurleur - I think that script might do the trick. I searched the forums and never found that topic. Thank you, I'll try editing that and seeing what I can come up with.

The mod I'm working for is 1776 - American Revolution. I and Dellivis are the coders for the mod. A lot of the original team members left. I came on in the past month and have been trying to get the module's files working correctly. There's a lot going into this mod and I've put a ton of work into it. I want it to be classic.

http://forums.taleworlds.com/index.php/board,245.0.html is our sub-forum.

It's going to be the base for the 1860 mod, and probably backwards written into 1755 - Old Frontier. I'm also coding for the Twilight of the Sun King, here http://forums.taleworlds.com/index.php/topic,203566.0.html  based upon the War of Spanish Succession.

Getting the Aristocracy function is sorta critical to some of these mods.

dunde - Thank you so, so, so much. I will play around with that and see what I can get.

I really appreciate the feedback and help. Thank you.

CR.
 
Does the "ancestor_seed" going up by 6 mean something?

Let's say I have 5 lords. Do I need 5 ladies? or more (for daughters)?

Is the 6 a function of the 1/3 being patriarchs, 1/3 being married middle-aged men with a son, and 1/3 being unmarried sons?
 
Somebody said:
TBH, if you're going to implement historical relationships, scrap the native system of distribution and manually code in relationships and personalities.

After trying the above code, it looks like that's actually how I'm going to have to do it in order for it to work. I coded it in correctly, but people are still having fathers or sons from other factions. Tedious, but, I guess I will have to code them manually.

Guess I have work to do :smile:
 
celestialred said:
Does the "ancestor_seed" going up by 6 mean something?

Let's say I have 5 lords. Do I need 5 ladies? or more (for daughters)?

Is the 6 a function of the 1/3 being patriarchs, 1/3 being married middle-aged men with a son, and 1/3 being unmarried sons?

6 ancestor seed means that 8 senior lords that having wife and children come from random 6 family roots. So at least there are 2 senior lords are siblings. This make a posibility for ladies and young lords have uncle. I used these values to set family names in my mod.
 
dunde said:
celestialred said:
Does the "ancestor_seed" going up by 6 mean something?

Let's say I have 5 lords. Do I need 5 ladies? or more (for daughters)?

Is the 6 a function of the 1/3 being patriarchs, 1/3 being married middle-aged men with a son, and 1/3 being unmarried sons?

6 ancestor seed means that 8 senior lords that having wife and children come from random 6 family roots. So at least there are 2 senior lords are siblings. This make a posibility for ladies and young lords have uncle. I used these values to set family names in my mod.

This is sorta how I solved it, though it still gives me errors with "courtship events"
("initialize_aristocracy",  #Edits to this were done for 1776 - American Revolution
[
  #LORD OCCUPATIONS, BLOOD RELATIONSHIPS, RENOWN AND REPUTATIONS

  #King ages
  (try_for_range, ":cur_troop", kings_begin, kings_end),                      #NOTE! This was done to allow us to have different numbers of generals, ladies, sons, and eligible marriages per faction
(troop_set_slot, ":cur_troop", slot_troop_occupation, slto_kingdom_hero),  # Done by = Celestialred
(store_random_in_range, ":age", 50, 60),
(troop_set_slot, ":cur_troop", slot_troop_age, ":age"),
(eq, ":cur_troop", "trp_kingdom_5_lord"),
(troop_set_slot, ":cur_troop", slot_troop_age, 47),
(try_end),

#Faction Lord/Leader Ages
#(troop_set_slot, "trp_kingdom_1_lord", slot_troop_age, 57), 
    #(troop_set_slot, "trp_kingdom_2_lord", slot_troop_age, 59), 
    #(troop_set_slot, "trp_kingdom_3_lord", slot_troop_age, 57), 
    #(troop_set_slot, "trp_kingdom_4_lord", slot_troop_age, 54), 
    #(troop_set_slot, "trp_kingdom_5_lord", slot_troop_age, 62), 
    #(troop_set_slot, "trp_kingdom_6_lord", slot_troop_age, 53),
#(troop_set_slot, "trp_kingdom_7_lord", slot_troop_age, 6:cool:,
#(troop_set_slot, "trp_kingdom_8_lord", slot_troop_age, 45),
#(troop_set_slot, "trp_kingdom_9_lord", slot_troop_age, 5:cool:,
#(troop_set_slot, "trp_kingdom_10_lord", slot_troop_age, 37),
#(troop_set_slot, "trp_kingdom_11_lord", slot_troop_age, 67),
#(troop_set_slot, "trp_kingdom_12_lord", slot_troop_age, 4:cool:,
   
#American Generals, 1-8 are fathers

#Ameerican Family 1 - Use as a template for factions with 20 Generals and 20 Women
    (troop_set_slot, "trp_knight_1_1", slot_troop_age, 53), #Father's Age
(troop_set_slot, "trp_kingdom_1_lady_1", slot_troop_age, 4:cool:, #Wife's Age
    (troop_set_slot, "trp_kingdom_1_lady_1", slot_troop_spouse, "trp_knight_1_1"),# His Wife
(troop_set_slot, "trp_kingdom_1_lady_16", slot_troop_mother, "trp_kingdom_1_lady_1"),#Her Daughter
(troop_set_slot, "trp_knight_1_9", slot_troop_father, "trp_knight_1_1"),#His son
(troop_set_slot, "trp_knight_1_9", slot_troop_mother, "trp_kingdom_1_lady_1"),#Her son
(troop_set_slot, "trp_knight_1_9", slot_troop_age, 27),#Son's age
    (troop_set_slot, "trp_kingdom_1_lady_9", slot_troop_spouse, "trp_knight_1_9"),#His son and his wife
(troop_set_slot, "trp_kingdom_1_lady_9", slot_troop_age, 25), #Son's Wife's Age
    (troop_set_slot, "trp_kingdom_1_lady_16", slot_troop_father, "trp_knight_1_1"),#His Daughter
(troop_set_slot, "trp_kingdom_1_lady_16", slot_troop_age, 19), #Daughter's Age

#American Family 2
(troop_set_slot, "trp_knight_1_2", slot_troop_age, 54), #Father's Age
(troop_set_slot, "trp_kingdom_1_lady_2", slot_troop_age, 52), #Wife's Age
    (troop_set_slot, "trp_kingdom_1_lady_2", slot_troop_spouse, "trp_knight_1_2"),# His Wife
(troop_set_slot, "trp_knight_1_10", slot_troop_father, "trp_knight_1_2"),#His son
(troop_set_slot, "trp_knight_1_10", slot_troop_age, 30),#Son's age
    (troop_set_slot, "trp_kingdom_1_lady_10", slot_troop_spouse, "trp_knight_1_10"),#His son and his wife
(troop_set_slot, "trp_kingdom_1_lady_10", slot_troop_age, 30), #Son's Wife's Age
    (troop_set_slot, "trp_kingdom_1_lady_17", slot_troop_father, "trp_knight_1_2"),#Daughter
    (troop_set_slot, "trp_kingdom_1_lady_17", slot_troop_age, 1:cool:, #Daughter's Age
(troop_set_slot, "trp_kingdom_1_lady_2", slot_troop_mother, "trp_kingdom_1_lady_17"),#Her Daughter
(troop_set_slot, "trp_knight_1_10", slot_troop_mother, "trp_kingdom_1_lady_2"),#Her son

#American Family 3
(troop_set_slot, "trp_knight_1_3", slot_troop_age, 67), #Father's Age
(troop_set_slot, "trp_kingdom_1_lady_3", slot_troop_age, 60), #Wife's Age
    (troop_set_slot, "trp_kingdom_1_lady_3", slot_troop_spouse, "trp_knight_1_3"),# His Wife
(troop_set_slot, "trp_knight_1_11", slot_troop_father, "trp_knight_1_3"),#His son
(troop_set_slot, "trp_knight_1_11", slot_troop_age, 42),#Son's age
    (troop_set_slot, "trp_kingdom_1_lady_11", slot_troop_spouse, "trp_knight_1_11"),#His son and his wife
(troop_set_slot, "trp_kingdom_1_lady_11", slot_troop_age, 2:cool:, #Son's Wife's Age
    (troop_set_slot, "trp_kingdom_1_lady_18", slot_troop_father, "trp_knight_1_3"),#Daughter
    (troop_set_slot, "trp_kingdom_1_lady_18", slot_troop_age, 19), #Daughter's Age
(troop_set_slot, "trp_kingdom_1_lady_18", slot_troop_mother, "trp_kingdom_1_lady_3"),#Her Daughter
(troop_set_slot, "trp_knight_1_11", slot_troop_mother, "trp_kingdom_1_lady_3"),#Her son

#American Family 4
(troop_set_slot, "trp_knight_1_4", slot_troop_age, 66), #Father's Age
(troop_set_slot, "trp_kingdom_1_lady_4", slot_troop_age, 54), #Wife's Age
    (troop_set_slot, "trp_kingdom_1_lady_4", slot_troop_spouse, "trp_knight_1_4"),# His Wife
(troop_set_slot, "trp_knight_1_12", slot_troop_father, "trp_knight_1_4"),#His son
(troop_set_slot, "trp_knight_1_12", slot_troop_age, 34),#Son's age
    (troop_set_slot, "trp_kingdom_1_lady_12", slot_troop_spouse, "trp_knight_1_12"),#His son and his wife
(troop_set_slot, "trp_kingdom_1_lady_12", slot_troop_age, 29), #Son's Wife's Age
    (troop_set_slot, "trp_kingdom_1_lady_19", slot_troop_father, "trp_knight_1_4"),#Daughter
    (troop_set_slot, "trp_kingdom_1_lady_19", slot_troop_age, 29), #Daughter's Age
(troop_set_slot, "trp_kingdom_1_lady_19", slot_troop_mother, "trp_kingdom_1_lady_4"),#Her Daughter
(troop_set_slot, "trp_knight_1_12", slot_troop_mother, "trp_kingdom_1_lady_4"),#Her son

#American Family 5
(troop_set_slot, "trp_knight_1_5", slot_troop_age, 51), #Father's Age
(troop_set_slot, "trp_kingdom_l_lady_5", slot_troop_age, 52), #Wife's Age
    (troop_set_slot, "trp_kingdom_l_lady_5", slot_troop_spouse, "trp_knight_1_5"),# His Wife
(troop_set_slot, "trp_knight_1_13", slot_troop_father, "trp_knight_1_5"),#His son
(troop_set_slot, "trp_knight_1_13", slot_troop_age, 30),#Son's age
    (troop_set_slot, "trp_kingdom_l_lady_13", slot_troop_spouse, "trp_knight_1_13"),#His son and his wife
(troop_set_slot, "trp_kingdom_l_lady_13", slot_troop_age, 24), #Son's Wife's Age
    (troop_set_slot, "trp_kingdom_1_lady_20", slot_troop_father, "trp_knight_1_4"),#Daughter
    (troop_set_slot, "trp_kingdom_1_lady_20", slot_troop_age, 24), #Daughter's Age
(troop_set_slot, "trp_kingdom_1_lady_20", slot_troop_mother, "trp_kingdom_l_lady_5"),#Her Daughter
(troop_set_slot, "trp_knight_1_13", slot_troop_mother, "trp_kingdom_l_lady_5"),#Her son

#American Family 6
(troop_set_slot, "trp_knight_1_6", slot_troop_age, 53), #Father's Age
(troop_set_slot, "trp_kingdom_1_lady_6", slot_troop_age, 50), #Wife's Age
    (troop_set_slot, "trp_kingdom_1_lady_6", slot_troop_spouse, "trp_knight_1_6"),# His Wife
(troop_set_slot, "trp_knight_1_14", slot_troop_father, "trp_knight_1_6"),#His son
(troop_set_slot, "trp_knight_1_14", slot_troop_age, 30),#Son's age
    (troop_set_slot, "trp_knight_1_14", slot_troop_spouse, "trp_kingdom_1_lady_14"),#His son and his wife
(troop_set_slot, "trp_kingdom_1_lady_12", slot_troop_age, 29), #Son's Wife's Age
(troop_set_slot, "trp_knight_1_14", slot_troop_mother, "trp_kingdom_1_lady_6"),#Her son

#American Family 7
(troop_set_slot, "trp_knight_1_7", slot_troop_age, 71), #Father's Age
(troop_set_slot, "trp_kingdom_1_lady_7", slot_troop_age, 40), #Wife's Age
    (troop_set_slot, "trp_kingdom_1_lady_7", slot_troop_spouse, "trp_knight_1_7"),# His Wife
(troop_set_slot, "trp_knight_1_15", slot_troop_father, "trp_knight_1_7"),#His son
(troop_set_slot, "trp_knight_1_15", slot_troop_age, 20),#Son's age
    (troop_set_slot, "trp_kingdom_1_lady_15", slot_troop_spouse, "trp_knight_1_15"),#His son and his wife
(troop_set_slot, "trp_kingdom_1_lady_15", slot_troop_age, 22), #Son's Wife's Age
(troop_set_slot, "trp_knight_1_15", slot_troop_mother, "trp_kingdom_1_lady_7"),#Her son

#American Family 8
(troop_set_slot, "trp_knight_1_8", slot_troop_age, 6:cool:, #Father's Age
(troop_set_slot, "trp_kingdom_1_lady_8", slot_troop_age, 54), #Wife's Age
    (troop_set_slot, "trp_kingdom_1_lady_8", slot_troop_spouse, "trp_knight_1_8"),# His Wife
(troop_set_slot, "trp_knight_1_16", slot_troop_father, "trp_knight_1_8"),#His son
(troop_set_slot, "trp_knight_1_16", slot_troop_age, 41),#Son's age
    (troop_set_slot, "trp_kingdom_1_lady_16", slot_troop_spouse, "trp_knight_1_16"),#His son and his wife
(troop_set_slot, "trp_kingdom_1_lady_16", slot_troop_age, 41), #Son's Wife's Age
(troop_set_slot, "trp_knight_1_16", slot_troop_mother, "trp_kingdom_1_lady_8"),#Her son

#American Unmarried and Eligible Young Generals
    (troop_set_slot, "trp_knight_1_17", slot_troop_age, 21),
(troop_set_slot, "trp_knight_1_18", slot_troop_age, 34),
(troop_set_slot, "trp_knight_1_19", slot_troop_age, 19),
(troop_set_slot, "trp_knight_1_20", slot_troop_age, 22),
(troop_set_slot, "trp_knight_1_21", slot_troop_age, 32),
(troop_set_slot, "trp_knight_1_22", slot_troop_age, 29),
 
Back
Top Bottom