Detecting metal / non-metal items

Does anyone know if it's possible to access ProductionRequirement -> Resource -> Metal within GameItemType in a spell or effects GameModifier?

I'm trying to cause extra damage to units carry metal items with electricity based attacks, for instance.

 

7,473 views 4 replies
Reply #1 Top

No, but what you can do is attach additional stats to the items you think should take extra damage. For example, you can have UnitStat_ElementalWeakness where 1 is default (100%, ie normal damage, defined like in coreunitstats). Then you can make the item increase the stat for the unit, so that the stat goes up. Then, as the stat goes up, you can run gamemodifiers against that number in your spells.

To clarify,

1) Create new unitstat like those found in CoreUnitstats.xml

2) Create gamemodifier to increase the new stat in the itemtype

3) When calculating damage for your spell, include a reference to the new stat in your damage calculations

Reply #2 Top

So, just to clarify:

 

1)Create UnitStat_LightningWeakness in example_coreunitstats.xml, set to 1.

2)Add GameModifier to each 'metal' item which adjusts UnitStat_LightningWeakness by 10%:

<GameModifier InternalName="LightWeakAdjust">

  <ModType>Unit</ModType>

  <Attribute>AdjustUnitStat</Attribute>

  <StrVal>UnitStat_LightningWeakness</StrVal>

  <Value>10</Value>

  <Operator>%<Operator>

</GameModifier

3)Then in the GameModifier "Damage" for spell "UltraMegaLightningSplosion" something like this:

<GameModifier InternalName="UMLSDamage">

  <ModType>Unit</ModType>

  <Attribute>CurHealth</Attribute>

  <Calculate InternalName="AirShardBonus" ValueOwner="CastingUnit">

    <Expression><![CDATA[[UnitStat_NumAirShards] * -5]]></Expression>

  </Calculate>

  <Calculate InternalName="LightningWeaknessBonus" ValueOwner="TargetUnit">

    <Expression><![CDATA[[UnitStat_LightningWeakness] * -50]]></Expression>

  </Calculate>

  <Calculate InternalName="Value">

    <Expression><![CDATA[[AirShardBonus] + [LightningWeaknessBonus]]]></Expression>

  </Calculate>

</GameModifier>

 

 

Reply #3 Top

Yes.

+1 Loading…
Reply #4 Top

Thanks.  Potentially a lot of work, but I like the possibilities this opens up.