Assign traits in a level up choice?

Is there a way to assign traits, such as Air1 to a unit inside another level up choice? such as:

    <AbilityBonus InternalName="Summon1Ability">
        <AbilityBonusOption InternalName="Summon1">
            <Description>+1 level for Summons</Description>
            <GameModifier>
                <ModType>Player</ModType>
                <Attribute>AbilityBonus</Attribute>
                <StrVal>A_SummonedBonusLevels</StrVal>
                <Value>1</Value>
                <Provides>+1 level for Summons</Provides>
            </GameModifier>

--> give this unit the 'Air1' spellbook trait here


        </AbilityBonusOption>
    </AbilityBonus>

20,852 views 26 replies
Reply #1 Top

Try

      <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>UnlockUnitAbility</Attribute>
            <StrVal>Air1</StrVal>
        </GameModifier>

if that doesn't work nothing will

Reply #2 Top

Thanks once again for fast answers, but sadly it does not work. And I am out of ideas on how to fix my problem 8(|

For some reason the prereqs of 'Air1, Air2, Fire1...etc' are being ignored and I am offered any ability such as Earth5 before any other Earth books.

 

Quite aggravating!

Back to the drawing board.

Reply #3 Top

out of topic.

is there a spell that grants such abilities to receiver? (like flying, diving in future etc)

 

Reply #4 Top

Yes, use that modifier above. It should work fine inside a spell, I used it like that many times.

Reply #5 Top

I can say for sure that it does work in spells also. But for some reason alot of things don't work as you would think in CoreAbilities.

This code below does not set the Flag Kos_Air to 2 as it would seem to, even though it allows me to pick the skill Air1. Upon initialization the flag is set to 1 and I verify this.

  <AbilityBonus InternalName="Air1AbilityPotM">
    <AbilityBonusType>Unit_Level</AbilityBonusType>
    <SpellbookType>Air</SpellbookType>
    <AbilityBonusOption InternalName="Air1">
      <DisplayName>Air Apprentice in PotM</DisplayName>
      <Description>Allows the unit to cast rank 1 Air spells like Evade and Haste</Description>
      <Icon>Ability_AirApprentice_Icon.png</Icon>
      <Likelihood>400</Likelihood>
      <Prereq>
        <Type>UnitStat</Type>
        <Attribute>UnitStat_Kos_Air</Attribute>
        <Value>1</Value>
      </Prereq>
      <GameModifier>
        <ModType>Unit</ModType>
        <Attribute>AdjustUnitStat</Attribute>
        <StrVal>UnitStat_Kos_Air</StrVal>
        <Value>1</Value>
      </GameModifier>
      <GameModifier>
        <ModType>Unit</ModType>
        <Provides>Allows the unit to cast rank 1 Air spells like Evade and Haste</Provides>
      </GameModifier>
      <Type>Spell</Type>
      <AIData AIPersonality="AI_General">
        <AIPriority>5</AIPriority>
      </AIData>
    </AbilityBonusOption>
  </AbilityBonus>

 

As a result, you pick Air1 ( and it says in the pick box - 'Air Apprentice in PotM' so I know it is this code ) and it offers it to you again at future level ups.

Anyone see a reason why it would act like this?

Reply #6 Top

the only thing i see missing is the following:

 <Cost>2</Cost>

 <SpellbookRank>1</SpellbookRank>

 

which is inserted right above the <type> tag, under the <gamemodifier> tag

try putting in the spellbookrank tag, i think it will behave then.

 

I'm wondering if the spellbook rank tag serves a dual purpose:

a: does it tell the level up system this ability is already chosen.

b: does it give access to generic rank 1 spells - i'm wondering about this one since i know there are generic quest spells that henchmen are not able to cast.

 

 

 

EDIT: Why do you have this as a prereq AND a state given by the attribute? Shouldn'tit be  one or the other not both.

 

 <Prereq>

         <Type>UnitStat</Type>

         <Attribute>UnitStat_Kos_Air</Attribute>

         <Value>1</Value>

  </Prereq>

 

   <GameModifier>

         <ModType>Unit</ModType>

         <Attribute>AdjustUnitStat</Attribute>

         <StrVal>UnitStat_Kos_Air</StrVal>

         <Value>1</Value>

    </GameModifier>


 

Reply #7 Top

Quoting Glowing_Ember, reply 7
the only thing i see missing is the following:

 <Cost>2</Cost>

 <SpellbookRank>1</SpellbookRank>

 

which is inserted right above the <type> tag, under the <gamemodifier> tag

try putting in the spellbookrank tag, i think it will behave then.

 

I'm wondering if the spellbook rank tag serves a dual purpose:

a: does it tell the level up system this ability is already chosen.

b: does it give access to generic rank 1 spells - i'm wondering about this one since i know there are generic quest spells that henchmen are not able to cast.


 

I wondered the same thing but, the spellrank tag is missing on ranks 3 to 5, which makes me think it is more for the available choices when creating your Sovereign. I did go so far as to place 1 to 5 in the choices but no change at all.

Reply #8 Top


have another look i edited my post

 

Reply #9 Top

The logic is this... if I simply use the normal prereq of 'AbilityBonusOption' 'Air1' like in the core coreabilities.xml, it simply will not work with my new tag name of Air1AbilityPotM. So I decided to prereq it with a unit flag Kos_Air and so to make Air1 a valid choice it is prereq kos_air=1 and then we modify it to 2. (but this doesn't happen). Then it will be set for the Air2 prereq which is kos_air=2.

 

Reply #10 Top

<Prereq>

                 <Type>AbilityBonusOption</Type>

                 <Target>Unit</Target>

                 <Attribute>Air1</Attribute>

</Prereq>

 

my thoughts, in no particular order.

I don't think it's working as you intended

The attribute Air1 is based off the internal name

I believe <value> is a boolean, not a numerical data so value = 2 wouldn't work. Have you tried adjusting it to value = 2

 <GameModifier>

         <ModType>Unit</ModType>

         <Attribute>AdjustUnitStat</Attribute>

         <StrVal>UnitStat_Kos_Air</StrVal>

         <Value>2</Value>

  </GameModifier>

Are you trying to make a limited caster like a henchmen or a full caster like a sov/hero ?

 

 

Re-reading your posts. So your saying everything is working as you want EXCEPT you get offered the rank 1 ability again at a later level up ?

<Prereq>

         <Type>UnitStat</Type>

         <Attribute>UnitStat_Kos_Air</Attribute>

         <Value>1</Value>

  </Prereq>

 

try taking this out.

 

 

Reply #11 Top

Here's some XML that works

<?xml version="1.0"?>
<container>
  <UnitStatType InternalName="UnitStat_Kos_Air">
    <DisplayName>Hidden</DisplayName>
    <DisplayNameShort>Hidden</DisplayNameShort>
    <Description>Hidden</Description>
    <Icon>Piercing_Stat_Icon.png</Icon>
    <Hidden>1</Hidden>
    <DefaultValue>1</DefaultValue>
    <UnitStatGrouping>CombatStat</UnitStatGrouping>
    <UnitStatGrouping>UnitDetailsCombatStat</UnitStatGrouping>
  </UnitStatType>
  <AbilityBonus InternalName="Air1Ability">
    <AbilityBonusType>Unit_Level</AbilityBonusType>
    <AbilityBonusOption InternalName="Air1">
      <Prereq>
        <Type>UnitStat</Type>
        <Attribute>UnitStat_Kos_Air</Attribute>
        <Value>1</Value>
      </Prereq>
      <GameModifier>
        <ModType>Unit</ModType>
        <Attribute>AdjustUnitStat</Attribute>
        <StrVal>UnitStat_Kos_Air</StrVal>
        <Value>1</Value>
      </GameModifier>
      <Likelihood>4000</Likelihood>
    </AbilityBonusOption>
  </AbilityBonus>
  <AbilityBonus InternalName="Air2Ability">
    <AbilityBonusType>Unit_Level</AbilityBonusType>
    <AbilityBonusOption InternalName="Air2">
      <Likelihood>5000</Likelihood>
      <Prereq>
        <Type>UnitStat</Type>
        <Attribute>UnitStat_Kos_Air</Attribute>
        <Value>2</Value>
      </Prereq>
      <GameModifier>
        <ModType>Unit</ModType>
        <Attribute>AdjustUnitStat</Attribute>
        <StrVal>UnitStat_Kos_Air</StrVal>
        <Value>1</Value>
      </GameModifier>
      <AIData AIPersonality="AI_General">
        <AIPriority>5</AIPriority>
      </AIData>
    </AbilityBonusOption>
  </AbilityBonus>
  <AbilityBonus InternalName="Air3Ability">
    <AbilityBonusType>Unit_Level</AbilityBonusType>
    <AbilityBonusOption InternalName="Air3">
      <Likelihood>5000</Likelihood>
      <Prereq>
        <Type>UnitStat</Type>
        <Attribute>UnitStat_Kos_Air</Attribute>
        <Value>3</Value>
      </Prereq>
      <GameModifier>
        <ModType>Unit</ModType>
        <Attribute>AdjustUnitStat</Attribute>
        <StrVal>UnitStat_Kos_Air</StrVal>
        <Value>1</Value>
      </GameModifier>
    </AbilityBonusOption>
  </AbilityBonus>
</container>



Reply #12 Top

Thank you Heavenfall, I can see how that would work as it uses the same internal names as coreabilities in install folder. But that is the real problem as I need to intercept the process since I want the PathOfTheMage to have high likelihood of coming up while all other paths are very low. To this end I have created:

    <AbilityBonus InternalName="Air2Ability">
        <AbilityBonusOption InternalName="Air2">
            <Likelihood>0</Likelihood>
        </AbilityBonusOption>
    </AbilityBonus>
    <AbilityBonus InternalName="Air3Ability">
        <AbilityBonusOption InternalName="Air3">
            <Likelihood>0</Likelihood>
        </AbilityBonusOption>
    </AbilityBonus>

and repeated for all 5 of each type of school. Then I used 2 new InternalNames ( Air1AbilityPotM & Air1AbilityNoPotm ). This does not seem to work. I will use your code and see if I can change the starting name though and get it to work. I don't know for sure, but something tells me we can't use our own InternalNames.

Reply #13 Top

You most definitely can. In the XML above you just didn't do that:     <AbilityBonusOption InternalName="Air1">

Reply #14 Top

Aye, the xml above in my last post is from the disable original calls. In my original post, you see the change I talk about...

<AbilityBonus InternalName="Air1AbilityPotM"> (from reply #6)

this does not seem to work. I changed it back to Air1Ability and the unitstat_kos_air flag is being incremented.

Reply #15 Top

That's what I meant.

AbilityBonus is a container for the following AbilityBonusOptions.

This

    <AbilityBonus InternalName="Air2Ability">
        <AbilityBonusOption InternalName="Air2">
            <Likelihood>0</Likelihood>
        </AbilityBonusOption>
    </AbilityBonus>

is not the same as this

    <AbilityBonus InternalName="Air2AbilityPOTM">
        <AbilityBonusOption InternalName="Air2">
            <Likelihood>0</Likelihood>
        </AbilityBonusOption>
    </AbilityBonus>

but you are still interfering with the same abilitybonusoption!

<AbilityBonus InternalName="Air1AbilityPotM">
    <AbilityBonusOption InternalName="Air1">

turn that Air1 into Air1PoTM

Reply #16 Top

I can understand that then, but since I need to enable the spells from Air1, Air2, etc, I thought I had to use Air1 etc.

I searched the files for Air1 to see how they are unlocking the spellbook, but all I found is Air1 is the attribute in CoreSpells, making me use it (or try to).

Would I need to copy all the original spells over to a mod file and use Air1PotM as the unlock key?

 

Reply #17 Top

Can you instead describe what you are trying to do? Is your intent to block certain spell levels for all who are not path of the mage? Or are you trying to give path of the mage a higher chance of seeing spelltraits as choices?

Reply #18 Top

If I understand correctly (and I may be wrong) you're trying to buff path of the mage so that it has a high chance of getting magical picks, and can also gain elemental paths (include apprentice tier1 picks). If this is what you're trying to do... try this:

 

<AbilityBonuses>
    <!-- A new trait for Path of the Mage that unlocks Air1, this isn't hidden so that you can tell that it's working-->
    <AbilityBonus InternalName="Air1POTMUnlockAbility">
        <AbilityBonusType>Unit_Level</AbilityBonusType>
        <AbilityBonusOption InternalName="Air1POTMUnlock">
            <DisplayName>Air Apprentice (POTM)</DisplayName>
            <Description>Allows the unit to cast rank 1 Air spells like Evade and Haste</Description>
            <Icon>Ability_AirApprentice_Icon.png</Icon>
            <GameModifier>
                <ModType>Unit</ModType>
                <Provides>Allows the unit to cast rank 1 Air spells like Evade and Haste</Provides>
            </GameModifier>
            <GameModifier>
                <ModType>Unit</ModType>
                <Attribute>UnlockUnitAbility</Attribute>
                <StrVal>Air1</StrVal>
            </GameModifier>
            <Likelihood>1000</Likelihood>
            <RarityDisplay>Common</RarityDisplay>
            <Type>Spell</Type>
            <Prereq>
                <Type>AbilityBonusOption</Type>
                <Target>Unit</Target>
                <Attribute>PathOfTheMage</Attribute>
            </Prereq>
            <AIData AIPersonality="AI_General">
                <AIPriority>5</AIPriority>
            </AIData>
        </AbilityBonusOption>
    </AbilityBonus>
    <!-- A new trait that unlocks Air2, requires Air1 Unlock (so that it'll come in order), repeat for Air3 to 5-->
    <AbilityBonus InternalName="Air2POTMUnlockAbility">
        <AbilityBonusType>Unit_Level</AbilityBonusType>
        <AbilityBonusOption InternalName="Air2POTMUnlock">
            <DisplayName>Air Disciple (POTM)</DisplayName>
            <Description>Allows the unit to cast rank 2 Air spells like Aura of Grace and Guardian Wind</Description>
            <Icon>Ability_AirDisciple_Icon.png</Icon>
            <GameModifier>
                <ModType>Unit</ModType>
                <Provides>Allows the unit to cast rank 2 Air spells like Aura of Grace and Guardian Wind</Provides>
            </GameModifier>
            <GameModifier>
                <ModType>Unit</ModType>
                <Attribute>UnlockUnitAbility</Attribute>
                <StrVal>Air2</StrVal>
            </GameModifier>
            <Likelihood>2000</Likelihood>
            <RarityDisplay>Common</RarityDisplay>
            <MinimumLevel>3</MinimumLevel>
            <Type>Spell</Type>
            <Prereq>
                <Type>AbilityBonusOption</Type>
                <Target>Unit</Target>
                <Attribute>Air1POTMUnlock</Attribute>
            </Prereq>
            <AIData AIPersonality="AI_General">
                <AIPriority>5</AIPriority>
            </AIData>
        </AbilityBonusOption>
    </AbilityBonus>
    <!-- Mod the old Air2 so that it doesn't come up by itself once you've gone down this upgrade path, repeat for Air3 to 5-->
    <AbilityBonus InternalName="Air2Ability">
        <AbilityBonusOption InternalName="Air2">
            <Prereq>
                <Type>RestrictedAbilityBonusOption</Type>
                <Target>Unit</Target>
                <Attribute>Air1POTMUnlock</Attribute>
            </Prereq>
        </AbilityBonusOption>
    </AbilityBonus>
</AbilityBonuses>

I honestly have no idea what you're trying to do with UnitStat_Kos_Air, so I didn't include it...

Reply #19 Top

I am trying to do what Kalin gave code for. I want 2 separate trees for learning magic, 1 is for path of the mage and the other for all other classes. By all rights the code above should work, but the unlockunitability does not work. All the rest works fine, we get the icons for Air1-5 but can not cast even one spell from that tree.

I wonder if something is wrong with something I've modded in (as I've done quite a bit in other areas etc) and is why the unlockunitability does not work? Can you verify that it does or does not?

Even if it does not work, perhaps someone knows of a way to auto-cast a spell that gives the Air1 immediately as that does work. Or a way to give an item to the player? If that is possible, could it also be an auto-use item?

Short of any thing else, I could duplicate all spells and set the prereq's from Air1, Air2, etc to Air1PotM, Air2PotM, etc.

Appreciate all the help here, trying to learn the intricacies of how you do this or that, and what is not possible is aggravating.

Reply #20 Top

Yeah, you probably have to remake spells to do this.

The other alternative is to block other traits from appearing when you play path of the mage, increasing the odds that you get a spelltrait to select.

Reply #21 Top

Quoting kosiam, reply 20
1 is for path of the mage and the other for all other classes.

It seems to me that the easiest way to do this is that in spells that require PotM you would have to put this:

<Prereq>
            <Type>AbilityBonusOption</Type>
            <Attribute>PathOfTheMage</Attribute>
        </Prereq>

As for how to do this in CoreAbilities, I have no idea.

One thing I plan on doing with the Aetheria core mod is changing elemental schools level 3 and higher to require PathOfTheMage.

Reply #22 Top

Quoting kosiam, reply 20
I am trying to do what Kalin gave code for. I want 2 separate trees for learning magic, 1 is for path of the mage and the other for all other classes. By all rights the code above should work, but the unlockunitability does not work. All the rest works fine, we get the icons for Air1-5 but can not cast even one spell from that tree.

I wonder if something is wrong with something I've modded in (as I've done quite a bit in other areas etc) and is why the unlockunitability does not work? Can you verify that it does or does not?

Even if it does not work, perhaps someone knows of a way to auto-cast a spell that gives the Air1 immediately as that does work. Or a way to give an item to the player? If that is possible, could it also be an auto-use item?

Short of any thing else, I could duplicate all spells and set the prereq's from Air1, Air2, etc to Air1PotM, Air2PotM, etc.

Appreciate all the help here, trying to learn the intricacies of how you do this or that, and what is not possible is aggravating.

 

Strange, I guess you can't unlock abilities inside another ability... which is a bit odd, because you can unlock spells inside spells. I'm not sure if I messed up somewhere, but anyway, to address your current problem... 

You can also unlock spells like you do abilities with UnlockSpell (and this definitely works inside a trait). Basically you'd add the following:


        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>UnlockSpell</Attribute>
            <StrVal>Haste</StrVal>
            <Provides>Unlocks Haste: Target unit is +3 to Initiative (+1 per air shard)</Provides>
        </GameModifier>

... to Air1POTM, and the same for all other spells in their appropriate location. This will allow you to unlock the spells without duplicating everything. The problem with this approach would be the multi-path spells. Which you could either ignore, put into one of the other paths, or you can duplicate just those multi-path spells (much less than everything).

 

As to your question, you can try to create an item to give you the path... using GiveItem (quest reward style). Although I haven't tested to see if this works with unit level up traits (or how it would handled if you're in an army with other heroes). I don't think you can make it auto use though.

Basically, something like this:


            <GameModifier>
                <ModType>GiveItem</ModType>
                <Attribute>TomeoftheWind</Attribute>
            </GameModifier>

Regarding autocast spells, you can only do that at the beginning of a battle... via BattleAutoCastSpell, so you might be able to do it that way, but you'd need to enter another tactical battle before you gain that path. So you'd have to have something along the lines of "training Air1" trait in PoTM (with high likelihood) that would then autocast a spell that give you that Air1 path when you enter a battle. That SHOULD give you the appropriate trait and the spells that goes with it.

Basically:


    <AbilityBonus InternalName="Air1POTMUnlockAbility">
        <AbilityBonusOption InternalName="Air1POTMUnlock">
            <DisplayName>Training Air Apprentice</DisplayName>
            <Description>This mage is currently practicing Air magic, and will become an Air Apprentice by the next battle.</Description>
            <Icon>Ability_AirApprentice_Icon.png</Icon>
            <GameModifier>
                <ModType>Unit</ModType>
                <Attribute>BattleAutoCastSpell</Attribute>
                <StrVal>Air1POTMUnlockSpell</StrVal>
                <Value>100</Value>
                <Provides>This mage has become an Air Apprentice.</Provides>
            </GameModifier>
            <Likelihood>1000</Likelihood>
            <RarityDisplay>Common</RarityDisplay>
            <Type>Spell</Type>
            <Prereq>
                <Type>AbilityBonusOption</Type>
                <Target>Unit</Target>
                <Attribute>PathOfTheMage</Attribute>
            </Prereq>
            <AIData AIPersonality="AI_General">
                <AIPriority>5</AIPriority>
            </AIData>
    </AbilityBonus>

You'd need the auto cast spell (Air1POTMUnlockSpell) that unlocks Air1 as well, of course...

Reply #23 Top

Would it be possible to force these options like the various paths are forced at level 4?  Or is that hard coded?

Reply #24 Top

I have read the responses and thank all for suggestions. I have played with this for hours since getting home from work. The findings are not good. I can not use the Air1, Air2 tags, they seem to be tied to the Air1Ability, Air2Ability etc. If you try then very strange things happen, prereqs and AdjustUnitStat quits working also.

 

So I went with both having PotM in them and while that did not unlock the spells, it did go by the correct prereqs and incremented the unitstat_flags. The strange part is you get a separate icon for each level, so with Air1 & Air2 I had 2 icons on my Sovereign window. Not sure how they made them stack into one. I tried using the spell_rank tag but still no luck.

 

The suggestion to unlock the spells individually sounds great, only it does not unlock the spell either. I wonder if 1.02 has changed things from the beta days etc? So it is not much fun, but it seems I will be doing a copy & paste of all the spells. I've done worse in my life ;p

 

Anyone have an idea how to stack the spell icons?

EDIT: just to make sure, I copied Haste over as HastePotM, gave it prereq of Air1PotM and it shows up after picking Air Apprentice.

Reply #25 Top

the only problem I see with  this, is what happens if you have the legitimate air apprentice?   Will it pop up as an option to take the whole set a second time?