First of all I greatly appreciate the implementation of the new model and the help I got from the TW discord on that topic. As some of you may know I made a mod that allows users to replace the basic troop of any faction with one or more custom basic troops. That being said I think the new VolunteerProductionModel could be enhanced further. I am by no means a C# expert but I'll try to elaborate.
Pre 1.6.0:
The main method that determines what kind of troop a notable gets is the method UpdateVolunteersOfNotables in the RecruitmentCampaignBehavior. In that method the basic troop is pulled from the settlement's culture. Each culture has exactly one basic troop and one elite elite troop. I don't want to go too much into detail but usually the basic troop is spawned first and then a couple of checks (policies, perks etc.) and some RNG later the basic troop is eventually upgraded the elite basic troop.
To modify which basic troop is eventually given to the notable I "had" to overwrite the method UpdateVolunteersOfNotables completely. I put "had" in quotes because just from my knowledge of C# I couldn't find another way. I tried rewriting the whole behavior but that seemed way to excessive for just a small change like the one I had intended.
Post 1.6.0:
Now as of 1.6.0 within the above mentioned method UpdateVolunteersOfNotables there is a new method called GetBasicVolunteer. This new method is in a new model called (Default)VolunteerProductionModel and it can be overwritten and added as a new custom model. As the name suggests the new method returns either the basic troop or the elite basic troop of the notable's culture. That is a great change! I immediately removed my harmony patch of UpdateVolunteersOfNotables and added a new custom model and overwrote said method...
BUT
The basic troop that gets spawned is actually still determined in the UpdateVolunteersOfNotables behavior method. The new model method GetBasicVolunteer is used for the upgrade system. Basically the basic troop is still taken directly from the settlement's culture just like in the pre 1.6.0 version. And while the basic troop is eventually overwritten with what GetBasicVolunteer returns, you can not directly replace the basic troop directly.
Suggestion:
Instead of taking the basic troop directly from the culture of the notable's current settlement or the notable's clan (when the settlement is null), add another method to the VolunteerProductionModel, something like CharacterObject GetBasicTroop( hero ), and move the following line into that method:
CharacterObject basicTroop = ((hero.CurrentSettlement != null) ? hero.CurrentSettlement.Culture : hero.Clan.Culture).BasicTroop;
Again, my C# knowledge is limited. Perhaps there are better ways of doing this but I still wanted to at least provide some kind of simple solution
Thanks!
-Ad
Pre 1.6.0:
The main method that determines what kind of troop a notable gets is the method UpdateVolunteersOfNotables in the RecruitmentCampaignBehavior. In that method the basic troop is pulled from the settlement's culture. Each culture has exactly one basic troop and one elite elite troop. I don't want to go too much into detail but usually the basic troop is spawned first and then a couple of checks (policies, perks etc.) and some RNG later the basic troop is eventually upgraded the elite basic troop.
To modify which basic troop is eventually given to the notable I "had" to overwrite the method UpdateVolunteersOfNotables completely. I put "had" in quotes because just from my knowledge of C# I couldn't find another way. I tried rewriting the whole behavior but that seemed way to excessive for just a small change like the one I had intended.
Post 1.6.0:
Now as of 1.6.0 within the above mentioned method UpdateVolunteersOfNotables there is a new method called GetBasicVolunteer. This new method is in a new model called (Default)VolunteerProductionModel and it can be overwritten and added as a new custom model. As the name suggests the new method returns either the basic troop or the elite basic troop of the notable's culture. That is a great change! I immediately removed my harmony patch of UpdateVolunteersOfNotables and added a new custom model and overwrote said method...
BUT
The basic troop that gets spawned is actually still determined in the UpdateVolunteersOfNotables behavior method. The new model method GetBasicVolunteer is used for the upgrade system. Basically the basic troop is still taken directly from the settlement's culture just like in the pre 1.6.0 version. And while the basic troop is eventually overwritten with what GetBasicVolunteer returns, you can not directly replace the basic troop directly.
Suggestion:
Instead of taking the basic troop directly from the culture of the notable's current settlement or the notable's clan (when the settlement is null), add another method to the VolunteerProductionModel, something like CharacterObject GetBasicTroop( hero ), and move the following line into that method:
CharacterObject basicTroop = ((hero.CurrentSettlement != null) ? hero.CurrentSettlement.Culture : hero.Clan.Culture).BasicTroop;
Again, my C# knowledge is limited. Perhaps there are better ways of doing this but I still wanted to at least provide some kind of simple solution
Thanks!
-Ad