How could I make troop tree overhaul and expand mod work in 1.7.0?

Users who are viewing this thread

bfmsc

Recruit
dear game developers and experienced modders:
I am a modder who made an “vanilla expand”type mod, which use xmls to add extra upgrades tree for some vanilla troops, but after the 1.7.0 update my mod become broken. looks like the game can no longer read the same object at the same time.
for example, in the vanilla game there is an troop called "imperial heavy horseman" which can be upgrade into "imperial cataphract". my mod add an extra upgrade tree for the "imperial heavy horseman", to do that, I copy the "imperial heavy horseman"'s data from the original "spnpccharacters" xml to my mod's “npc”xml and told the game to read that xml through a "submodule" file, and in my mod's xml I add an extra upgrade target for it, which is a new troop I made. in the previous versions this works fine, but after 1.7.0, the game crash, and it told me"Object with id imperial_heavy _horseman has already been initialized" when I try to start a new game or load my saves. looks like the game can no longer read the same object twice. so how can I make my mod functional again? please help, thank you!
 
You will have to move your changes to XSLT which is a language that can be used to modify XML documents. First you need to have a XML and XSLT files with the same name. Assuming you are only modifying vanilla characters, you will need a troops.xml file like this, empty:
<?xml version="1.0" encoding="utf-8"?> <NPCCharacters> </NPCCharacters>
which will point the game to your XSLT with the same name (troops.xslt) where the actual changes are. Otherwise, if you have your own new troops with new ids, put them in the XML as you are used to.

You need one XSLT command for each change in each character, and each kind of change you want to make will require a different XSLT command. For example, this is a template on how to change a character's equipments:

<xsl:template match='NPCCharacter[@id="character_id"]/Equipments'> <xsl:copy> <xsl:apply-templates select="@*"/> <EquipmentRoster> ... equipments here </EquipmentRoster> ... other equipment rosters </xsl:copy> </xsl:template>

You should understand some basic XML terminology first.
 
You will have to move your changes to XSLT which is a language that can be used to modify XML documents. First you need to have a XML and XSLT files with the same name. Assuming you are only modifying vanilla characters, you will need a troops.xml file like this, empty:
<?xml version="1.0" encoding="utf-8"?> <NPCCharacters> </NPCCharacters>
which will point the game to your XSLT with the same name (troops.xslt) where the actual changes are. Otherwise, if you have your own new troops with new ids, put them in the XML as you are used to.

You need one XSLT command for each change in each character, and each kind of change you want to make will require a different XSLT command. For example, this is a template on how to change a character's equipments:

<xsl:template match='NPCCharacter[@id="character_id"]/Equipments'> <xsl:copy> <xsl:apply-templates select="@*"/> <EquipmentRoster> ... equipments here </EquipmentRoster> ... other equipment rosters </xsl:copy> </xsl:template>

You should understand some basic XML terminology first.
thanks for your help!
 
You will have to move your changes to XSLT which is a language that can be used to modify XML documents. First you need to have a XML and XSLT files with the same name. Assuming you are only modifying vanilla characters, you will need a troops.xml file like this, empty:
<?xml version="1.0" encoding="utf-8"?> <NPCCharacters> </NPCCharacters>
which will point the game to your XSLT with the same name (troops.xslt) where the actual changes are. Otherwise, if you have your own new troops with new ids, put them in the XML as you are used to.

You need one XSLT command for each change in each character, and each kind of change you want to make will require a different XSLT command. For example, this is a template on how to change a character's equipments:

<xsl:template match='NPCCharacter[@id="character_id"]/Equipments'> <xsl:copy> <xsl:apply-templates select="@*"/> <EquipmentRoster> ... equipments here </EquipmentRoster> ... other equipment rosters </xsl:copy> </xsl:template>

You should understand some basic XML terminology first.
looks like I should learn some basic
 
You will have to move your changes to XSLT which is a language that can be used to modify XML documents. First you need to have a XML and XSLT files with the same name. Assuming you are only modifying vanilla characters, you will need a troops.xml file like this, empty:
<?xml version="1.0" encoding="utf-8"?> <NPCCharacters> </NPCCharacters>
which will point the game to your XSLT with the same name (troops.xslt) where the actual changes are. Otherwise, if you have your own new troops with new ids, put them in the XML as you are used to.

You need one XSLT command for each change in each character, and each kind of change you want to make will require a different XSLT command. For example, this is a template on how to change a character's equipments:

<xsl:template match='NPCCharacter[@id="character_id"]/Equipments'> <xsl:copy> <xsl:apply-templates select="@*"/> <EquipmentRoster> ... equipments here </EquipmentRoster> ... other equipment rosters </xsl:copy> </xsl:template>

You should understand some basic XML terminology first.
And······do I need some change in my submodule xml?
 
You will have to move your changes to XSLT which is a language that can be used to modify XML documents. First you need to have a XML and XSLT files with the same name. Assuming you are only modifying vanilla characters, you will need a troops.xml file like this, empty:
<?xml version="1.0" encoding="utf-8"?> <NPCCharacters> </NPCCharacters>
which will point the game to your XSLT with the same name (troops.xslt) where the actual changes are. Otherwise, if you have your own new troops with new ids, put them in the XML as you are used to.

You need one XSLT command for each change in each character, and each kind of change you want to make will require a different XSLT command. For example, this is a template on how to change a character's equipments:

<xsl:template match='NPCCharacter[@id="character_id"]/Equipments'> <xsl:copy> <xsl:apply-templates select="@*"/> <EquipmentRoster> ... equipments here </EquipmentRoster> ... other equipment rosters </xsl:copy> </xsl:template>

You should understand some basic XML terminology first.


so,if i want to modify the troop with id "sturgian_shock_troop" 's equipment, the xslt will look like that? and I also want to ask the
"<xsl:apply-templates select="@*"/>"line, is the"*" a place holder? if not, what should I put in that place in the situation I mention?

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns: xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match='NPCCharacter[@id="sturgian_shock_troop"]/Equipments'>
<xsl:copy>
<xsl:apply-templates select="@*"/>
<EquipmentRoster>
<equipment slot="Item0"
id="Item.sturgia_sword_5_t4" />
<equipment slot="Item1"
id="Item.northern_spear_3_t4" />
<equipment slot="Item2"
id="Item.strapped_round_shield" />
<equipment slot="Head"
id="Item.sturgian_helmet_b_close" />
<equipment slot="Body"
id="Item.sturgian_lamellar_base" />
<equipment slot="Cape"
id="Item.brass_lamellar_shoulder_white" />
<equipment slot="Leg"
id="Item.strapped_mail_chausses" />
<equipment slot="Gloves"
id="Item.highland_gloves" />
</EquipmentRoster>
<EquipmentRoster>
<equipment slot="Item0"
id="Item.steel_mace_t3" />
<equipment slot="Item1"
id="Item.northern_spear_3_t4" />
<equipment slot="Item2"
id="Item.strapped_round_shield" />
<equipment slot="Head"
id="Item.sturgian_helmet_b_close" />
<equipment slot="Body"
id="Item.sturgian_lamellar_fortified" />
<equipment slot="Cape"
id="Item.brass_lamellar_shoulder_white" />
<equipment slot="Leg"
id="Item.strapped_mail_chausses" />
<equipment slot="Gloves"
id="Item.highland_gloves" />
</EquipmentRoster>
<EquipmentRoster>
<equipment slot="Item0"
id="Item.sturgia_axe_3_t3" />
<equipment slot="Item1"
id="Item.northern_spear_3_t4" />
<equipment slot="Item2"
id="Item.sturgia_old_shield_c" />
<equipment slot="Head"
id="Item.sturgian_helmet_b_open" />
<equipment slot="Body"
id="Item.sturgian_lamellar_base" />
<equipment slot="Leg"
id="Item.strapped_mail_chausses" />
<equipment slot="Gloves"
id="Item.highland_gloves" />
<equipment slot="Cape"
id="Item.scarf" />
</EquipmentRoster>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
 
so,if i want to modify the troop with id "sturgian_shock_troop" 's equipment, the xslt will look like that? and I also want to ask the
"<xsl:apply-templates select="@*"/>"line, is the"*" a place holder? if not, what should I put in that place in the situation I mention?

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns: xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match='NPCCharacter[@id="sturgian_shock_troop"]/Equipments'>
<xsl:copy>
<xsl:apply-templates select="@*"/>

...
That is correct, don't change anything else in the command. XSLTs load so long there's a XML with same name.
 
I am having a similar problem. I am making a very simple mod that sort of just reskins Battania with vanilla armor pieces and while simply overwriting spnpccharacters manually works just fine, integrating the mod with vortex and bannerlords launcher is a bit of a pain and I dont know how to make it work.

I dont know what the submodule is supposed to look like and I am now getting a weird 'CustomGame' dependency that I did not put in the xml and I cannot launch the game with my mod on vortex.

Before this though, the mod like half-worked or something, where the units were a mishmash of ugly vanilla and my mod like split down the middle.

What do I do?

This is what my SubModule looks like atm, bit of a mess

<Module>
<Name value="Fresh Battania"/>
<Id value="FreshBattania"/>
<Version value="v1.0.0"/>
<SingleplayerModule value="true"/>
<MultiplayerModule value="false"/>
<DependedModules>
<DependedModule Id="Native" />
<DependedModule Id="SandBoxCore" />
<DependedModule Id="Sandbox" />
<DependedModule Id="StoryMode" />
</DependedModules>
<SubModules>
</SubModules>
<Xmls>
<XmlNode>
<XmlName id="NPCCharacters" path="spnpccharacters"/>
<IncludedGameTypes>
<GameType value = "Campaign"/>
<GameType value = "CampaignStoryMode"/>
<GameType value = "CustomBattle"/>
<GameType value = "Sandbox"/>
</IncludedGameTypes>
</XmlNode>
</Xmls>
</Module>
^
It doesnt look flat like that in reality, there are spaces and **** between the lines

I just want to be able to make my own changes in spnpccharacters to overwrite the one in Bannerlord/Modules/Sandbox Core/ModuleData, which would be an easy affair in some other games where vortex just bloody backups the file somewhere and puts yours in instead :cautious:

Help much appreciated
 
Back
Top Bottom