remove/disable abilities

 

Hi.

I want to change abilities in the paths depending on the race like replacing  'Tinker-Ability' for Mancers with a better one, giving a bonus of +2. Therefor I need a way to enable the new ablity for Mancers only (easily done) and disable the normal Tinker-ability for Mancers (the problem). 

So I've tested a few ways to disable ablilities with <prereq>. The results where strange.

 

with these additions, the ablility completely vanishes (no Button anymore, position free for other ablility):

<Prereq>
   <Type>AbilityBonusOption</Type>
   <Target>Unit</Target>
   <Attribute>whatever</Attribute>
</Prereq>

<Prereq>
   <Type>AbilityBonusOption</Type>
   <Target>Player</Target>
   <Attribute>whatever</Attribute>
</Prereq>

<Prereq>
   <Type>Allegiance</Type>
   <Attribute>Empire/Kingdom</Attribute>
</Prereq>

with these additions, the ablility only becomes 'outgreyed' (not selectable, but the button remains and the position is blocked for other abilities): 
 
<Prereq>
   <Type>RestrictedAbilityBonusOption</Type>
   <Target>Unit</Target>
   <Attribute>whatever</Attribute>
</Prereq>


<Prereq>
   <Type>RestrictedAbilityBonusOption</Type>
   <Target>Player</Target>
   <Attribute>whatever</Attribute>
</Prereq>


<Prereq>
   <Type>Race</Type>
   <Attribute>Race_Type_whatever</Attribute>
</Prereq>

<Prereq>
   <Type>UnitStat</Type>
   <Attribute>UnitStat_whatever</Attribute>
   <Value>1</Value>

</Prereq> 

Now for the questions:

1) Is there a way to make an ability vanish using any of the 'restricted'-Types or a workaround to query if something is NOT true? 

2) Can you give an ability (in game not with SelectedAbilityBonusOption) to a unit in another way than selecting it manually in the path? Unlocking by using a unitstat is no problem, but the unit needs to have the ability for this to work.

3) Is it possible to make a ability only selectable for a sovereign? Giving UnitStat_IsSovereign works, but I hope there is an already build-in way to identify a unit as sovereign.

4) Is it possible to give cities a stat like 'CityStat_Mult' and use this stat in calculations for Improvements.

 

<GameModifier>
   <ModType>Resource</ModType>
   <Attribute>Mana</Attribute>
   <PerTurn>1</PerTurn>
   <Provides>More Mana</Provides>
   <Calculate InternalName="Value" ValueOwner="OwnerCity">
      <Expression><![CDATA[[TileYieldEssence] * [CityStat_Mult]]]></Expression>
   </Calculate>
</GameModifier>

 

 

Many thanks in advance for your help. 

3,033 views 4 replies
Reply #1 Top

SOLVED

4) Have to use a per-turn-ressource with <Stored>0</Stored>. Many hours spend testing wrong ways because I did't include <Stored> and forgot that in that case it has a default value of 1.

 

Reply #2 Top

1) Is there a way to make an ability vanish using any of the 'restricted'-Types or a workaround to query if something is NOT true? 

To the best of my knowledge (and i'd love to be proven wrong), the only thing that works this way is the Allegiance prereq (like the Wisp/Lightbringer/Summon Skeleton abilities).

I don't think it's possible to hide/show an ability depending on race or AbilityBonusOption.

Real bummer.



2) Can you give an ability (in game not with SelectedAbilityBonusOption) to a unit in another way than selecting it manually in the path? Unlocking by using a unitstat is no problem, but the unit needs to have the ability for this to work.

You can give an ability to a unit via a Spell.  That may or may not help you depending on what you want to do exactly.

So what you can do is hide the default Tinker ability.  Then have 2 version... one for mancers only that they can get from a spell.  Another one for everyone else that is also given via a spell.  They can be in the same location in the tree.  You could probably also have other abilities that have the tinker (respective version) as the prereq... and they might then appear once you cast the spell to get the tinker ability.  Haven't tried that but it might work.  This is all on the General tab only though.

Actually another option, though also not quite what you want.... you can give a unit a whole new Path via a spell.  It would be feasable to create a whole new Path called "Mancer Path".  Put whatever mancer only abilities on it that you want.  Then have a spell that grants the Mancer path.  That will definately work, however

- if they cast the spell before they have chosen their normal path (warrioer, mage etc), they won't get asked to choose one at L2.  So you'd want to have a minimum level for the Path spell of at least 2.

- A unit can have multiple paths, so they can have General, Warrior and "Mancer" paths... but only 2 fit on the trait selection screen at a time... you have to use the mouse wheel to see the 3rd (Mancer) path.  But it works.

You can do some stuff with UnitStat prereqs as you discovered... but the abilities will still show up greyed out.  It'd probably wouldn't work so well if you want to have a different version of the same ability for each race.


3) Is it possible to make a ability only selectable for a sovereign? Giving UnitStat_IsSovereign works, but I hope there is an already build-in way to identify a unit as sovereign.

The is a sovereign only tag for spells but I don't think it works for abilities.  Try it but fairly sure it won't work.  You'd have to go the Unitstat solution... which will work but doesn't hide the ability as you found out.  There is also no way to give a Sov the unitstat but default... you have to fudge it but doing something like adding the unitstat to all the Sov profession abilities, something like that.

 

Reply #3 Top

BTW just with #1, you should be able to use a Unitstat to present 2 options for the tinker ability... one for mancer and one for everyone else.  They'd both appear though, you'd have to have them in different locations on the path.  The one that is not available would be disabled.  You'd have to give all mancers the unitstat.

Reply #4 Top

 Thank you for the answers.

The solution giving the abilities via a spell could work, but brings new problems.

1) I don't know how to give an ability via spell. Could you post the syntax, or refer to a existing spell, please?

2) I do not believe that the AI could use this system in the right way.

btw

I tried to disable/hide a path but without success. None of the usual prereq modifiers work. Has anyone an idea how to do this?