How to make calculations for unitstats work

I want to give stationed units bonus experience based on the essence of the city.

        <GameModifier>
            <ModType>StationedUnitStatBonus</ModType>
            <StrVal>UnitStat_Experience</StrVal>
            <StrVal2>OnlyTrainedUnits</StrVal2>
            <Calculate InternalName="value" ValueOwner="OwnerCity">
                <Expression><![CDATA[[TileYieldEssence] + 1]]></Expression>
            </Calculate>
            <BonusValue>100</BonusValue>
            <Provides>Stationed non-champion units gain 1xp/essence per season</Provides>
        </GameModifier>

But it doesn't work. Maybe the string for ValueOwner-tag is wrong. I tried "Unit" or "StationedUnit" instead of "OwnerCity" but without success.

Anyone have an idea?

3,558 views 4 replies
Reply #1 Top

This is inside a spell you cast on a city? Make it TargetCity. Also try adding <HasUpgradableValue>1</HasUpgradableValue> and remove <StrVal2>OnlyTrainedUnits</StrVal2>

Reply #2 Top

Thank you for the quick response.

 

It is inside a building not a spell.

And <StrVal2>OnlyTrainedUnits</StrVal2> should deny the bonus to champions.

 

Your idea with <HasUpgradableValue>1</HasUpgradableValue>  was good. I think it must be included.

I changed it to your proposal, but without sucess.

I tried making a spell too, in which I included <PerTurn>1</PerTurn>.

But it worked neighter as improvement nor as spell.

 

 

 

Reply #3 Top

Probably the modtype does not support calculates then.