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
e1.8.0
Branch
Main
Modded/unmodded
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: https://drive.google.com/drive/folders/1rmDc0oG3_knYUWRgEGrfm32APTxc7zPu?usp=sharing

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.
 
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
Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output omit-xml-declaration="yes"/>
    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>
    <xsl:template match = 'NPCCharacter[@occupation="Lord"]'/>
</xsl:stylesheet>
 
Back
Top Bottom