Results 1 to 7 of 7

Thread: Expanding Feudal Inheritance

  1. #1

    Default Expanding Feudal Inheritance

    Hello.

    I wanted to discuss a modding possibility, to see how viable it is. Mods like Stainless Steel added general titles, such as "Duke of Milan"; however, this doesn't actually do anything except a few stat boosts (and penalties), making it rather shallow and a poor representation of Feudalism. My biggest problem is with Inheritance. Generals who get the title simply hold the title until they die, and then you appoint another one; not particularly deep. What should happen is that the once a generals gets a title, it passes to his rightful heir once he dies, his eldest son, or his eldest sons eldest son, or the second son, etc. It is indeed possible with modding to make a trait for the general who gets a title, and then for sons of the general to get a trait indicating that they have the potential to inherit. There can also be various bonuses for the Lord and his offspring when in the region. However, I would like the game to force the oldest son, or whoever is the rightful heir, to inherit the Title once the Lord of the estate passes on, not just allow anyone from the bloodline to inherit.

    Is this possible within the Medieval 2 Engine? I realize I could make an ancillary "Heir to Milan" that activates when the first son of the general comes of age, but if the father gets the title after multiple sons, it would be more difficult. And the 1st son of the Lord having children further complicates it. While traits and triggers could be expanded upon, I suspect it would be incredibly long and complex to fully represent this, especially considering I would want to represent every region with a title.

    I personally do not think these titles should be represented if there is no realistic inheritance, but if it could be represented it would enrich the game.
    Maybe the Engine Overhaul Project could make this more feasible?

  2. #2
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,228
    Blog Entries
    36

    Default Re: Expanding Feudal Inheritance

    There is the FatherTrait condition that is tailor made for this. Staple for inheritance stuff. To make that work with ancillaries you need to couple them with traits so you can test for it.










  3. #3

    Default Re: Expanding Feudal Inheritance

    Right, FatherTrait is a start. However, I want to make not just any son but the oldest son or rightful heir to be the one to inherit.

    I realize I could do a check of the generals age for various traits and ancillaries, and add an additional trait and ancillary when the heir to the title has a son, to signify that the heirs son(s) inherit before the second son of the current Lord. However, this would probably be an enormous script. Hopefully it would not be so huge as to slow down the game or reach some sort of limit.

    Is there a way to have the father gain a different trait when a son is born, as opposed to when a daughter is born? Another challenge is that daughters who are not princesses are almost useless in their current form, since they have no traits and can only marry random suitors. One thing that would be great is to allow all daughters to be princesses, not just daughters of Kings and Heirs. This would allow them to get traits and marry, and create a better experience.

    Edit: I did successfully make the ancillary Earl of Essex give the Lord a trait, and make it so that all of his sons get a trait “Of the House of Essex”. I would ideally tie “Of the House of Essex” to a retinue that is required for inheritance, unless the whole line has died out. I have a lot more work to do; I have just gotten started.
    Last edited by Steward Denethor II; September 10, 2024 at 04:17 PM.

  4. #4

    Default Re: Expanding Feudal Inheritance

    The short answer: Inheritable unique ancillaries is possible without EOP.

    The long answer:

    Spoiler Alert, click show to read: 

    All characters of a faction have an index based on when they were created. The first character defined for the faction in descr_strat.txt has index 0, the second character has index 1, and so on. Children and adoptees, who are added to the faction later in time, must necessarily have higher indices than their older siblings, who in turn have higher indices than their parents, who have higher indices than their grandparents, and so on. Therefore, we can think of the list of characters by index as a sort of "order of precedence" that we can use for inheritable stuff like titles - the character with the lowest index will have the highest order of precedence or "claim to the title". This is actually the same system the game uses to assign the next heir, all other things (like authority) being equal.

    You will also notice that the CharacterTurnStart event (like all other events) fires in the order of lowest index to highest, e.g. CharacterTurnStart for character 0 fires before that of character 1 and so on. If you use EOP to print a list of characters by index and another list of characters by CharacterTurnStart, the lists should be identical. What this means is that we can use the CharacterTurnStart event to iterate through all characters by index and thus by order of precedence.

    We first create a trait that will be given to all viable heirs. This trait can be visible, as in your "Of the House of Essex" idea, or it can be Hidden, depending on what you want to do with this. Then, we create an ancillary for the title/lordship/whatever. To grant the ancillary, we use CharacterTurnStart to iterate over all characters who have the viable heir trait, we use the I_WorldWideAncillary condition to make the ancillary unique on the map, and we grant the ancillary to the first viable heir who meets the conditions - this character will be the next in line of succession for the ancillary.

    export_descr_character_traits.txt

    Code:
    Trait house_essex ;this trait identifies everyone who is a viable heir
     Characters family
     Level house_essex_level_1
      Description house_essex_desc
      EffectsDescription house_essex_effects_desc
      Threshold 1
    
    ;[...]
    
    Trigger inheret_house_essex
     WhenToTest CharacterTurnStart   ;CharacterTurnStart here is a catch-all, as opposed to using CharacterComesOfAge, etc. etc.
     Condition FatherTrait house_essex > 0
     and not Trait house_essex > 0
     Affects house_essex 1 Chance 100
    
    Trigger assume_house_essex ;this trigger accounts for the situations where the player transfers the ancillary to a character who isn't a viable heir or if the entire household of viable heirs dies out
     WhenToTest CharacterTurnStart
     Condition HasAncType earl_of_essex_type
     and not Trait house_essex > 0
     Affects house_essex 1 Chance 100


    export_descr_ancillaries.txt

    Code:
    Ancillary earl_of_essex
     Type earl_of_essex_type
     Transferable 1 ;this is optional, if the ancillary is transferable to characters who don't originally have the house_essex trait, then you can effectively expand the house by ancillary transfer, but the title might still revert to the original lineage due to the order of precedence
     Image whatever.tga
     ExcludedAncillaries ;perhaps list here other titles that characters aren't allowed to hold at the same time as "Earl of Essex"
     Description earl_of_essex_desc
     EffectsDescription earl_of_essex_effects_desc
     Effect ;whatever
    
    ;[...]
    
    Trigger inherit_earl_of_essex
     WhenToTest CharacterTurnStart
     Condition Trait house_essex > 0
     and not I_WorldWideAncillaryExists earl_of_essex ;this is the key bit, this condition doesn't exist for traits but it allows us to make ancillaries unique
     ;and... whatever other conditions
     AcquireAncillary earl_of_essex chance 100
    
    Trigger regenerate_earl_of_essex   ;this optional trigger is an example of how you might regenerate the title ancillary if the entire household of viable heirs dies out
     WhenToTest CharacterTurnEndInSettlement
     Condition SettlementName Essex
     and not I_WorldWideAncillaryExists earl_of_essex
     ;and... whatever other conditions
     AcquireAncillary earl_of_essex chance 100


    That is the general idea. Any refinements you make on this concept will probably be easier in EOP. For example, if you wanted to make the ancillary only inheritable by the eldest surviving son (instead of possibly going to uncles and others higher on the order of precedence), you could create another unique ancillary to designate eldest son (which would be needed because the FatherAnc condition is broken and always returns true). Or... you could just test the character's relationships using EOP. The main virtue of EOP for scripting is the ability to identify arbitrary characters.

  5. #5

    Default Re: Expanding Feudal Inheritance

    OK great. So with that order index, at least I know that in the first generation, if a father has the “Earl of Essex” trait and the Ancillary “Earl of Essex”, and passes the trait “Of the House of Essex” to his sons, I can ensure that the oldest son gets the ancillary “Heir to Essex” not his younger brothers. However, after a generation, I have to either make a more complicated script, with more traits and ancillaries, or an older Uncle might become the heir; which I do not want. Also the heir having a son and dying complicates it further, since in that case the Earls Grandson becomes the rightful heir.

    It sounds like the EOP might make the project much more feasible. I am not at all familiar with using it, if you have any advice, pointers or links, any help is greatly appreciated.

    Edit: thanks for mentioning the order index. I did not know that about traits and ancillaries in the game.

    Note: for those wondering, the FatherTrait condition does work. It is usually used in the context of a general coming of age, but can be used in other circumstances, such as the beginning or end of a characters turn. I made the ancillary “Earl of Essex” give a general the trait “Earl of Essex” and the trait “Earl of Essex” give the characters sons the trait “Of the House of Essex”. You will need to use more traits to prevent this from occurring with adopted characters.
    Last edited by Steward Denethor II; September 11, 2024 at 06:47 PM.

  6. #6

    Default Re: Expanding Feudal Inheritance

    What you're looking for is male-only cognatic primogeniture. Again, any elaboration on the most basic inheritance scheme will be easier in EOP. With this tool, we no longer need to rely on the CharacterTurnStart order (that is, on character indices) because we can query relationships to parents, spouses, and children directly for any character on the map, then feed that information into a script simulating any desired succession scheme.

    If it will be your first time using EOP, I encourage you to check out Medik's intro video on Lua scripting as well as their project Discord where you can study example scripts. Do not jump directly into your potentially quite complex script and then get frustrated when it doesn't work. Instead, start with a really simple script idea and implement it in Lua to get the hang of things. Here is the Lua documentation, everything will be pretty familiar if you've done any programming before. There are also several browser-based Lua compilers to familiarize yourself with the syntax.

  7. #7
    Gigantus's Avatar I am not special - I am a limited edition.
    Patrician took an arrow to the knee spy of the council

    Join Date
    Aug 2006
    Location
    Goa - India
    Posts
    53,228
    Blog Entries
    36

    Default Re: Expanding Feudal Inheritance

    Inheritance of the oldest son should be easy - use the CharacterComesOfAge event to check for the FatherTrait and an heir trait (*) of the new adult then give him that heir the trait. Disable\level up the heir trait when he becomes the leader\father dies. Which can be checked by I_WorldwideAnvillaryExists.

    * event counters might work better I think as checking for global trait existence is a bit iffy.










Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •