Resolved [Modding][XSLT]Using XSLT to remove NPCCharacter in lords.xml, then including the same NPCCharacter in an xml in a module causes a crash

Users who are viewing this thread

Version number
Yes, I used mods.


As stated in the title, we are supposed to use XSLT to overwrite lords or remove them and include our own, but using XSLT to remove lords from the native files, then including the same lords in an XML within the module causes a crash when starting a new game.

Is there any reason the lord ID's from our modules aren't being pick up for character creation?
The same method works for clans, settlements, kingdoms, and most other files. It only causes a crash for lords.

XSLT + XML for reference:

Using XML alone, we cannot really alter much regarding vanilla lords, as they tend to combine with vanilla + modded changes rather than overwrite them.

There is a method to replace each and every individual NPC via xslt rather then strip from vanilla + add in XML, but it is extremely tedious and requires the removal of translation lines.


For clans, settlements, and kingdoms, if they are removed from vanilla with xslt, it will scan / use the IDs listed in modules (they have the same ID) and no crash is present. For NPCCharacters / Lords, it appears to stop at vanilla and crash.


some debugging has shown that when creating a new game,
Hero.SetInitialValuesFromCharacter(CharacterObject characterObject)
is being passed nulls, and crashes at characterObject.GetSkillValue(item)


I believe I misinterpreted the documentation that the xslt would only remove from xml with the same name, it apparently removes all NPCCharacters. That is the cause of the crash.

MArdA TaleWorlds

Community Support & Localization
Community Support
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!

MArdA TaleWorlds

Community Support & Localization
Community Support
Hey, here is the message we got from the developers regarding this report. If you need any additional help on this matter please don't hesitate to leave a reply here.
Since your xslt omits all NPCCharacters, reloading Lords only is not enough.
The solution is:
Adding a line to the supplied xslt file:
<xsl:template match = 'NPCCharacter[@occupation="Lord"]'/>
(lords.xslt Final xslt file is in the spoiler tag below)
and reloading these xml files as well since they also include some lords:
1) lords.xml
2) custombattlecharacters.xml
3) obsolete_characters.xml
4) spspecialcharacters.xml
5) story_mode_characters.xml
<xsl:stylesheet version="1.0" xmlns:xsl="">
  <xsl:output omit-xml-declaration="yes"/>
    <xsl:template match="@*|node()">
            <xsl:apply-templates select="@*|node()"/>
    <xsl:template match = 'NPCCharacter[@occupation="Lord"]'/>
Top Bottom