In Progress Rebellion Party Leaders Might Have Civilian Armor

Users who are viewing this thread

Version number
1.5.9
Branch
Main
Modded/unmodded
No, I didn't use any mods.

Bloc

Archduke
WB
Summary:
Not entirely sure if this is a proper way to explain this but here we go.
Based on the current codebase, rebellion leaders can have civilian equipment rather than battle equipment. This is mainly because of the issue on education_character templates.

This creates several issues, first and most obvious, they are more susceptible to get killed in the battles because of this armour penalty. Secondly, this looks strange on the campaign map and thirdly, if the same template logic is used for other lord generation, then this can also cause the same issue for newly spawned lords.
The issue is the following:
We have the following method in RebellionsCampaignBehavior
private void CreateRebelPartyAndClan(Settlement settlement)
I won't go into specific details however it's using the following piece for template fetching.
C#:
List<CharacterObject> e = new List<CharacterObject>();
      foreach (CharacterObject template in CharacterObject.Templates)
      {
        if (template.Occupation == Occupation.Lord && template.Culture == settlement.Culture)
          e.Add(template);
      }
This looks okay at first glance however, we have things like the following in education_character_templates.xml
XML:
<NPCCharacter id= "child_education_templates_stage_2_page_0_branch_0_battania"
                name = "{=!}stage_2_page_0_branch_0_battania"
                age = "45"
                default_group = "Infantry"
                is_hero = "false"
                occupation = "Lord"
                culture = "Culture.battania"
                skill_template = "SkillSet.infantry_heavyinfantry_level1_template_skills"
                is_template="true">
    <face>
      <face_key_template value = "BodyProperty.fighter_battania" />
    </face>
    <skills/>
    <Equipments>
      <EquipmentRoster>
        <equipment slot="Head" id="Item.ridged_northernhelm" />
        <equipment slot="Cape" id="Item.battania_shoulder_strap_cloak" />
        <equipment slot="Body" id="Item.ranger_mail" />
        <equipment slot="Gloves" id="Item.ragged_armwraps" />
        <equipment slot="Leg" id="Item.battania_fur_boots" />
      </EquipmentRoster>
      <EquipmentRoster civilian="true"/>
    </Equipments>
  </NPCCharacter>
And the template code piece above is able to pick this one and since this equipment roster doesn't have any battle-ready equipment, lords spawned with this equipment is destined to be killed or defeated unless they gather big armies.

Solution:
Following code ensures that no education/child template is fetched for lord template generation. This is based on StringId so it might not be perfectly reliable.
C#:
List<CharacterObject> e = new List<CharacterObject>();
      foreach (CharacterObject template in CharacterObject.Templates)
      {
        if (template.Occupation == Occupation.Lord && template.Culture == settlement.Culture && !template.StringId.Contains("child") && !template.StringId.Contains("education"))
          e.Add(template);
      }
Another solution would be removing the occupation = "Lord" tag from education templates. Since education templates don't seem to be fetched by their "occupation", this removal shouldn't cause any issue.
C#:
if (this.Target == EducationCampaignBehavior.ChildAgeState.Year8)
        {
          if (result == 0)
            characterObject = Game.Current.ObjectManager.GetObject<CharacterObject>(string.Format("child_education_templates_stage_{0}_page_0_branch_{1}_{2}", (object) (int) this.Target, (object) strArray[2], (object) child.Culture.StringId));
          else
            characterObject = Game.Current.ObjectManager.GetObject<CharacterObject>(string.Format("child_education_templates_stage_{0}_page_0_branch_{1}_{2}", (object) (int) this.Target, (object) previousOptions[0].Split(';')[2], (object) child.Culture.StringId));
        }

How to Reproduce:
Check source code and explanation above

Have you used cheats and if so which:
I checked the source code. Could be considered as real-life cheating I guess ¯\_(ツ)_/¯
 

MArdA TaleWorlds

Community Support & Localization
Community Support
M&BWBWF&SNWVC
Forwarded to the QA team for further investigation. We will reach out again if we need more information. Thanks for reporting and sorry for any inconvenience!
 
Top Bottom