Assigning EXP per turn through spells/improvements/abilities

        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>GiveExperience</Attribute>
            <PerTurn>1</PerTurn>
            <Value>5</Value>    
        </GameModifier>

Fails to cast every turn.

 

        <GameModifier>
            <ModType>Army</ModType>
            <Attribute>GiveExperience</Attribute>
            <PerTurn>1</PerTurn>
            <Value>5</Value>    
        </GameModifier>

Doesn't work.

 

        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>A_GiveExperience</Attribute>
            <PerTurn>1</PerTurn>
            <Value>5</Value>    
        </GameModifier>

Doesn't work.

 

<ModType>Player</ModType>

<ModType>AllFriendlyUnits</ModType>

<ModType>Army</ModType>

 

No matter how I try, I cannot create a spell which targets EXP to give EXP per turn.

 

I am also unable to get a spell to target "the army" instead of "a unit in the army". I am also having a hard time getting spells or abilities to apply experience effects to all units or all units in one Army. I have seen in Tireless March, Trainer, Grip of Winter and some other areas, the ability to interact with "target player", "self", "all friendly units", and I would like to make some spells which effect "all my units", or "all units in this army". I also don't understand how to make a spell only work on one Army at a time.

 

This might sound a little silly, but is it possible to have a city build a resource? Is it possible to create a replica Outpost that can only be built on a resource (Foundation)?

13,089 views 17 replies
Reply #1 Top

I believe there is an AdjustArmyStat Attribute you can try.  Like so:

            <GameModifier>
                <ModType>Unit</ModType>
                <Attribute>AdjustArmyStat</Attribute>
                <StrVal>UnitStat_HealthRegen</StrVal>
                <Value>1</Value>
                <Provides>+1 to the Army's Health Regeneration per season</Provides>
            </GameModifier>

Change the StrVal to UnitStat_Experience and see if that works.

Reply #2 Top

Didn't work. I can't seem to make a spell, ability or building which does it.

Reply #3 Top

Here you go.  Put this game modifier n works like a charm, I have tested it before.

Code: xml
  1. &lt;GameModifier&gt;
  2. &lt;ModType&gt;Unit&lt;/ModType&gt;
  3. &lt;Attribute&gt;GiveExperience&lt;/Attribute&gt;
  4. &lt;Value&gt;1&lt;/Value&gt;
  5. &lt;PerTurn&gt;1&lt;/PerTurn&gt;
  6. &lt;/GameModifier&gt;

Reply #4 Top

For reference I used that within a ability bonus.

Here is the full ability that I was using, it was a test ability to attempt to create an evolution ability for creatures.

Code: xml
  1. &lt;AbilityBonus InternalName="BearCubEnduranceAbility"&gt;
  2. &lt;AbilityBonusType&gt;Unit_Level&lt;/AbilityBonusType&gt;
  3. &lt;AbilityBonusOption InternalName="BearCubEndurance"&gt;
  4. &lt;DisplayName&gt;Bear Cub&#39;s Endurance&lt;/DisplayName&gt;
  5. &lt;Description&gt;+1 Hit Point per Level&lt;/Description&gt;
  6. &lt;Icon&gt;Ability_EnduranceI_Icon.png&lt;/Icon&gt;
  7. &lt;PerkTreePosX&gt;1&lt;/PerkTreePosX&gt;
  8. &lt;PerkTreePosY&gt;2&lt;/PerkTreePosY&gt;
  9. &lt;GameModifier&gt;
  10. &lt;ModType&gt;Unit&lt;/ModType&gt;
  11. &lt;Attribute&gt;AdjustUnitStat&lt;/Attribute&gt;
  12. &lt;StrVal&gt;UnitStat_HitPoints&lt;/StrVal&gt;
  13. &lt;Value&gt;1&lt;/Value&gt;
  14. &lt;PerLevel&gt;1&lt;/PerLevel&gt;
  15. &lt;Provides&gt;+1 Hit Point per Level&lt;/Provides&gt;
  16. &lt;/GameModifier&gt;
  17. &lt;GameModifier&gt;
  18. &lt;ModType&gt;Unit&lt;/ModType&gt;
  19. &lt;Attribute&gt;GiveExperience&lt;/Attribute&gt;
  20. &lt;Value&gt;1&lt;/Value&gt;
  21. &lt;PerTurn&gt;1&lt;/PerTurn&gt;
  22. &lt;/GameModifier&gt;
  23. &lt;HideWhenUpgraded&gt;1&lt;/HideWhenUpgraded&gt;
  24. &lt;Type&gt;Defensive&lt;/Type&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;/AbilityBonus&gt;

Reply #5 Top

Oddly enough it gave the bear cub 2xp per turn, I never did figure out why.

Reply #6 Top

Isn't recasting/giving "exp per turn"....

 

    <SpellDef InternalName="MysticTraining">
        <DisplayName>Mystic Trainer</DisplayName>
        <Description>Units in the Sovereign's Army receive 10 experience points per turn.</Description>
        <Image>S_TirelessMarch_Painting.png</Image>
        <IconFG>S_TirelessMarch_Icon.png</IconFG>
        <CanStack>0</CanStack>
        <SpellBookSortCategory>Unit</SpellBookSortCategory>
        <SpellBookSortSubCategory>UnitEnchantment</SpellBookSortSubCategory>
        <SpellType>Strategic</SpellType>
        <SpellClass>Defensive</SpellClass>
        <SpellSubClass>Buff</SpellSubClass>
        <SpellTargetType>Self</SpellTargetType>
        <AutoUnlock>1</AutoUnlock>    
        <SpellResourceCost>
            <Resource>Mana</Resource>
            <Amount>10</Amount>
        </SpellResourceCost>
        <SpellResourceCost>
            <Resource>Mana</Resource>
            <PerTurn>5</PerTurn>
            <Amount>1</Amount>
        </SpellResourceCost>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>GiveExperience</Attribute>
            <Value>5</Value>
            <PerTurn>1</PerTurn>
        </GameModifier>
        <AIData AIPersonality="AI_General">
            <AIPriority>5</AIPriority>
        </AIData>
        <HitSoundFX>Spell_TirelessMarch_01</HitSoundFX>
        <SpellCastEffectName>T_Erosion_Particle</SpellCastEffectName>
        <SpellCastEffectScale>1</SpellCastEffectScale>
        <SpellCastProjectile>1</SpellCastProjectile>
        <SpellCastProjectileSpeed>700</SpellCastProjectileSpeed>
        <SpellDefEffect>
            <EffectName>T_ErosionImpact_Particle</EffectName>
            <LocalPosition>0,0,0</LocalPosition>
            <EffectScale>0.5</EffectScale>
            <EffectDelay>0</EffectDelay>
            <SnapToTerrain>1</SnapToTerrain>
        </SpellDefEffect>
    </SpellDef>

 

When this failed, I tried using Trainer. I tried <ModType> Self, Army, AllFriendlyUnits and Player. I also tried <Attribute> A_UnitStat_Experience, UnitStat_Experience, Army_Experience.

 

    <SpellDef InternalName="MysticTraining">
        <DisplayName>Mystic Trainer</DisplayName>
        <Description>Units in the Sovereign's Army receive 10 experience points per turn.</Description>
        <Image>S_TirelessMarch_Painting.png</Image>
        <IconFG>S_TirelessMarch_Icon.png</IconFG>
        <CanStack>0</CanStack>
        <SpellBookSortCategory>Unit</SpellBookSortCategory>
        <SpellBookSortSubCategory>UnitEnchantment</SpellBookSortSubCategory>
        <SpellType>Strategic</SpellType>
        <SpellClass>Defensive</SpellClass>
        <SpellSubClass>Buff</SpellSubClass>
        <SpellTargetType>Self</SpellTargetType>
        <AutoUnlock>1</AutoUnlock>    
        <SpellResourceCost>
            <Resource>Mana</Resource>
            <Amount>10</Amount>
        </SpellResourceCost>
        <SpellResourceCost>
            <Resource>Mana</Resource>
            <PerTurn>5</PerTurn>
            <Amount>1</Amount>
        </SpellResourceCost>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustArmyStat</Attribute>
            <Value>10</Value>
            <PerTurn>1</PerTurn>
        </GameModifier>
        <AIData AIPersonality="AI_General">
            <AIPriority>5</AIPriority>
        </AIData>
        <HitSoundFX>Spell_TirelessMarch_01</HitSoundFX>
        <SpellCastEffectName>T_Erosion_Particle</SpellCastEffectName>
        <SpellCastEffectScale>1</SpellCastEffectScale>
        <SpellCastProjectile>1</SpellCastProjectile>
        <SpellCastProjectileSpeed>700</SpellCastProjectileSpeed>
        <SpellDefEffect>
            <EffectName>T_ErosionImpact_Particle</EffectName>
            <LocalPosition>0,0,0</LocalPosition>
            <EffectScale>0.5</EffectScale>
            <EffectDelay>0</EffectDelay>
            <SnapToTerrain>1</SnapToTerrain>
        </SpellDefEffect>
    </SpellDef>

Once again, it failed.

 

My goal was to have this faction have 6 Unique Spells the Sovereign may enchant herself with, of which only one can be applied at a time. Once each spell complete, I was going to have each "spell effect" eliminate all other "spell effects" of these 6 unique spells.

 

Army Experience (Per Turn).

Army Accuracy %

Army Attack %

Army Defense %

No Wages

Hit Point %

 

Likewise, the faction is intended to receive -20% Experience from battles, however gain exp every turn (not just when stationed, as by a building). The second idea if that is a no-go is to have a building with an ability that lets you remove a unit, and receive it back with +1 level. (or delete the unit, and produce a clone of the unit with +1 level). The building will be a 3 stage ladder that starts with 20 turns of training, then 15 then 10.

Reply #7 Top

In those two spells you have listed above you have the Amount and PerTurn values mixed up under SpellResourceCost.  This could be a problem.

Reply #8 Top

Quoting halmal242, reply 3

Here you go.  Put this game modifier n works like a charm, I have tested it before.

Code: xml
<GameModifier>
<ModType>Unit</ModType>
<Attribute>GiveExperience</Attribute>
<Value>1</Value>
<PerTurn>1</PerTurn>
</GameModifier>

 

I've been trying to get this to work as a blood ability, trait ability, and even an item ability, but it fails to trigger.  The description pops up, and no errors occur, but it never triggers

Reply #9 Top

Did you do this within the mod files or are you editing the core files?

Reply #11 Top

Can you post your code for what you have done so far so we can look and see what might be the problem?

Reply #12 Top


well, basically I cut your code out and pasted it in the altarian blood ability to test.  I've tried it in various other places, as well as trying the AdjustUnitStat for experience.  Nothing seems to trigger.

<AbilityBonus InternalName="Blood_AltarianAbility">        

<AbilityBonusOption InternalName="Blood_Altarian">            

<DisplayName>Altarian Blood</DisplayName>            

<Description>+10% Experience and the ability to Rush in combat</Description>            

<Icon>RoundCrest_Altar.png</Icon>            

<GameModifier>                

<ModType>Unit</ModType>                

<Attribute>AdjustUnitStat</Attribute>                

<StrVal>UnitStat_ExpBonus</StrVal>                

<Value>10</Value>                

<Provides>+10% Experience</Provides>            

</GameModifier>            

<GameModifier>                

<ModType>Unit</ModType>                

<Attribute>UnlockCombatAbility</Attribute>                

<StrVal>Rush</StrVal>                

<Provides>Rush- Unit takes an extra action</Provides>            

</GameModifier>

<GameModifier>  

<ModType>Unit</ModType>  

<Attribute>GiveExperience</Attribute>  

<Value>1</Value>  

<PerTurn>1</PerTurn>  

</GameModifier>

           

<AIData AIPersonality="AI_General">                

<AIPriority>5</AIPriority>            

</AIData>        

</AbilityBonusOption>    

</AbilityBonus>

Reply #13 Top

Alright I have been experimenting with this again and now for some reason this is no longer working.

Reply #15 Top

After further playing around with this value it works for monsters but not units at all.  I am going to try to charm a monster and see if it still works then.

Reply #16 Top

Alright I have confirmed that this code works for monsters but will not work once you charm a monster.  I do not know why this doesn't work on anything that is under the control of a player or NPC.