AdjustDefendingUnit in Spells

Does anyone know if AdjustDefendingUnit modifiers work when used in spells? I just can't seem to get this spell to function properly:

Code: xml
  1. <SpellDef InternalName="Consecration">
  2.         <DisplayName>Consecration</DisplayName>
  3.         <Description>Defending units in target city gain +10 Magic Resistance.</Description>
  4.         <Image>BG_Spell_CityDefense.png</Image>
  5.         <IconFG>Enchant_Defenses.png</IconFG>
  6.         <IconColor>145,255,172</IconColor>
  7.         <Range>3</Range>
  8.         <SpellLevel>3</SpellLevel>
  9.         <SoundFX>Spell_EnchantLand_01</SoundFX>
  10.         <SpellType>Strategic</SpellType>
  11.         <SpellClass>Defensive</SpellClass>
  12.         <SpellTargetType>FriendlyCity</SpellTargetType>
  13.         <ValidTerrainCategory>Land</ValidTerrainCategory>
  14.         <ValidTerrainCategory>Beach</ValidTerrainCategory>
  15.         <ValidTerrainCategory>Forest</ValidTerrainCategory>
  16.         <ValidTerrainCategory>City</ValidTerrainCategory>
  17.         <CastTime>1</CastTime>
  18.     
  19.         <RequiredStat>UnitStat_Intelligence, 32</RequiredStat>
  20.             
  21.         <SpellResourceCost>
  22.             <Resource>Mana</Resource>
  23.             <Amount>64</Amount>
  24.         </SpellResourceCost>
  25.         <SpellResourceCost>
  26.             <Resource>Mana</Resource>
  27.             <Amount>1</Amount>
  28.             <PerTurn>1</PerTurn>
  29.         </SpellResourceCost>
  30.         <SpellDefEffect>
  31.             <EffectName>Enchant_Defenses</EffectName>
  32.             <LocalPosition>0,50,0</LocalPosition>
  33.             <EffectScale>1.5</EffectScale>
  34.             <EffectDelay>0.0</EffectDelay>
  35.             <SnapToTerrain>1</SnapToTerrain>
  36.         </SpellDefEffect>
  37.         
  38.         <GameModifier InternalName="Consecration_MagicResist">
  39.             <Type>City</Type>
  40.             <Attribute>AdjustDefendingUnit</Attribute>
  41.             <StrVal>UnitStat_MagicResist</StrVal>
  42.             <Operator>+</Operator>
  43.             <Value>10.0</Value>
  44.             <PerTurn>1</PerTurn>
  45.             <Duration>-1</Duration>
  46.         </GameModifier>
  47.   </SpellDef>

6,069 views 6 replies
Reply #1 Top

            <GameModifier>
            <ModType>City</ModType>
                <Attribute>AdjustDefendingUnit</Attribute>
            <StrVal>UnitStat_MagicResist</StrVal>
            <Value>10</Value>
        </GameModifier>
End of quote

Reply #2 Top

Quoting Heavenfall, reply 1

            <GameModifier>
            <ModType>City</ModType>
                <Attribute>AdjustDefendingUnit</Attribute>
            <StrVal>UnitStat_MagicResist</StrVal>
            <Value>10</Value>
        </GameModifier>
End of Heavenfall's quote

Nope, that doesn't work either...

At this point, I've pretty much tried every combination of the Attributes I have in the GameModifier above... none of them worked. City Info screen just shows the Magic Resist icon and +1000% from the spell, but does not actually modify the Magic Resistance stat at all, either stationed or trained units.

Reply #3 Top

  <SpellDef InternalName="NaturesBounty">
    <DisplayName>Nature's Bounty</DisplayName>
    <Description>Cast this spell on your city for a +1 to food.</Description>
    <Image>Nature'sBounty_Painting.png</Image>
    <IconFG>NaturesBounty_Icon.png</IconFG>
    <IconBG>NaturesBounty_Icon_BG.png</IconBG>
    <IconColor>221,202,112</IconColor>
    <!--<Range>3</Range>-->
    <SpellLevel>1</SpellLevel>
    <RequiredStat>UnitStat_Intelligence, 15</RequiredStat>
    <SoundFX>Spell_Enchant_01</SoundFX>
    <SpellType>Strategic</SpellType>
    <SpellClass>Defensive</SpellClass>
    <SpellTargetType>FriendlyCity</SpellTargetType>
    <CityTargetResourcePrereq>Rations</CityTargetResourcePrereq>
    <ValidTerrainCategory>Land</ValidTerrainCategory>
    <ValidTerrainCategory>Beach</ValidTerrainCategory>
    <ValidTerrainCategory>Forest</ValidTerrainCategory>
    <ValidTerrainCategory>City</ValidTerrainCategory>

    <CastTime>1</CastTime>
    <SpellResourceCost>
      <Resource>Mana</Resource>
      <Amount>2</Amount>
    </SpellResourceCost>
    <SpellResourceCost>
      <Resource>Mana</Resource>
      <Amount>1</Amount>
      <PerTurn>1</PerTurn>
    </SpellResourceCost>

            <GameModifier>
            <ModType>City</ModType>
                <Attribute>AdjustDefendingUnit</Attribute>
            <StrVal>UnitStat_MagicResist</StrVal>
            <Value>10</Value>
        </GameModifier>
    
    <SpellDefEffect>
      <EffectName>Enchant_Farm</EffectName>
      <LocalPosition>0,0,0</LocalPosition>
      <EffectScale>.75</EffectScale>
      <EffectDelay>0.0</EffectDelay>
      <SnapToTerrain>1</SnapToTerrain>
    </SpellDefEffect>
    <GameModifier InternalName="Food">
      <ModType>Resource</ModType>
      <Attribute>Rations</Attribute>
      <Value>1.0</Value>
      <Duration>-1</Duration>
    </GameModifier>
  </SpellDef>

End of quote

Works. Check your other code for errors.

Reply #4 Top

Huh, that's really weird... I swear, I had exactly what you had and it wasn't working...

Oh well, crack it up to stupidity and missing something incredibly obvious, I guess... :'(

Thanks again!

Reply #5 Top

Only difference I see between your spell and Heavenfall's test is that you have assigned an InternalName to your GameModifier section and he did not. Of course, not sure why that would matter.

Reply #6 Top

Quoting Capn, reply 5
Only difference I see between your spell and Heavenfall's test is that you have assigned an InternalName to your GameModifier section and he did not. Of course, not sure why that would matter.
End of Capn's quote

It doesn't, I added the InternalName back onto my spell after copying the GameModifier block from Heavenfall's test spell. Furthermore, I added the infinite Duration back too. It's either the PerTurn, the Operator, or I screwed up somewhere else stupid.