Is it easy to mod heroes?

I'd like to make a little mod which gives additional traits and equipment to existing heroes. Is it easy to do? Do I need to create only an xml file? Or what file do I need to change? Where is it located?

15,841 views 9 replies
Reply #1 Top

You need to copy the unit definition from CoreUnits.xml in main installation directory\Data\English to a file in the Mods directory.  You must totally redefine the unit, as when you use the same internal name (eg. "Champion_<NameHere>" matching the internal name of the hero you want to change).  The new hero unit definition will be used in its entirety, so set up the hero in your file in the Mods directory exactly as you want it to appear in the game.  If you want, you can add the tag <DividesBattleExp>0</DividesBattleExp> (or if the tag is already there with a "1" in between, change it to a "0") if you want to prevent certain heroes from dividing battle experience like henchmen.

AFAIK, around all the hero or unit definitions you need to put "<UnitTypes>" without the quotes on the line before you start the hero unit definition, and "</UnitTypes>" without the quotes on the line after you finish the last of the hero unit definition.  Note that as far as LH goes, heroes are just special types of units, that can either be trained (henchmen) or received from fame milestones, quests or events (regular or quest heroes).  Any hero unit, henchmen or champion acquired by fame, that has <DividesBattleExp>0</DividesBattleExp> in the file will not divide battle experience.  Note that <DividesBattleExp>1</DividesBattleExp> is used if the tag is not mentioned in a hero file at all, and make sure <DividesBattleExp>"Number"</DividesBattleExp> does NOT appear more than once in a file.

Reply #2 Top

This is an example of a hero definition for the first unit in the CoreUnits.xml file:

Code: xml
  1. &lt;UnitType InternalName="Champion_Craul"&gt;
  2. &lt;DisplayName&gt;Craul Gravehands&lt;/DisplayName&gt;
  3. &lt;UnitDisplayName&gt;Craul Gravehands&lt;/UnitDisplayName&gt;
  4. &lt;Class&gt;Adventurer&lt;/Class&gt;
  5. &lt;Allegiance&gt;Empire&lt;/Allegiance&gt;
  6. &lt;CreatureType&gt;Champion&lt;/CreatureType&gt;
  7. &lt;RaceType&gt;Race_Type_Trogs&lt;/RaceType&gt;
  8. &lt;Unique&gt;1&lt;/Unique&gt;
  9. &lt;CanBeDesigned&gt;0&lt;/CanBeDesigned&gt;
  10. &lt;Gender&gt;Male&lt;/Gender&gt;
  11. &lt;WageOverride&gt;1&lt;/WageOverride&gt;
  12. &lt;IsNPC&gt;1&lt;/IsNPC&gt;
  13. &lt;IsChampion&gt;1&lt;/IsChampion&gt;
  14. &lt;IsSovereign&gt;0&lt;/IsSovereign&gt;
  15. &lt;SpawnRating&gt;1&lt;/SpawnRating&gt;
  16. &lt;NPCSpawnLikelihood&gt;100&lt;/NPCSpawnLikelihood&gt;
  17. &lt;GameModifier&gt;
  18. &lt;ModType&gt;Resource&lt;/ModType&gt;
  19. &lt;Attribute&gt;Unrest&lt;/Attribute&gt;
  20. &lt;Value&gt;-5&lt;/Value&gt;
  21. &lt;Provides&gt;-5% Unrest in the city this unit is in&lt;/Provides&gt;
  22. &lt;/GameModifier&gt;
  23. &lt;LevelMilestone InternalName="L1"&gt;
  24. &lt;Level&gt;1&lt;/Level&gt;
  25. &lt;UnitStat_Accuracy&gt;80&lt;/UnitStat_Accuracy&gt;
  26. &lt;UnitStat_CombatSpeed&gt;22&lt;/UnitStat_CombatSpeed&gt;
  27. &lt;UnitStat_ChanceToCrit&gt;1&lt;/UnitStat_ChanceToCrit&gt;
  28. &lt;UnitStat_HitPoints&gt;20&lt;/UnitStat_HitPoints&gt;
  29. &lt;/LevelMilestone&gt;
  30. &lt;SelectedAbilityBonusOption&gt;Blood_Trog&lt;/SelectedAbilityBonusOption&gt;
  31. &lt;SelectedAbilityBonusOption&gt;Earth1&lt;/SelectedAbilityBonusOption&gt;
  32. &lt;SelectedAbilityBonusOption&gt;Revenge&lt;/SelectedAbilityBonusOption&gt;
  33. &lt;AutoCreateEquipment&gt;Axe_Trog&lt;/AutoCreateEquipment&gt;
  34. &lt;AutoCreateEquipment&gt;Potion_TrogBlood&lt;/AutoCreateEquipment&gt;
  35. &lt;Equipment&gt;F_Male_Head_06&lt;/Equipment&gt;
  36. &lt;Equipment&gt;Fallen_Leather_Pants_ID2&lt;/Equipment&gt;
  37. &lt;Equipment&gt;Large_Sion_Boots_ID1&lt;/Equipment&gt;
  38. &lt;Quote&gt;&#39;My father was the first man that struck me, and the first that I put into the ground for it.&#39;&lt;/Quote&gt;
  39. &lt;NPCRecruitmentText&gt;I can be of service. If you wish to hire me for %d gildar.&lt;/NPCRecruitmentText&gt;
  40. &lt;Backstory&gt;You have not heard of Craul? It was I who made the desert of Hengameh bloom, without water. It was I who caused the long grass of ancient Malaya to grow once more, so that the great herds of horse could return. I have made my peace with the Elemental Lords, and they have granted me a special way with the living things that grow upon the land.&lt;/Backstory&gt;
  41. &lt;AnimationPack&gt;MaleSovereignAnimationPack&lt;/AnimationPack&gt;
  42. &lt;BattleAnimationBehavior&gt;Melee&lt;/BattleAnimationBehavior&gt;
  43. &lt;ClothMapScale&gt;1.6&lt;/ClothMapScale&gt;
  44. &lt;ClothPoseIndex&gt;6&lt;/ClothPoseIndex&gt;
  45. &lt;Color_Clothing1&gt;56,33,13,255&lt;/Color_Clothing1&gt;
  46. &lt;Color_Clothing2&gt;184,148,85,255&lt;/Color_Clothing2&gt;
  47. &lt;Color_Hair&gt;177,187,197,255&lt;/Color_Hair&gt;
  48. &lt;Color_Metal&gt;80,75,90,255&lt;/Color_Metal&gt;
  49. &lt;Color_Skin&gt;133,128,128,255&lt;/Color_Skin&gt;
  50. &lt;CutSceneDataPack&gt;DefaultUnitCutscenePack&lt;/CutSceneDataPack&gt;
  51. &lt;EyeTexture&gt;gfx\eyes\blinks\eyeblink_m3_cataract.png&lt;/EyeTexture&gt;
  52. &lt;InfoCardBackground&gt;BG_EmpireRugged&lt;/InfoCardBackground&gt;
  53. &lt;ModelPath&gt;Gfx\HKB\Units\F_Male_Mesh_01.hkb&lt;/ModelPath&gt;
  54. &lt;ModelScale&gt;1&lt;/ModelScale&gt;
  55. &lt;MovingSFX&gt;TEMP_KnightMarching1&lt;/MovingSFX&gt;
  56. &lt;OnHitParticleName&gt;Bloody_OnHit&lt;/OnHitParticleName&gt;
  57. &lt;SkeletonPath&gt;Gfx\HKB\Units\K_Male_Skeleton_01.hkb&lt;/SkeletonPath&gt;
  58. &lt;SoundPack&gt;SoundPack_Generic_Male&lt;/SoundPack&gt;
  59. &lt;TacticalModelScale&gt;1.6&lt;/TacticalModelScale&gt;
  60. &lt;Texture_Eyes&gt;gfx\eyes\blinks\eyeblink_m3_cataract.png&lt;/Texture_Eyes&gt;
  61. &lt;Texture_Skin&gt;Trog_Skin_M_03.png&lt;/Texture_Skin&gt;
  62. &lt;UnitModelType&gt;FallenMale&lt;/UnitModelType&gt;
  63. &lt;/UnitType&gt;

Note that it is best to use the indentations like they already are in the core file for readability, rather than putting them all at the start of the line that happens when you put them into the Stardock forums.

Reply #3 Top

But if I want that Craul Gravehands to have more traits and more equipment, do I only need to make additions in CoreUnits.xml file?

For example I want him to have Leather armor vest and give additional trait Lethal I, so is it enough to add something like this?

<SelectedAbilityBonusOption>Lethal_I</SelectedAbilityBonusOption>
<AutoCreateEquipment>Leather_armor</AutoCreateEquipment>

 

Reply #4 Top

If you want to edit the core files, yes you can just edit CoreUnits.xml.  However if you want to provide a mod to others you will need to copy the whole hero unit definition to the mod folder and make it exactly how you want it.

To add from existing items, you will need to use the InternalName from CoreItems.xml, CoreArmor.xml or CoreWeapons.xml.  As long as the name you put as equipment is the same as that in these core files, it will add that to the hero.

To add from existing traits/skills, you need to check out the CoreAbilities.xml file and copy the InternalName from one of those traits/skills.

+1 Loading…
Reply #5 Top

Thank you! I'll try to make my small mod, because I don't like that high level heroes have 1 trait per level less than 1-level heroes. Also I'd like to give some equipment to make heroes more valuable, especially those high level heroes.

Reply #6 Top

To create a completely new hero, create a custom sovereign with the appearance you want and move their file from the Units folder to the Mods folder (or if basing on a monster, copy a monster from CoreMonsterUnitTypes.xml but note that LevelMilestones above 1 don't appear to make any difference to monsters who are champions) and delete all the lines that refer to Sov-only and faction only abilities such as summoning starting units, AI player strategy/related traits as well as skills you don't want them to have etc.  Leave all the graphics and sound options.  Make sure the "1" in the <IsSovereign>1</IsSovereign> tag has been changed to a "0", and the "0" in the <IsChampion>0</IsChampion> is changed to a "1", and that you have in the hero unit definition all of the following (except the first one, which is optional, and some of the others which are not needed PROVIDED you get them from a Quest or Random Event):

 

<Class>ProfessionTypeHere</Class> (this is optional, and allows you to give a Champion one of the Sovereign professions to start with, though I am not sure if all of these apply faction wide if a champion rather than a sov has it, this would have to checked)

<IsNPC>1</IsNPC>

<SpawnRating>StartingHeroLevelHere</SpawnRating> (this number is 1, 3, 5, 7, or 9 or higher if you have edited CoreGameEvents.xml and made some fame milestone rewards give a <Level>LevelNumberHere</Level> hero instead of -1 which currently applies to fame milestones of 800 and above and gives a completely random hero of any level, if this line does not appear with a correct matching SpawnRating from hero file and <Level>LevelHere</Level> from CoreGameEvents.xml for that fame milestone then this hero will never show up from a fame milestone)

<NPCSpawnLikelihood>100</NPCSpawnLikelihood> (you can replace the 100 with a lower number if you want this champion to appear less often than others, which is not really a good idea if you have lots of heroes - if this line is not present I don't think the hero will appear at any fame milestones)

<Allegiance>PutKingdomOrEmpireWordHere</Allegiance> (Put Kingdom or Empire between the opening and closing Allegiance tags instead of the placeholder words, note you are allowed to have normally empire or kingdom races as the opposite side, for example Urxen as Kingdom allegiance or monster races as Kingdom or Empire Allegiance - if it doesn't have a suitable Kingdom or Empire Allegiance it will never show up in fame milestones but can still be used as Quest or Random Event heroes)

<CreatureType>ChampionOrMonsterTypeHere</CreatureType> (If this hero is from one of the playable races, Champion would normally replace the placeholder text, if it is a monster the words (without commas or brackets) Beast, Elemental, Undead, Twisted or Construct (not sure if Golem is one too or whether that's only in mods) would be here instead and these are used to determine if extra damage is applied to them by certain weapons or abilities or whether abilities like Beastlord work on them, also there are some abilities that do extra damage to champions, I'm not sure if they check whether a hero is a champion or sovereign or not, or just whether they are Champion creature type)

Customise the built-in equipment (any non-consumable item can be made as <Equipment>EquipmentInternalNameHere</Equipment> to be built-in or "soulbound" to the hero - that equipment will not be able to be sold and will appear when nothing else is equipped manually into that slot - you can even equip chain or plate armor or higher level requirement items as built-in equipment even if the hero does not start with Chain or Plate proficiency or the minimum level - consider this equipment similar to clothes - it applies when nothing else replaces it, but will always be there if nothing else is equipped to that slot - note I think if trinkets are in-built/soulbound they will always count their bonuses but will not be replaced or overwritten by manually equipped trinkets, like how henchmen built with trinkets work)

Note for previous point: If you are using built-in/soulbound equipment you need to delete the clothes for that part of the body, otherwise it might not work.  Clothes in LH are essentially armor pieces with no bonuses, and you can't have two pieces of soulbound armor in the same slot. =)  If you have a soulbound item and an equipped transferable item in the same slot the transferable will take precedence, but the soulbound item will return if there is nothing in the slot.  But you can't have two soulbound pieces of armor (or weapons I would think) in the same slot or only one of them will apply.

Equipment that you want to be transferable is created as <AutoCreateEquipment>EquipmentInternalNameHere</AutoCreateEquipment> and it will be auto-equipped if possible, even possibly violating level or chain/plate requirements, though if you want to do this it is better to create it as built-in/soulbound equipment (ie. use <Equipment>EquipmentInternalNameHere</Equipment> instead).  If you have any transferable item that the champion does not meet the level or armor requirements for, if you unequip it at ANY time if will NOT be able to be re-equipped until the requirements are met.

Note, transferrable items include all one-use items including scrolls, healing items, tomes etc.  These items don't appear to work, or even appear on the hero, when in-built - in other words you cannot give a one-use item that can only be used by the hero that starts with it.

Customise starting traits.

 

That's a brief runthrough of what I know about making or customising heroes.  Hope this is helpful to anyone interested in editing or creating new heroes!

Reply #7 Top

Quoting StevenAus, reply 6
Equipment that you want to be transferable is created as <AutoCreateEquipment>EquipmentInternalNameHere</AutoCreateEquipment>

This particularly is very useful to me. Thanks again!

Reply #8 Top

And the rest of this stuff can be useful to other modders too, since I learned a fair amount about heroes when working on my I Need To Move and I Wish To Serve hero mods.  And the name of this thread is pretty general, which should make it come up in searches about hero modding or hero mods more often than not.

Reply #9 Top

I've made some changes/addition to my comprehensive post above regarding the need to remove in-built clothes items if you are putting in-built/soulbound armor items in that soulbound slot.