Custom Hero Modding Guide

Take up the role of a great wizard, wield powerful spells, command fantasy races and challenge your rivals in this remake of a cult turn-based strategy classic. Do you have what it takes to become Master of Magic?
Post Reply
XethNyrrow
Corporal - 5 cm Pak 38
Corporal - 5 cm Pak 38
Posts: 33
Joined: Fri Apr 01, 2022 4:15 pm

Custom Hero Modding Guide

Post by XethNyrrow »

I made a guide to help people make their own heroes and add them to the game. It's available on steam and below Custom Hero Modding Guide

Xeth's Custom Hero Guide for Master of Magic (MuHa/Slitherine - 2022)

Rev. 1.0.0: 2023-01-15: Initial Public Release.
-----------------------------------------------
This guide will help you create your own custom hero to add to the game and optionally allow you to start a game with the hero. XML code is provided that can be copy and pasted in to your files then altered to match the data you want.

We will be creating a hero named, "Noob the New" (or, "NOOB" as used in the files) as an example. You can use the default Notepad in Windows to make the files but I recommend a free XML editor such as Notepad++ to make editing easier. Six XML files need to be created and added to the Database folder located by default in C:\Program Files (x86)\Steam\steamapps\common\MuHa Master of Magic\ExternalAssets\Database\. Two optional files may be added to enable starting a new game with the hero.

Matching the file names similarly to their matching base game counterparts is ideal with extra info added at the end to describe the mod. Also make sure to follow capitalization throughout your files and coding. Here is a list of the game files along with what we will be naming their counter parts:

- DB_GROUP.xml -> DB_GROUP_NOOB_THE_NEW.xml
- DB_LOCALIZATION_DES.xml -> DB_LOCALIZATION_DES_NOOB_THE_NEW.xml
- DB_SOUND.xml -> DB_SOUND_NOOB_THE_NEW.xml
- DB_SPELL.xml -> DB_SPELL_NOOB_THE_NEW.xml
- DB_SUBRACE.xml -> DB_SUBRACE_NOOB_THE_NEW.xml
- DB_TAG_QUEST.xml -> DB_TAG_QUEST_NOOB_THE_NEW.xml
- (Optional) DB_DIFFICULTY.xml -> DB_DIFFICULTY_NOOB_THE_NEW.xml
- (Optional) DB_LOCALIZATION_UI.xml -> DB_LOCALIZATION_UI_NOOB_THE_NEW.xml

-----------------------------
* DB_GROUP_NOOB_THE_NEW.xml *
-----------------------------
This file tells the game if the hero is a regular hero or a champion. The file must start with <DB_GROUP> and end with </DB_GROUP>. To add Noob as a regular hero:

<DB_GROUP>
<GROUP-HERO_NOOB>
<Heroes VALUE="HERO-NOOB"/>
<CreationScript VALUE="EventGroup"/>
</GROUP-HERO_NOOB>
</DB_GROUP>


To make him a champion instead it's slightly different and yes, <Heroes VALUE="HERO-NOOB"/> is correct here too:

<DB_GROUP>
<GROUP-CHAMPION_NOOB>
<Heroes VALUE="HERO-NOOB"/>
<CreationScript VALUE="EventGroup"/>
</GROUP-CHAMPION_NOOB>
</DB_GROUP>

----------------------------------------
* DB_LOCALIZATION_DES_NOOB_THE_NEW.xml *
----------------------------------------
This file contains readable text in game and defines the names for the AI versions of the hero as well as the hero's bio. Also this file is a little tricky as the second header has to be different than the base game file name. Here we use _NOOB_THE_NEW again in the second header to make it work. Using {0} in the the quotes of <Loc Key="DES_NOOB_DES" Value=" "/> tells the game to use the hero's full name and title and would read, "Noob the New" not {0}:

<DB_LOCALIZATION>
<LOCALIZATION-DES_EN_NOOB_THE_NEW Language="English">
<Loc Key="DES_NOOB" Value="Noob the New" />
<Loc Key="DES_NOOB1" Value="Nooba the New" />
<Loc Key="DES_NOOB2" Value="Noobe the New" />
<Loc Key="DES_NOOB3" Value="Noobi the New" />
<Loc Key="DES_NOOB4" Value="Noobo the New" />
<Loc Key="DES_NOOB_DES" Value="{0} is new to the game. He hopes you let him stay in your army until the end of the campaign instead of killing him off via a Sky Drake suicide run because you'd rather have Warrax. " />
</LOCALIZATION-DES_EN_NOOB_THE_NEW>
</DB_LOCALIZATION>

-----------------------------
* DB_SOUND_NOOB_THE_NEW.xml *
-----------------------------
This file tells the game what sound files to use when certain actions involving the hero are triggered. Note the extra Sfx="true" in the header needs to be added. Here we use _NOOB_THE_NEW again in the second header to make it work. You can use existing sound effects found in the default C:\Program Files (x86)\Steam\steamapps\common\MuHa Master of Magic\ExternalAssets\Sound\SFX\ folder or add your own. Here we use Zaldron's sound files by first referencing the folder before the \ then the actual .wav file right afterwards. Exclude the entire, "NoobAttackRanged" and "NoobRangedHit" lines for heroes without ranged attacks.:

<DB_SOUND>
<SOUND_LIST-SFX_NOOB_THE_NEW Sfx="true">
<Sound Name="NoobAttackMelee" File="Zaldron\ZaldronAttackMelee.wav"/>
<Sound Name="NoobAttackRanged" File="Zaldron\ZaldronAttackRanged.wav"/>
<Sound Name="NoobAttackRangedHit" File="Zaldron\ZaldronAttackRangedHit.wav"/>
<Sound Name="NoobGetHit" File="Zaldron\ZaldronGetHit.wav"/>
<Sound Name="NoobDie" File="Zaldron\ZaldronDie.wav"/>
<Sound Name="NoobMove" File="HorseMove.wav"/>
</SOUND_LIST-SFX_NOOB_THE_NEW>
</DB_SOUND>


If adding custom sound files, create a folder and add files with matching names referencing the hero such as, "Noob" in this case:

<DB_SOUND>
<SOUND_LIST-SFX>
<Sound Name="NoobAttackMelee" File="Noob\NoobAttackMelee.wav"/>
<Sound Name="NoobAttackRanged" File="Noob\NoobAttackRanged.wav"/>
<Sound Name="NoobAttackRangedHit" File="Noob\NoobAttackRangedHit.wav"/>
<Sound Name="NoobGetHit" File="Noob\NoobGetHit.wav"/>
<Sound Name="NoobDie" File="Noob\NoobDie.wav"/>
<Sound Name="NoobMove" File="Noob\NoobMove.wav"/>
</SOUND_LIST-SFX>
</DB_SOUND>

Note: There is some difference with the declaration of the move sound. The default location for the move sounds are in the main SFX folder and are called HorseMove.wav and HorseHeavyMove.wav. It's also not necessary to declare them here to use them later but is shown for consistency and recommended as a good practice.

-----------------------------
* DB_SPELL_NOOB_THE_NEW.xml *
-----------------------------
This file give heroes their own extra spells in their spell books to use in battle. If the hero is not a caster then you can skip this step (and file) completely. It's easiest to reference then copy/paste what spell(s) you want from the game's DB_SPELL.xml file:

<DB_SPELL>
<SPELL_PACK-NOOB>
<Spell VALUE="SPELL-HEALING"/>
<Spell VALUE="SPELL-HOLY_ARMOR"/>
<Spell VALUE="SPELL-LIONHEART"/>
</SPELL_PACK-NOOB>
</DB_SPELL>

-------------------------------
* DB_SUBRACE_NOOB_THE_NEW.xml *
-------------------------------
This is where the bulk of the hero info goes such as stats and skills. <DescriptionInfo Graphic="#####" /> where ##### needs to be the name of an existing unit (but doesn't have to be a hero) as new art cannot be added (yet). Reference the DB_SUBRACE.xml file then copy/paste in what you like. For Noob we make him look like Brax but he could look like a unicorn or a catapult if we wanted. <AlterName VALUE="DES_NOOB1"/> 2, 3 and 4 need to match the entries from the DB_LOCALIZATION_DES_NOOB_THE_NEW.xml file.

To add skills, it's easiest to reference then copy/paste what you want from the game's DB_SUBRACE.xml file. For randomized skill picks, add one <SkillPacks VALUE="SKILL_PACK-#####_SKILLS"/> line PER PICK where ##### is ANY, FIGHTER, MAGE, or ANY_SKILLS_NO_ARCANE_POWER (Torin and Alorra use this last one). Noob here has the skills of a magical ranged attack from the Nature realm, the caster 10 (mana) skill plus two, "ANY" class random skills and his own spell book. The rest of the numbers should be fairly self explanatory but you can always reference the DB_SUBRACE.xml file for research. Any lines referencing range or ammo can be omitted if the hero doesn't have ranged capabilities. For sounds, reference the same sound files used in the DB_SOUND_NOOB_THE_NEW.xml file.

Note for a champion, use <Tags Amount="1" Tag="TAG-CHAMPION_CLASS"/> instead of <Tags Amount="1" Tag="TAG-HERO_CLASS"/> and <Marker VALUE="IconChampion"/> instead of <Marker VALUE="IconHero"/>. Also <Champion VALUE="TRUE"/> needs to be added ideally under the last <AlterName VALUE=""/> to mark it as a champion for the Summon Champion spell:

<DB_SUBRACE>
<HERO-NOOB>
<DescriptionInfo Name="DES_NOOB" Description="DES_NOOB_DES" Graphic="Brax" />
<AlterName VALUE="DES_NOOB1"/>
<AlterName VALUE="DES_NOOB2"/>
<AlterName VALUE="DES_NOOB3"/>
<AlterName VALUE="DES_NOOB4"/>
<Race VALUE="RACE-HERO"/>
<Marker VALUE="IconHero"/>

<Tags Amount="4" Tag="TAG-MOVEMENT_POINTS"/>
<Tags Amount="1" Tag="TAG-CAN_WALK"/>

<Tags Amount="2" Tag="TAG-UPKEEP_GOLD"/>
<RecruitmentCost VALUE="100"/>
<RecruitmentMinFame VALUE="0"/>
<NaturalHealing VALUE="TRUE"/>
<GainsXP VALUE="TRUE"/>

<Tags Amount="5" Tag="TAG-MELEE_ATTACK"/>
<Tags Amount="5" Tag="TAG-RANGE_ATTACK"/>
<Tags Amount="5" Tag="TAG-AMMUNITION"/>
<Tags Amount="4" Tag="TAG-DEFENCE"/>
<Tags Amount="10" Tag="TAG-RESIST"/>
<Tags Amount="8" Tag="TAG-HIT_POINTS"/>
<Tags Amount="0.3" Tag="TAG-MELEE_ATTACK_CHANCE"/>
<Tags Amount="0.3" Tag="TAG-RANGE_ATTACK_CHANCE"/>
<Tags Amount="0.3" Tag="TAG-DEFENCE_CHANCE"/>
<Tags Amount="1" Tag="TAG-HERO_CLASS"/>

<Skills VALUE="SKILL-HERO_LEVEL"/>
<Skills VALUE="SKILL-MELEE_ATTACK"/>
<Skills VALUE="SKILL-ENCHANTED_WEAPON1"/>
<Skills VALUE="SKILL-MAGIC_NATURE_RANGE_ATTACK"/>
<Skills VALUE="SKILL-CASTER_10"/>

<SkillPacks VALUE="SKILL_PACK-ANY_SKILLS"/>
<SkillPacks VALUE="SKILL_PACK-ANY_SKILLS"/>
<SpellPack VALUE="SPELL_PACK-NOOB"/>

<EquipmentSlot VALUE="ARTEFACT_SLOT-MELEE_SPELLCASTER"/>
<EquipmentSlot VALUE="ARTEFACT_SLOT-ARMOUR"/>
<EquipmentSlot VALUE="ARTEFACT_SLOT-MISC"/>
<Tags Amount="1" Tag="TAG-MALE"/>
<Audio Move="NoobMove" AttackMelee="NoobAttackMelee" AttackRanged="NoobAttackRanged" AttackRangedHit="NoobAttackRangedHit" GetHit="NoobGetHit" Die="NoobDie"/>
</HERO-NOOB>
</DB_SUBRACE>

---------------------------------
* DB_TAG_QUEST_NOOB_THE_NEW.xml *
---------------------------------
I am not sure what this file does honestly, I think it's supposed to relate to possible special events/quests involving heroes. We need 2 entries, NOOB1 and NOOB2 and the rest is the same:

<DB_TAG_QUEST>
<TAG-QUEST_NOOB1>
<DescriptionInfo Name="DES_TAG_MY_TAG" Description="DES_TAG_MY_TAG_DES" Graphic="IconPlaceholder"/>
</TAG-QUEST_NOOB1>
<TAG-QUEST_NOOB2>
<DescriptionInfo Name="DES_TAG_MY_TAG" Description="DES_TAG_MY_TAG_DES" Graphic="IconPlaceholder"/>
</TAG-QUEST_NOOB2>
</DB_TAG_QUEST>

---------------------------------------------
* (Optional) DB_DIFFICULTY_NOOB_THE_NEW.xml *
---------------------------------------------
This adds the hero to the list of starting heroes you can use when beginning a new game. You can to keep B'Shan as an option or even add other heroes here. Make sure only one hero has the QuickStart="TRUE" tag and this is needed for that start option:

<DB_DIFFICULTY>
<DIFFICULTY-ADD_HERO
Name="UI_ADD_HERO"
FullValue="20">
<TooltipName VALUE="UI_ADD_HERO"/>
<TooltipDescription VALUE="UI_ADD_HERO_DES"/>
<Setting Title="UI_BSHAN" Value="HERO-BSHAN" Difficulty="0" Collection="0" QuickStart="TRUE"/>
<Setting Title="UI_NOOB" Value="HERO-NOOB" Difficulty="0" Collection="0"/>
<Setting Title="UI_NONE" Value="0" Difficulty="20" Collection="1"/>
</DIFFICULTY-ADD_HERO>
</DB_DIFFICULTY>

--------------------------------------------------
* (Optional) DB_LOCALIZATION_UI_NOOB_THE_NEW.xml *
--------------------------------------------------
This is a separate text localization file specifically for the UI to display the hero's name in the list of starting heroes. You can put whatever you want here but the field is small in the UI and I recommend just the hero's name without title:

<DB_LOCALIZATION>
<LOCALIZATION-UI_EN_NOOB_THE_NEW Language="English">
<Loc Key="UI_NOOB" Value = "Noob"/>
</LOCALIZATION-UI_EN_NOOB_THE_NEW>
</DB_LOCALIZATION>

--------------
* Final step *
--------------
Important! In the C:\Program Files (x86)\Steam\steamapps\common\MuHa Master of Magic\ExternalAssets\ folder, there is a file named, "powerTrainingData.bin" that needs to be renamed or deleted. I suggest renaming it to powerTrainingData.bin.old so you can easily reuse it if you choose to remove the mod. This is a caching file that needs to be rebuilt when you start the game after adding all the files for any mod. It can take quite a while the first time you start a game afterwards. The loading screen bar will stay stuck half way for a LONG time (20+ minutes even, but usually 5-10 minutes) and it may even show as not responding. If an error message pops up, check for typos/syntax errors in your files. Sometimes the Player.log located by default at C:\Users\<username>\AppData\LocalLow\MuHa Games\MoM\ will reference a line number which will match the issue. If you use Notepad++ it shows line numbers that can help save time.

If the game loads then you have success! At this point the new hero can be recruited, rescued from a lair, summoned with the appropriate summoning spell and possible started with if you use the optional files. If you have any questions or feedback please let me know!

~ Xeth Nyrrow ~
Discord: Xeth Nyrrow#4312
Email: xethnyrrow@hotmail.com
-----------------------------------------------
Rev. 1.0.0: 2023-01-15: Initial Public Release.
Post Reply

Return to “Master of Magic”