Skip to content
This repository was archived by the owner on May 2, 2023. It is now read-only.

Example

Raymond Wu edited this page May 9, 2020 · 5 revisions

Example

This example XML file overwrites vanilla units with their modded counterparts from Sturgian and Varyag Troop Overhaul, then fixes the resulting troop tree with respect to both vanilla units and the new modded units.

The first thing you will notice is the DependentModules array node. You should specify the modules that need to be loaded first here.

The next thing is the CustomTroopUpgradeOperations array node and its CustomTroopUpgrade subnodes. You can reconfigure troop upgrade paths here.

The last thing is the CustomTroopReplaceOperations array node and its CustomTroopReplacement subnodes. You can specify which troops should be overwritten, and by what other troop, here. They should be different troops; if both are the same troop, you are effectively overwriting a troop with itself. Which is saying, in so many words, that you are doing nothing.

<?xml version="1.0" encoding="utf-8" ?>
<!-- This is an example XML file that show how this mod can be used. It is designed to work with Sturgian and Varyag Troop Overhaul; without it, this is not loaded. -->
<CustomTroopUpgrades Priority="1000"> <!-- Priority indicates when this config should load. Custom Troop Upgrades load configs in ascending order, first by priority. -->
  <DependentModules> <!-- List all modules that need to be loaded before this config can take effect. If two configs have same priority, this array determines load order. -->
    <Module>SturgianArmyReDone</Module>
  </DependentModules>
  <CustomTroopUpgradeOperations> <!-- Everything in this array is loaded AFTER CustomTroopReplaceOperations, below -->
    <!-- The below showcases upgrade path replacements. -->
    <CustomTroopUpgrade Source="sturgian_recruit" Destination="sturgian_warrior" Replaces="sturgian_warrior_new"/>
    <CustomTroopUpgrade Source="sturgian_recruit" Destination="sturgian_woodsman" Replaces="sturgian_woodsman_new"/>
    
    <!-- Sturgian melee -->
    <CustomTroopUpgrade Source="sturgian_warrior" Destination="sturgian_soldier" Replaces="sturgian_soldier_new"/>
    <CustomTroopUpgrade Source="sturgian_soldier" Destination="sturgian_spearman" Replaces="sturgian_spearman_new"/>
    <CustomTroopUpgrade Source="sturgian_spearman" Destination="sturgian_shock_troop" Replaces="sturgian_shock_troop_new"/>
    <CustomTroopUpgrade Source="sturgian_spearman" Destination="sturgian_veteran_warrior" Replaces="sturgian_veteran_warrior_new"/>
    <CustomTroopUpgrade Source="sturgian_t3_axeman" Destination="sturgian_berzerker" Replaces="sturgian_berzerker_new"/>
    <CustomTroopUpgrade Source="sturgian_berzerker" Destination="sturgian_ulfhednar" Replaces="sturgian_ulfhednar_new"/>

    <!-- Sturgian ranged -->
    <CustomTroopUpgrade Source="sturgian_woodsman" Destination="sturgian_brigand" Replaces="sturgian_brigand_new"/>
    <CustomTroopUpgrade Source="sturgian_woodsman" Destination="sturgian_hunter" Replaces="sturgian_hunter_new"/>
    <CustomTroopUpgrade Source="sturgian_hunter" Destination="sturgian_archer" Replaces="sturgian_archer_new"/>
    <CustomTroopUpgrade Source="sturgian_archer" Destination="sturgian_veteran_bowman" Replaces="sturgian_veteran_bowman_new"/>
    <CustomTroopUpgrade Source="sturgian_brigand" Destination="sturgian_hardened_brigand" Replaces="sturgian_hardened_brigand_new"/>
    <CustomTroopUpgrade Source="sturgian_hardened_brigand" Destination="sturgian_horse_raider" Replaces="sturgian_horse_raider_new"/>

    <!-- Warrior sons and varyags - the below showcases upgrade path deletion and addition -->
    <CustomTroopUpgrade Source="sturgian_warrior_son" Destination="varyag_new" DeleteUpgradePath="true" />
    <CustomTroopUpgrade Source="sturgian_warrior_son" Destination="varyag" />
    
    <CustomTroopUpgrade Source="varyag" Destination="vayrag_veteran_new" DeleteUpgradePath="true" />
    <CustomTroopUpgrade Source="varyag" Destination="varyag_veteran" />

    <CustomTroopUpgrade Source="varyag_veteran" Destination="varyag_champion" DeleteUpgradePath="true" />
    <CustomTroopUpgrade Source="varyag_veteran" Destination="druzhinnik" />

    <CustomTroopUpgrade Source="druzhinnik" Destination="varyag_huskarl" DeleteUpgradePath="true" />
    <CustomTroopUpgrade Source="druzhinnik" Destination="druzhinnik_champion" />
  </CustomTroopUpgradeOperations>
  <CustomTroopReplaceOperations> <!-- Everything in this array is loaded BEFORE CustomTroopUpgradeOperations, above -->
    <!-- Sturgian melee -->
    <!-- I could have specified 8388575 as ReplaceFlag, which would cause the mod to replace "everything" in a CharacterObject EXCEPT upgrade targets, -->
    <!-- and then do less work in the above section of CustomTroopUpgradeOperations. -->
    <!-- But I am using 8388607, which indicates replacing "everything", and so that I can show as much as I can about the upgrade operations, above. -->
    <!-- ("Everything" does not include IDs and base character IDs. Also, 8388607 - 8388575 = 32, which is the flag to indicate replacing upgrades.) -->
    <!-- The possible number flags can be found on the mod's GitHub wiki page. Use bitwise operation to obtain a replace flag. -->
    <CustomTroopReplacement Source="sturgian_warrior_new" Destination="sturgian_warrior" ReplaceFlag="8388607" />
    <!-- Absent a ReplaceFlag, the default is 8388607, which means replace everything. Using 0 will cause the mod to default to 8388607. -->
    <CustomTroopReplacement Source="sturgian_soldier_new" Destination="sturgian_soldier" />
    <CustomTroopReplacement Source="sturgian_spearman_new" Destination="sturgian_spearman" ReplaceFlag="0" />
    <CustomTroopReplacement Source="sturgian_shock_troop_new" Destination="sturgian_shock_troop" />
    <CustomTroopReplacement Source="sturgian_veteran_warrior_new" Destination="sturgian_veteran_warrior" />

    <CustomTroopReplacement Source="sturgian_berzerker_new" Destination="sturgian_berzerker" />
    <CustomTroopReplacement Source="sturgian_ulfhednar_new" Destination="sturgian_ulfhednar" />
    <!-- Sturgian ranged -->
    <CustomTroopReplacement Source="sturgian_woodsman_new" Destination="sturgian_woodsman" />
    <CustomTroopReplacement Source="sturgian_hunter_new" Destination="sturgian_hunter" />
    <CustomTroopReplacement Source="sturgian_archer_new" Destination="sturgian_archer" />
    <CustomTroopReplacement Source="sturgian_veteran_bowman_new" Destination="sturgian_veteran_bowman" />
    <CustomTroopReplacement Source="sturgian_brigand_new" Destination="sturgian_brigand" />
    <CustomTroopReplacement Source="sturgian_hardened_brigand_new" Destination="sturgian_hardened_brigand" />
    <CustomTroopReplacement Source="sturgian_horse_raider_new" Destination="sturgian_horse_raider" />

    <!-- Warrior sons and varyags -->
    <CustomTroopReplacement Source="varyag_new" Destination="varyag" />
    <CustomTroopReplacement Source="vayrag_veteran_new" Destination="varyag_veteran" />
    <CustomTroopReplacement Source="varyag_champion" Destination="druzhinnik" />
    <CustomTroopReplacement Source="varyag_huskarl" Destination="druzhinnik_champion" />
  </CustomTroopReplaceOperations>
</CustomTroopUpgrades>

P.S. I strongly recommend Sturgian and Varyag Troop Overhaul. It's found here: https://www.nexusmods.com/mountandblade2bannerlord/mods/63

Clone this wiki locally