How do you create a special Unit_Level trait for a specific Champion or Race, and not overwrite another Champion Trait?

I'm sure someone has answered this before, but it's hard to find in the search.  I know you can make a special levelup trait for a specific race (I've seen an example in Children of Storm).  I've also had a look at Heroic Pursuits mod.

So:

1. Is it possible to create a special levelup trait for a specific Champion, or only for a specific race?

2. I take it if the PerkTree X and Y tag position for a particular levelup trait match, they overwrite a particular levelup trait with the same X,Y position UNLESS it is for a different Path/Trait Tree?

3. I would love it if you could provide a trait, or a custom accessory to a unit such as a champion that ONLY provided its bonus when all prereqs are fulfilled, including minimum level, but would not require another trait (so it would be triggered immediately all prereqs are satisfied).  But this would require a change from Stardock.

I look forward to your replies.

5,124 views 10 replies
Reply #1 Top

#1. If you add the ability in the Champion's xml file with XY position, and then add a level prereq, it will work as you want I think. For race you might have to add some unlock stuff in the race xml file first and then add it. Look for Zealotry ability, that should give you something to work from. (Wraith ability for trained units) 

#2 I just had a bug with my mod that did that, it somehow ended up as a prereq trait for Life Magic 4 (It was on the same XY as Life Magic4) and pushed Life Magic 5 down to the next line. So you can use the XY stuff safely, it just looks messy ;) But remember there are more Y lines to use if you can allow your mod to scroll down. 

#3 Without using a leveling up bonus? Yeah that is probably harder. You probably need to be more specific about what you want to do ;) Just remember most things can be solved with some creativity, so maybe make it scale with level etc. instead. 

Reply #2 Top

I was thinking of adding some extra move to the Golem hero at certain levels.  No matter how tough they are, if they can only go at speed 2, they are just not very useful.  More generally I might make it so that all Construct heroes can have extra movement, since I think they don't go faster than 2.  Is it possible to set base movement of the Golem hero to 1 and then add +0.1 move per level?  AFAIK it always rounds up, does this apply if it is exactly equal with an integer, or only to non-integers?  Is it possible to use decimals in per level stuff, and if so is there a limit to number of decimal places?  If the limit is at least 3 I could allow 1+0.125 move per level so there would be extra movement at approximately level 8, 16, 24 etc.

Also, how do you get a Trait Tree/General Trait window to scroll?

Reply #3 Top

Yes that should be possible. Decimals work fine in per level stuff. This thread says the treshold is above .12 for a new move. 

https://forums.elementalgame.com/447273/page/1/ 

Just add a 6th or 7th Y line, and you get a scroll for the abilities. I added death magic for kingdoms in a mod, and to make room I had to move it down a row, and the scrolling bar magically appeared! ;)     

Reply #4 Top

Could I put this in a file in the mods directory to give Mausolos an extra move at level 8, 16, 24, 32 etc., and a starting movement of 2 regular squares (even though some places in the game would say less than 2)?  Or do these changes need to be direct edits to core files?

Code: xml
  1. <UnitTypes>
  2. <UnitType InternalName="Champion_Mausolos">
  3. <DisplayName>Mausolos</DisplayName>
  4. <UnitDisplayName>Mausolos</UnitDisplayName>
  5. <CreatureType>Construct</CreatureType>
  6. <Unique>1</Unique>
  7. <CanBeDesigned>0</CanBeDesigned>
  8. <WageOverride>1</WageOverride>
  9. <IsNPC>1</IsNPC>
  10. <IsChampion>1</IsChampion>
  11. <IsSovereign>0</IsSovereign>
  12. <SpawnRating>5</SpawnRating>
  13. <NPCSpawnLikelihood>100</NPCSpawnLikelihood>
  14. <GameModifier>
  15. <ModType>Resource</ModType>
  16. <Attribute>Unrest</Attribute>
  17. <Value>-5</Value>
  18. <Provides>-5% Unrest in the city this unit is in</Provides>
  19. </GameModifier>
  20. <LevelMilestone InternalName="L1">
  21. <Level>1</Level>
  22. <UnitStat_Moves>1.125</UnitStat_Moves>
  23. <UnitStat_Accuracy>80</UnitStat_Accuracy>
  24. <UnitStat_ChanceToAvoidProne>100</UnitStat_ChanceToAvoidProne>
  25. <UnitStat_Defense_Pierce>20</UnitStat_Defense_Pierce>
  26. <UnitStat_HitPoints>80</UnitStat_HitPoints>
  27. <UnitStat_WeightCapacity>200</UnitStat_WeightCapacity>
  28. </LevelMilestone>
  29. <SelectedAbilityBonusOption>ImmuneToPoison</SelectedAbilityBonusOption>
  30. <SelectedAbilityBonusOption>ImmuneToCriticals</SelectedAbilityBonusOption>
  31. <SelectedAbilityBonusOption>PathofTheDefender</SelectedAbilityBonusOption>
  32. <SelectedAbilityBonusOption>Defender1_Level</SelectedAbilityBonusOption>
  33. <SelectedAbilityBonusOption>Defender2_Level</SelectedAbilityBonusOption>
  34. <SelectedAbilityBonusOption>Spell_Guard</SelectedAbilityBonusOption>
  35. <SelectedAbilityBonusOption>Spell_DeathWard</SelectedAbilityBonusOption>
  36. <SelectedAbilityBonusOption>MausolosMoves</SelectedAbilityBonusOption>
  37. <AutoCreateEquipment>Mace_Golem</AutoCreateEquipment>
  38. <Quote>'I will stand forever.'</Quote>
  39. <NPCRecruitmentText>I can be of service. If you wish to hire me for %d gildar.</NPCRecruitmentText>
  40. <Backstory></Backstory>
  41. <Medallions InternalName="">
  42. <All>Mausolos_Medallion.png</All>
  43. </Medallions>
  44. <AnimationPack>IronGolemAnimationPack</AnimationPack>
  45. <BattleAnimationBehavior>Stationary</BattleAnimationBehavior>
  46. <ClothMapScale>1.6</ClothMapScale>
  47. <ClothPoseIndex>1</ClothPoseIndex>
  48. <Color_Metal>70,80,100,255</Color_Metal>
  49. <CutSceneDataPack>IronGolemUnitCutscenePack</CutSceneDataPack>
  50. <EquipmentScale>2</EquipmentScale>
  51. <EyeTexture>gfx/eyes/male_brown_eye.png</EyeTexture>
  52. <InfoCardBackground>BG49_FallenCastle</InfoCardBackground>
  53. <LightMap>Grave_golem_L.dds</LightMap>
  54. <ModelPath>gfx/hkb/Units/GraveGolem_Mesh_01.hkb</ModelPath>
  55. <ModelScale>0.8</ModelScale>
  56. <MovingSFX>TEMP_KnightMarching1</MovingSFX>
  57. <OnAttackParticleName>Golem_Attack</OnAttackParticleName>
  58. <OnHitParticleName>Golem_Hit</OnHitParticleName>
  59. <SkeletonPath>Gfx\HKB\Units\K_IronGolem_Skeleton_01.hkb</SkeletonPath>
  60. <SoundPack>SoundPack_Golem1</SoundPack>
  61. <TacticalModelScale>1.5</TacticalModelScale>
  62. <Texture_Skin>Gravegolem.png</Texture_Skin>
  63. <UnitModelType>IronGolem</UnitModelType>
  64. </UnitType>
  65. </UnitTypes>
  66. <AbilityBonuses>
  67. <AbilityBonus InternalName="MausolosMoves">
  68. <AbilityBonusOption InternalName="MausolosMoves">
  69. <DisplayName>Mausolos Moves</DisplayName>
  70. <Description>Mausolos Moves</Description>
  71. <Icon>Ability_PathOfTheGovernor_Icon.png</Icon>
  72. <GameModifier>
  73. <ModType>Unit</ModType>
  74. <Attribute>AdjustUnitStat</Attribute>
  75. <StrVal>UnitStat_Moves</StrVal>
  76. <Value>0.125</Value>
  77. <PerLevel>1</PerLevel>
  78. <Provides>Mausolos Gains Extra Move Every 8th Level</Provides>
  79. </GameModifier>
  80. <CombatRating>10</CombatRating>
  81. <IsCombatAbility>1</IsCombatAbility>
  82. <AIData AIPersonality="AI_General">
  83. <AIPriority>5</AIPriority>
  84. </AIData>
  85. </AbilityBonusOption>
  86. </AbilityBonuses>

Reply #5 Top

I always make new xml files for new stuff in the mod folder. So it works for me ;)

Just remember that the default file will be run, so your current code has a lot of "junk". You only need to add the changes. For instance, this is the code I used to remove the default Tower of Magi building:

Code: xml
  1. <AbilityBonuses>
  2. <AbilityBonus InternalName="CityLevel_UnlockLevel5">
  3. <AbilityBonusType>City_Level</AbilityBonusType>
  4. <AbilityBonusOption InternalName="UnlockTowerOfTheMagi">
  5. <RequiredLevel>7</RequiredLevel>
  6. </AbilityBonusOption>
  7. </AbilityBonus>
  8. </AbilityBonuses>

As long as you get the names right, the old stuff will be run by the default file first so you don't need to repeat that. Also this part:

<Value>0.125</Value>

<PerLevel>1</PerLevel>

I think you are supposed to use Value 1, and 0.125 per level. I'm pretty sure I had issues with this before when I just tried to change the value. 
Reply #6 Top

What does Value stand for, if PerLevel is the amount added for each level?  Or does it just have a different syntax to once-off bonuses that don't scale with level?

Reply #7 Top

How about:

Code: xml
  1. &lt;UnitTypes&gt;
  2. &lt;UnitType InternalName="Champion_Mausolos"&gt;
  3. &lt;LevelMilestone InternalName="L1"&gt;
  4. &lt;Level&gt;1&lt;/Level&gt;
  5. &lt;UnitStat_Moves&gt;1.125&lt;/UnitStat_Moves&gt;
  6. &lt;SelectedAbilityBonusOption&gt;MausolosMoves&lt;/SelectedAbilityBonusOption&gt;
  7. &lt;/UnitType&gt;
  8. &lt;/UnitTypes&gt;
  9. &lt;AbilityBonuses&gt;
  10. &lt;AbilityBonus InternalName="MausolosMoves"&gt;
  11. &lt;AbilityBonusOption InternalName="MausolosMoves"&gt;
  12. &lt;DisplayName&gt;Mausolos Moves&lt;/DisplayName&gt;
  13. &lt;Description&gt;Mausolos Moves&lt;/Description&gt;
  14. &lt;Icon&gt;Ability_PathOfTheGovernor_Icon.png&lt;/Icon&gt;
  15. &lt;GameModifier&gt;
  16. &lt;ModType&gt;Unit&lt;/ModType&gt;
  17. &lt;Attribute&gt;AdjustUnitStat&lt;/Attribute&gt;
  18. &lt;StrVal&gt;UnitStat_Moves&lt;/StrVal&gt;
  19. &lt;Value&gt;1&lt;/Value&gt;
  20. &lt;PerLevel&gt;0.125&lt;/PerLevel&gt;
  21. &lt;Provides&gt;Mausolos Gains Extra Move Every 8th Level&lt;/Provides&gt;
  22. &lt;/GameModifier&gt;
  23. &lt;CombatRating&gt;10&lt;/CombatRating&gt;
  24. &lt;IsCombatAbility&gt;1&lt;/IsCombatAbility&gt;
  25. &lt;AIData AIPersonality="AI_General"&gt;
  26. &lt;AIPriority&gt;5&lt;/AIPriority&gt;
  27. &lt;/AIData&gt;
  28. &lt;/AbilityBonusOption&gt;
  29. &lt;/AbilityBonuses&gt;

What should I put for CombatRating, IsCombatAbility, and AIPriority?

And what is a good icon from the standard icons?  The current one is currently a placeholder, as it is already used by Path of the Commander (Internal Name still mentions Governor) and the Commander Road Building Trait.

Reply #8 Top

I don't know the specifics, but I have an ability that has value 2 and perlevel 2. It adds 2 per level not 4 ;) When I had 2 value and 1 perlevel, it added 1. 

Don't think it matters, I have abilities without that stuff at all. Look in the GFX folder, and browse through icons there. 

 

The code looks okay to me, but testing is the only way to make sure. Dunno how to get that construct hero more often. You could add it as a summon or try the ability on your sovereign first I guess. Keep in mind I am still an amateur, most of my knowledge comes from failing my own code ^^

 

Reply #9 Top

When replacing existing units like Champions, you have to use all the code anyway.  If you only put in the code that's changed, you will get a basic unit with no portrait etc.  This is code that works for me (only problem is you can Summon Mausolos as much as you want, but that's okay as I just wanted to see his stats):

Code: xml
  1. &lt;UnitTypes&gt;
  2. &lt;UnitType InternalName="Champion_Mausolos"&gt;
  3. &lt;DisplayName&gt;Mausolos&lt;/DisplayName&gt;
  4. &lt;UnitDisplayName&gt;Mausolos&lt;/UnitDisplayName&gt;
  5. &lt;CreatureType&gt;Construct&lt;/CreatureType&gt;
  6. &lt;Unique&gt;1&lt;/Unique&gt;
  7. &lt;CanBeDesigned&gt;0&lt;/CanBeDesigned&gt;
  8. &lt;WageOverride&gt;1&lt;/WageOverride&gt;
  9. &lt;IsNPC&gt;1&lt;/IsNPC&gt;
  10. &lt;IsChampion&gt;1&lt;/IsChampion&gt;
  11. &lt;IsSovereign&gt;0&lt;/IsSovereign&gt;
  12. &lt;SpawnRating&gt;5&lt;/SpawnRating&gt;
  13. &lt;NPCSpawnLikelihood&gt;100&lt;/NPCSpawnLikelihood&gt;
  14. &lt;GameModifier&gt;
  15. &lt;ModType&gt;Resource&lt;/ModType&gt;
  16. &lt;Attribute&gt;Unrest&lt;/Attribute&gt;
  17. &lt;Value&gt;-5&lt;/Value&gt;
  18. &lt;Provides&gt;-5% Unrest in the city this unit is in&lt;/Provides&gt;
  19. &lt;/GameModifier&gt;
  20. &lt;LevelMilestone InternalName="L1"&gt;
  21. &lt;Level&gt;1&lt;/Level&gt;
  22. &lt;UnitStat_Moves&gt;1.125&lt;/UnitStat_Moves&gt;
  23. &lt;UnitStat_Accuracy&gt;80&lt;/UnitStat_Accuracy&gt;
  24. &lt;UnitStat_ChanceToAvoidProne&gt;100&lt;/UnitStat_ChanceToAvoidProne&gt;
  25. &lt;UnitStat_Defense_Pierce&gt;20&lt;/UnitStat_Defense_Pierce&gt;
  26. &lt;UnitStat_HitPoints&gt;80&lt;/UnitStat_HitPoints&gt;
  27. &lt;UnitStat_WeightCapacity&gt;200&lt;/UnitStat_WeightCapacity&gt;
  28. &lt;/LevelMilestone&gt;
  29. &lt;SelectedAbilityBonusOption&gt;ImmuneToPoison&lt;/SelectedAbilityBonusOption&gt;
  30. &lt;SelectedAbilityBonusOption&gt;ImmuneToCriticals&lt;/SelectedAbilityBonusOption&gt;
  31. &lt;SelectedAbilityBonusOption&gt;PathofTheDefender&lt;/SelectedAbilityBonusOption&gt;
  32. &lt;SelectedAbilityBonusOption&gt;Defender1_Level&lt;/SelectedAbilityBonusOption&gt;
  33. &lt;SelectedAbilityBonusOption&gt;Defender2_Level&lt;/SelectedAbilityBonusOption&gt;
  34. &lt;SelectedAbilityBonusOption&gt;Spell_Guard&lt;/SelectedAbilityBonusOption&gt;
  35. &lt;SelectedAbilityBonusOption&gt;Spell_DeathWard&lt;/SelectedAbilityBonusOption&gt;
  36. &lt;SelectedAbilityBonusOption&gt;MausolosMoves&lt;/SelectedAbilityBonusOption&gt;
  37. &lt;AutoCreateEquipment&gt;Mace_Golem&lt;/AutoCreateEquipment&gt;
  38. &lt;Quote&gt;&#39;I will stand forever.&#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;&lt;/Backstory&gt;
  41. &lt;Medallions InternalName=""&gt;
  42. &lt;All&gt;Mausolos_Medallion.png&lt;/All&gt;
  43. &lt;/Medallions&gt;
  44. &lt;AnimationPack&gt;IronGolemAnimationPack&lt;/AnimationPack&gt;
  45. &lt;BattleAnimationBehavior&gt;Stationary&lt;/BattleAnimationBehavior&gt;
  46. &lt;ClothMapScale&gt;1.6&lt;/ClothMapScale&gt;
  47. &lt;ClothPoseIndex&gt;1&lt;/ClothPoseIndex&gt;
  48. &lt;Color_Metal&gt;70,80,100,255&lt;/Color_Metal&gt;
  49. &lt;CutSceneDataPack&gt;IronGolemUnitCutscenePack&lt;/CutSceneDataPack&gt;
  50. &lt;EquipmentScale&gt;2&lt;/EquipmentScale&gt;
  51. &lt;EyeTexture&gt;gfx/eyes/male_brown_eye.png&lt;/EyeTexture&gt;
  52. &lt;InfoCardBackground&gt;BG49_FallenCastle&lt;/InfoCardBackground&gt;
  53. &lt;LightMap&gt;Grave_golem_L.dds&lt;/LightMap&gt;
  54. &lt;ModelPath&gt;gfx/hkb/Units/GraveGolem_Mesh_01.hkb&lt;/ModelPath&gt;
  55. &lt;ModelScale&gt;0.8&lt;/ModelScale&gt;
  56. &lt;MovingSFX&gt;TEMP_KnightMarching1&lt;/MovingSFX&gt;
  57. &lt;OnAttackParticleName&gt;Golem_Attack&lt;/OnAttackParticleName&gt;
  58. &lt;OnHitParticleName&gt;Golem_Hit&lt;/OnHitParticleName&gt;
  59. &lt;SkeletonPath&gt;Gfx\HKB\Units\K_IronGolem_Skeleton_01.hkb&lt;/SkeletonPath&gt;
  60. &lt;SoundPack&gt;SoundPack_Golem1&lt;/SoundPack&gt;
  61. &lt;TacticalModelScale&gt;1.5&lt;/TacticalModelScale&gt;
  62. &lt;Texture_Skin&gt;Gravegolem.png&lt;/Texture_Skin&gt;
  63. &lt;UnitModelType&gt;IronGolem&lt;/UnitModelType&gt;
  64. &lt;/UnitType&gt;
  65. &lt;AbilityBonuses&gt;
  66. &lt;AbilityBonus InternalName="MausolosMoves"&gt;
  67. &lt;AbilityBonusOption InternalName="MausolosMoves"&gt;
  68. &lt;DisplayName&gt;Mausolos Moves&lt;/DisplayName&gt;
  69. &lt;Description&gt;Mausolos Moves&lt;/Description&gt;
  70. &lt;Icon&gt;Ability_PathOfTheGovernor_Icon.png&lt;/Icon&gt;
  71. &lt;GameModifier&gt;
  72. &lt;ModType&gt;Unit&lt;/ModType&gt;
  73. &lt;Attribute&gt;AdjustUnitStat&lt;/Attribute&gt;
  74. &lt;StrVal&gt;UnitStat_Moves&lt;/StrVal&gt;
  75. &lt;Value&gt;0.125&lt;/Value&gt;
  76. &lt;PerLevel&gt;1&lt;/PerLevel&gt;
  77. &lt;Provides&gt;Mausolos Gains Extra Move Every 8th Level&lt;/Provides&gt;
  78. &lt;/GameModifier&gt;
  79. &lt;CombatRating&gt;10&lt;/CombatRating&gt;
  80. &lt;IsCombatAbility&gt;1&lt;/IsCombatAbility&gt;
  81. &lt;AIData AIPersonality="AI_General"&gt;
  82. &lt;AIPriority&gt;5&lt;/AIPriority&gt;
  83. &lt;/AIData&gt;
  84. &lt;/AbilityBonusOption&gt;
  85. &lt;/AbilityBonuses&gt;
  86. &lt;Spells&gt;
  87. &lt;SpellDef InternalName="SummonMausolos"&gt;
  88. &lt;DisplayName&gt;Summon Mausolos&lt;/DisplayName&gt;
  89. &lt;Description&gt;Summons Mausolos&lt;/Description&gt;
  90. &lt;AutoUnlock&gt;1&lt;/AutoUnlock&gt;
  91. &lt;CanStack&gt;0&lt;/CanStack&gt;
  92. &lt;SpellBookSortCategory&gt;Summon&lt;/SpellBookSortCategory&gt;
  93. &lt;SpellBookSortSubCategory&gt;Summon&lt;/SpellBookSortSubCategory&gt;
  94. &lt;SpellType&gt;Strategic&lt;/SpellType&gt;
  95. &lt;SpellClass&gt;Defensive&lt;/SpellClass&gt;
  96. &lt;SpellTargetType&gt;Self&lt;/SpellTargetType&gt;
  97. &lt;Range&gt;0&lt;/Range&gt;
  98. &lt;SpellResourceCost&gt;
  99. &lt;Resource&gt;Mana&lt;/Resource&gt;
  100. &lt;Amount&gt;5&lt;/Amount&gt;
  101. &lt;/SpellResourceCost&gt;
  102. &lt;GameModifier&gt;
  103. &lt;ModType&gt;Unit&lt;/ModType&gt;
  104. &lt;Attribute&gt;UnitJoinArmy&lt;/Attribute&gt;
  105. &lt;StrVal&gt;Champion_Mausolos&lt;/StrVal&gt;
  106. &lt;UnitClass&gt;Champion&lt;/UnitClass&gt;
  107. &lt;Value&gt;8&lt;/Value&gt;
  108. &lt;/GameModifier&gt;
  109. &lt;AIData AIPersonality="AI_General"&gt;
  110. &lt;AIPriority&gt;70&lt;/AIPriority&gt;
  111. &lt;/AIData&gt;
  112. &lt;/SpellDef&gt;
  113. &lt;/Spells&gt;
 

Reply #10 Top

Quoting StevenAus, reply 9
When replacing existing units like Champions, you have to use all the code anyway.  If you only put in the code that's changed, you will get a basic unit with no portrait etc.  This is code that works for me (only problem is you can Summon Mausolos as much as you want, but that's okay as I just wanted to see his stats):

Odd. Well guess it works differently from other objects then. I was thinking of making a file where all the champions did not share xp and still were "updatable" with the main game. Guess that is impossible after all. Thanks for figuring this out before I wasted all that time ;)