Why does this formatteddescription evaluate to zero?

Hi all,

I'm having trouble getting formatted descrptions to display the right value for some spells.  For example I've got a spell that I want to cause 4 + (half casters level) poison damage.  This is the GameModifier:

<GameModifier>
   <ModType>Unit</ModType>
   <Attribute>DefendableDamage</Attribute>
   <AttackStat>UnitStat_Attack_Poison</AttackStat>
   <IsForFormattedDescription>1</IsForFormattedDescription>
   <Calculate InternalName="Calc" ValueOwner="CastingUnit">
      <Expression><![CDATA[4]]></Expression>
   </Calculate>
   <Calculate InternalName="Calc2" ValueOwner="CastingUnit">
     <Expression><![CDATA[[Unit_GetLevel] / 2]]></Expression>
   </Calculate>
   <Calculate InternalName="Value">
      <Expression><![CDATA[[Calc] + [Calc2]]]></Expression>
   </Calculate>
   <Calculate InternalName="ValueForFormattedDescription">
      <Expression><![CDATA[[Calc] + [Calc2]]]></Expression>
   </Calculate>
</GameModifier>

And here's the formatteddescription:

<FormattedDescription>A medium range toxic magical attack strikes for %d poison damage.</FormattedDescription>

 

This is always showing "0 poison damage" in the formatted description.   Can anyone see anything obvsious I have done wrong?

 

Thanks.

2,181 views 2 replies
Reply #1 Top

<Calculate InternalName="Calc" ValueOwner="CastingUnit">
      <Expression><![CDATA[4]]></Expression>
   </Calculate>

This is your problem. Change the gamemodifier to this, and it should work out:

<GameModifier>
   <ModType>Unit</ModType>
   <Attribute>DefendableDamage</Attribute>
   <AttackStat>UnitStat_Attack_Poison</AttackStat>
   <IsForFormattedDescription>1</IsForFormattedDescription>
   <Calculate InternalName="Calc" ValueOwner="CastingUnit">
     <Expression><![CDATA[[Unit_GetLevel] / 2]]></Expression>
   </Calculate>
   <Calculate InternalName="Value">
      <Expression><![CDATA[[Calc] + 4]]></Expression>
   </Calculate>
   <Calculate InternalName="ValueForFormattedDescription">
      <Expression><![CDATA[[Calc] + 4]]></Expression>
   </Calculate>
</GameModifier>

Reply #2 Top

Sweet that did it thanks.  Funny this was I copied the...

<Expression><![CDATA[4]]></Expression>

bit from SummonShadowWarg... it has something similar.

Oh well it works, cheers.   :thumbsup: