Creating wanderers from simple to unnecessarily tedious past 1.7

Users who are viewing this thread

Hello,

After a break for personal reasons and cause i was a bit fed up to have Taleworlds meticulously aiming and destroying my mods one after the other i'm back at it and tried to fix all the mess when it was possible.

That brings me to the annoying and unnecessary tedious way you now have to make custom wanderers templates spawn in game, and looking on the nexus, most of those mods are now outdated and abandoned (except a few like StoleMyCoconut's or CarolinaWarlord from the discord who helped me here).

So, before you made a XML file with your new characters inside, another for the strings needed to recruit him/her and voila, it was working smoothly but since 1.7 some genius thought it would be nice to not have them loaded unless they were added to a culture file.

So now basically to add a new wanderer or companion, you have 3 possibilities :

  1. You override the native culture and add what you need, this will obviously makes your mod pretty incompatible with any other mod changing the culture files.
  2. You create a new culture, if you are already adding one, perfect, if not, you will have to create a dummy, what is tedious and it will show up in the encyclopedia and at culture selection screen.
  3. Use XSLT to change the native culture without overriding it and adding simply what you want. It might cause save incompatibility if you add more but haven't tested so far.
So apparently 2 is the best choice if you are already making a new culture, if not, the 3 is the way to go.

Joining the XSLT i'm using

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:strip-space elements="*"/> <!-- identity transform --> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="Culture[@id='empire']/notable_and_wanderer_templates"> <xsl:copy> <xsl:copy-of select="*"/> <template name="NPCCharacter.your_wanderer_template_here" /> </xsl:copy> </xsl:template> </xsl:stylesheet>
You need then to add a node to your submodule.xml like this

<Xmls> <XmlNode> <XmlName id="SPCultures" path="your_xslt_file_name"/> <IncludedGameTypes> <GameType value = "Campaign"/> <GameType value = "CampaignStoryMode"/> </IncludedGameTypes> </XmlNode> </Xmls>
 
Last edited:
Ok it's the second option that needs to be avoided as much as possible, cause removing a mod that adds a culture to the game makes your saves crash.
So if you change the way you put a wanderer in the game it will make all older saves incompatible, while the XSLT solution keeps compatibility.
 
They really can't be added somehow programatically through C#? Normally I would try to avoid the above methods because they seem like they can break easily or too many weird side effects.
 
The XSLT can't break easily, using C# for something like this is actually to my point of view the way to break everything. The XML files changes a lot less often than the internal code from my experience lol.

I've been messing a bit with the XSLT part for a few days now and i see no drawback to using this method (except it's still more complicated than what it was before)
 
Back
Top Bottom