cohka cohka

Modding questions/help thread

Modding questions/help thread

Figured we needed a thread for questions that didn't need to take up valuable room from talented mod'rs.

1,923,953 views 844 replies
Reply #351 Top

I am trying to create an Ability that is 15% Unrest - 5% Unrest per Essence.  

The 15% is easy, but have been unable to do the 5% Unrest per Essence, unless I tie it to a new building, or city spell.  

I do the 15% on the ability with

Code: xml
  1. <GameModifier>
  2. <ModType>Player</ModType>
  3. <Attribute>AbilityBonus</Attribute>
  4. <StrVal>A_Additive_Unrest</StrVal>
  5. <Value>15</Value>
  6. <Provides>+15% Unrest</Provides>
  7. </GameModifier>

The closest I could do was create a building with 0 LaborToBuild, so it can be built on the first turn after a city is created, that does:

Code: xml
  1. <GameModifier>
  2. <ModType>Resource</ModType>
  3. <Attribute>Unrest</Attribute>
  4. <PerTurn>1</PerTurn>
  5. <Provides>-5% Unrest per Essence</Provides>
  6. <UpgradeComparisonID>1</UpgradeComparisonID>
  7. <UpgradeComparisonText>Unrest</UpgradeComparisonText>
  8. <Calculate InternalName="Calc" ValueOwner="OwnerCity">
  9. <Expression><![CDATA[[TileYieldEssence] * 5]]></Expression>
  10. </Calculate>
  11. <Calculate InternalName="Value">
  12. <Expression><![CDATA[[Calc] * -1]]></Expression>
  13. </Calculate>
  14. </GameModifier>

Is there a way in the AbilityBonus itself to do something like this (Affect the City using TileYieldEssence)

Reply #352 Top

Is there any way to have a trait a champion starts with that doesn't actually apply until a certain level?  I've tried a number of things and am not sure if its possible.  For example, I can have <MinimumLevel>, <RequiredLevel> and <Prereq> of a certain UnitStat_Level, but the bonuses (in this case I tried to boost UnitStat_Moves) all apply no matter what level the champion is.

So, is it possible?  Possible only for combat abilities?  Or not possible at all?

Reply #353 Top

Quoting StevenAus, reply 352

Is there any way to have a trait a champion starts with that doesn't actually apply until a certain level?  I've tried a number of things and am not sure if its possible.  For example, I can have <MinimumLevel>, <RequiredLevel> and <Prereq> of a certain UnitStat_Level, but the bonuses (in this case I tried to boost UnitStat_Moves) all apply no matter what level the champion is.

So, is it possible?  Possible only for combat abilities?  Or not possible at all?
End of StevenAus's quote

 I am thinking that something like this might work:-

<AbilityBonus InternalName="LargeMoveAbility">        
 <AbilityBonusType>Unit_Design</AbilityBonusType>
 <AbilityBonusOption InternalName="LargeMove">
  <DisplayName>Increased Move</DisplayName>             
  <Description>+3 Move if higher than level 5</Description>             
  <Icon>Increased_Move_Icon.png</Icon>             
  <GameModifier>                 
   <ModType>Unit</ModType>                 
   <Attribute>AdjustUnitStat</Attribute>                 
   <StrVal>UnitStat_Moves</StrVal>                                 
   <PerLevel>1</PerLevel>                 
   <Provides>+3 Move if higher than level 5</Provides> 
  
<Calculate InternalName="Calc">
   
<Expression><![CDATA[[Unit_GetLevel]]]></Expression>
  
</Calculate>            
  
<Calculate InternalName="Calc2">                
   
<Expression><![CDATA[[Calc] > 5]]></Expression>            
  
</Calculate>
   <Calculate InternalName="Value">
   
<Expression><![CDATA[[Calc2] * 3]]></Expression>
  
</Calculate>          
  </GameModifier>
 </AbilityBonusOption>     
</AbilityBonus>  

 

Reply #354 Top

Quoting Ockhams, reply 351

I am trying to create an Ability that is 15% Unrest - 5% Unrest per Essence.  

The 15% is easy, but have been unable to do the 5% Unrest per Essence, unless I tie it to a new building, or city spell.  

I do the 15% on the ability with

Code: xml
<GameModifier>
<ModType>Player</ModType>
<Attribute>AbilityBonus</Attribute>
<StrVal>A_Additive_Unrest</StrVal>
<Value>15</Value>
<Provides>+15% Unrest</Provides>
</GameModifier>
The closest I could do was create a building with 0 LaborToBuild, so it can be built on the first turn after a city is created, that does:

Code: xml
<GameModifier>
<ModType>Resource</ModType>
<Attribute>Unrest</Attribute>
<PerTurn>1</PerTurn>
<Provides>-5% Unrest per Essence</Provides>
<UpgradeComparisonID>1</UpgradeComparisonID>
<UpgradeComparisonText>Unrest</UpgradeComparisonText>
<Calculate InternalName="Calc" ValueOwner="OwnerCity">
<Expression><![CDATA[[TileYieldEssence] * 5]]></Expression>
</Calculate>
<Calculate InternalName="Value">
<Expression><![CDATA[[Calc] * -1]]></Expression>
</Calculate>
</GameModifier>
Is there a way in the AbilityBonus itself to do something like this (Affect the City using TileYieldEssence)
End of Ockhams's quote

 

Ability bonuses affect units or heroes. Essence is per city. I think you might be able to do this for a unit is stationed in a city. You could rip off the administrator ability:

Code: xml
  1.  &lt;GameModifier&gt;                
  2. &lt;ModType&gt;Resource&lt;/ModType&gt;                
  3. &lt;Attribute&gt;Unrest&lt;/Attribute&gt;                
  4. &lt;Value&gt;-10&lt;/Value&gt;                
  5. &lt;Provides&gt;-10% Unrest in the city this unit is in&lt;/Provides&gt;
  6.  &lt;/GameModifier&gt;

Replace the -10 value with a calculated value, and you might be able to use Essence.

Reply #355 Top

Quoting random_thoughts_7, reply 354

Ability bonuses affect units or heroes. Essence is per city. I think you might be able to do this for a unit is stationed in a city. You could rip off the administrator ability:
End of random_thoughts_7's quote

Thanks for the thought.  I have tried a few methods.  I did find something that works well, and is sort of fun.

I am currently using:  

  • 20% Faction unrest
  • Modified Meditation Spell that does the following:
    • +1 Essence
    • +1 Mana / Essence
    • -5% Unrest / Essence

What this does, is make 0 Essence locations really bad (to be avoided) and a 3 essence location w/ Meditation will have "normal" unrest -(3+1)*5% = -20%.  And in the bargain, it basically gets meditation for free, and all essence based city spells are more effective (Due to the +1 essence).  

 

Reply #356 Top

Quoting random_thoughts_7, reply 353


Quoting StevenAus, reply 352
Is there any way to have a trait a champion starts with that doesn't actually apply until a certain level?  I've tried a number of things and am not sure if its possible.  For example, I can have <MinimumLevel>, <RequiredLevel> and <Prereq> of a certain UnitStat_Level, but the bonuses (in this case I tried to boost UnitStat_Moves) all apply no matter what level the champion is.

So, is it possible?  Possible only for combat abilities?  Or not possible at all?

 I am thinking that something like this might work:-

<AbilityBonus InternalName="LargeMoveAbility">        
 <AbilityBonusType>Unit_Design</AbilityBonusType>
 <AbilityBonusOption InternalName="LargeMove">
  <DisplayName>Increased Move</DisplayName>             
  <Description>+3 Move if higher than level 5</Description>             
  <Icon>Increased_Move_Icon.png</Icon>             
  <GameModifier>                 
   <ModType>Unit</ModType>                 
   <Attribute>AdjustUnitStat</Attribute>                 
   <StrVal>UnitStat_Moves</StrVal>                                 
   <PerLevel>1</PerLevel>                 
   <Provides>+3 Move if higher than level 5</Provides> 
   <Calculate InternalName="Calc">
    <Expression><![CDATA[[Unit_GetLevel]]]></Expression>
   </Calculate>            
   <Calculate InternalName="Calc2">                
    <Expression><![CDATA[[Calc] > 5]]></Expression>            
   </Calculate>
   <Calculate InternalName="Value">
    <Expression><![CDATA[[Calc2] * 3]]></Expression>
   </Calculate>          
  </GameModifier>
 </AbilityBonusOption>     
</AbilityBonus>  

 
End of random_thoughts_7's quote

I've done a lot of trial and error, and I haven't been able to get the following test code to work:

<AbilityBonuses>
<AbilityBonus InternalName="INeedToMove">
<AbilityBonusOption InternalName="INeedToMove">
<DisplayName>I Need To Move</DisplayName>
<Description>I Need To Move</Description>
<Icon>Ability_PathOfTheGovernor_Icon.png</Icon>
<GameModifier>
<ModType>Unit</ModType>
<Attribute>AdjustUnitStat</Attribute>
<StrVal>UnitStat_Moves</StrVal>
<Provides>+1 Move at L5</Provides>
<Calculate InternalName="Calc">
<Expression><![CDATA[[Unit_GetLevel]]]></Expression>
</Calculate>
<Calculate InternalName="Value">
<Expression><![CDATA[[Calc] > 4]]></Expression>
</Calculate>
</GameModifier>
<AIData AIPersonality="AI_General">
<AIPriority>5</AIPriority>
</AIData>
</AbilityBonusOption>
</AbilityBonus>

And that's before I try to add multiple "> Level" Comparisons.

Maybe the Calculate tags only work in spells.

Reply #357 Top

I think you correct about the calculate tags. I haven't seen the calculate work outside of spells or the <ValueCalcWrapper>

You could try surrounding your calculate stuff and see if it works out for you, but I wouldn't expect it would work.

Reply #358 Top

Quoting parrottmath, reply 357

I think you correct about the calculate tags. I haven't seen the calculate work outside of spells or the <ValueCalcWrapper>

You could try surrounding your calculate stuff and see if it works out for you, but I wouldn't expect it would work.
End of parrottmath's quote

 Improvements can use them, but yeah I checked the Ability file and there aren't any.

 But seeing you want an ability for a champion only, you could make a new level-up general ability and mark it restricted to level 5 or above. Rip off something like the Life3 ability which has a level 5 restriction. Then the champion would only be able to choose it at level 5. Sorry about not posting code to flesh out this idea, but it takes ages to format it.

 

Reply #359 Top

Although I never tried this method, there are level milestones defined in the file. You may be able to use that aspect to give an automatic bonus at a particular level. Set the movement stat to increase at level 5. Let me know if that method works.

Reply #360 Top

Quoting parrottmath, reply 357

I think you correct about the calculate tags. I haven't seen the calculate work outside of spells or the <ValueCalcWrapper>

You could try surrounding your calculate stuff and see if it works out for you, but I wouldn't expect it would work.
End of parrottmath's quote

Could you create a spell only usable by champions with INeedToMove (Unlock or prereq) that adds movement?  Something like "BurningBlade" or "FeedTheFire", but with 0 SpellResourceCost and 0 Mana.   Or maybe FireResistance, which is marked as Strategic/Self/ and a special ability.

 

 

Reply #361 Top

Quoting parrottmath, reply 359

Although I never tried this method, there are level milestones defined in the file. You may be able to use that aspect to give an automatic bonus at a particular level. Set the movement stat to increase at level 5. Let me know if that method works.
End of parrottmath's quote

 

I've always presumed that the level milestones are for monsters and enemy players - so a level 10 bear would be created with the level 10 milestone stats to attack you.

A different idea that might work would be to create an item, like boots that give a speed boost and are only wearable at level 5.

Reply #362 Top

Is it possible to edit CoreRandomEvents.xml from the mods folder?  There is a Random Event that gives out Wilbur, a hero, but it is actually Champion_Janusk with a different name.  Is it possible to create a new Champion_Wilbur and then change the CoreRandomEvent from the mods folder so it gives out Champion_Wilbur rather than a renamed Champion_Janusk?  I am only giving the ability for Quest Heroes to not divide experience, and Janusk can appear at a fame milestone.

If it can't be edited from the mods folder, I will consider including a core edit, but want to avoid that if possible.

Reply #363 Top

Quoting StevenAus, reply 362

Is it possible to edit CoreRandomEvents.xml from the mods folder?  There is a Random Event that gives out Wilbur, a hero, but it is actually Champion_Janusk with a different name.  Is it possible to create a new Champion_Wilbur and then change the CoreRandomEvent from the mods folder so it gives out Champion_Wilbur rather than a renamed Champion_Janusk?  I am only giving the ability for Quest Heroes to not divide experience, and Janusk can appear at a fame milestone.

If it can't be edited from the mods folder, I will consider including a core edit, but want to avoid that if possible.
End of StevenAus's quote

Yes. Copy the event you want to re-write, give it its own file in /mods. Then re-write away.

Reply #364 Top


Are you sure one can overwrite quest based events as you suggest? My experiments on the matter have proven unsuccessful.

Reply #365 Top

Is there any way to keep certain champions off-limits to the ai? (Like the <AICanGoOnQuest>0</AICanGoOnQuest> tag, but for champions)

Reply #366 Top

Quoting parrottmath, reply 364


Are you sure one can overwrite quest based events as you suggest? My experiments on the matter have proven unsuccessful.
End of parrottmath's quote

I have successfully overwritten the trigger chance of random events, based on the unmodified events triggering with normal frequency but the modd-ed (lowered chance) events barely ever triggering.

Maybe I should not have been so confident about it in general, since probabilities are involved in my observations. But I haven't seen the problems you have. What did you overwrite that failed?

Reply #367 Top

I tried editing the slavers quest, and as I remember I had difficulty changing the quest without modifying the core files themselves.

Reply #368 Top

Quoting dsjdsj, reply 365
Is there any way to keep certain champions off-limits to the ai? (Like the <AICanGoOnQuest>0</AICanGoOnQuest> tag, but for champions)
End of dsjdsj's quote

I do not think such a tag exists. You can set-up a quest that the AI cannot go on, and gives you the champion you specify. Other than that I believe the code for the AI champion selection is hard-coded.

Reply #369 Top

Can you get a quest to become a custom-placement only quest? What does the spawnrating tag do? Does it prevent it from being picked by the quest location tiles when they are stepped on?

Reply #370 Top


Custom-placement only Quest? not sure what you mean by this...

The spawn rating is an indicator on how difficult the quest is, and thus during creation of the game, it also tells the game to place this quest with the class with these spawn ratings.

Reply #371 Top

I mean quests that only you can manually place on a custom made map, but will not spawn randomly.

Reply #372 Top

I now understand the question.

I suppose that you can create a special terrain type that you may create a quest where the quest location can only spawn on this terrain. I've never tried this, but I cannot think of another way of preventing a quest from spawning. Tell the quest location restricted terrain and it might work out for you... I'd have to do some experimenting, but it might work.

Reply #373 Top

 I'm really new to modding LH, and wanted to know if there is a way to first add a group of soldiers and archers to a city garrison when its created to help boost the city's defense and second if there is a way to take a monster race from the game and make it into a playable faction.

Reply #374 Top

Quoting Mistylicious767, reply 373

 I'm really new to modding LH, and wanted to know if there is a way to first add a group of soldiers and archers to a city garrison when its created to help boost the city's defense and second if there is a way to take a monster race from the game and make it into a playable faction.
End of Mistylicious767's quote

You should look at how Children of the Storm (CoS) includes extra factions in the files he uses. Then apply the same ideas to your creation of a monster race.

Reply #375 Top

So here I am creating new items, what a time consuming endeavor.

I'd be grateful if someone could tell me what the following values do:

<TintR></TintR>

<TintG></TintG>

<TintB></TintB>

 Apparently color codes? I've been ignoring them to no seeming ill effects but I'd rather find out before a catastrophe happens. :)