[possible bug] meleeappliesspell

its seems this thing can only work with 1 modifier at all

i tried many ways but it seems to only apply the first even if i put N modifiers

11,044 views 19 replies
Reply #1 Top

Give an example.

 

Reply #2 Top

i made a spell that buff the caster with meleeapplyspell X

 

X is debuff that changes a few things on target with 3 modifiers

it seems only the first in order of the 3 modifiers actually work (cause i tried changing the order and it changed which one worked)

Reply #3 Top

It must be some special circumstance then. here is an example that works. It is a weapon that calls a spelldef.

  <GameItemType InternalName="Reliquary_Mindkiller">
    <REQtype>Sword</REQtype>
    <REQmod>10 Weight
+17 Cutting attack
+2 Initiative
Each time this weapon strikes an enemy target 3 Spell Mastery and Spell Resist is drained from target and given to wielder for 10 round. Stacks.</REQmod>
    <DisplayName>Mindthief</DisplayName>
    <Description>Reliquary Item #76. What looks like an ordinary Scinan broadword. The sword has the incredible effect of "stealing" thoughts from whoever it cuts. The thoughts will appear in the wielder's mind as if he or she had thought it themselves, but still easily identifiable as belonging to someone else. The person who has the thoughts stolen experience severe discomfort, some say it even wounds their soul temporarily. The person who wields the sword may also experience a slight increase in intelligence briefly. Theoretically the sword holds an omnious power - in the wrong hands it could be used as a tyrant's tool. When used in combat, mostly things happen too fast for the stolen thoughts to be of any use to the wielder.</Description>
    <Type>Weapon</Type>
    <WeaponType>OneHanded</WeaponType>
    <CanBeEquipped>1</CanBeEquipped>
    <ShopValue>600</ShopValue>
    <GameModifier>
      <ModType>Unit</ModType>
      <Attribute>AdjustUnitStat</Attribute>
      <StrVal>UnitStat_Attack_Cutting</StrVal>
      <Value>17</Value>
    </GameModifier>
    <GameModifier>
      <ModType>Unit</ModType>
      <Attribute>AdjustUnitStat</Attribute>
      <StrVal>UnitStat_CombatSpeed</StrVal>
      <Value>2</Value>
    </GameModifier>
    <GameModifier>
      <ModType>Unit</ModType>
      <Attribute>AdjustUnitStat</Attribute>
      <StrVal>UnitStat_CurrentWeight</StrVal>
      <Value>10</Value>
    </GameModifier>
    <GameModifier>
      <ModType>Unit</ModType>
      <Attribute>MeleeAppliesSpell</Attribute>
      <StrVal>Reliquary_Mindkiller</StrVal>
      <Provides>Each time this weapon strikes an enemy target 3 Spell Mastery and Spell Resist is drained from target and given to wielder for 10 rounds. Stacks.</Provides>
    </GameModifier>
    <IsAvailableForSovereignCustomization>0</IsAvailableForSovereignCustomization>
    <Likelihood>250</Likelihood>
    <RarityDisplay>Rare</RarityDisplay>
    <HeroOnly>1</HeroOnly>
    <IsAvailableForUnitDesign>0</IsAvailableForUnitDesign>
    <Prereq>
      <Type>UnitStat_Level</Type>
      <Attribute>6</Attribute>
    </Prereq>
    <AIData AIPersonality="AI_General">
      <AIPrefType>AIPrefType_CUTTING</AIPrefType>
      <AIPriority>400</AIPriority>
    </AIData>
    <ArtDef>Broadsword_Champions_ArtDef</ArtDef>
  </GameItemType>
End of quote

the spelldef

  <SpellDef InternalName="Reliquary_Mindkiller">
    <DisplayName>Mindthief</DisplayName>
    <Description>Each time struck by a Mindthief weapon reduces Spell Mastery and Spell Resist by 3</Description>
    <Image>W_Broadsword_Scinan_Icon_01.png</Image>
    <IconFG>W_Broadsword_Scinan_Icon_01.png</IconFG>
    <IconBG>W_Broadsword_Scinan_Icon_01.png</IconBG>
    <IconColor>255,103,2</IconColor>
    <HideInHiergamenon>1</HideInHiergamenon>
    <IsCastable>0</IsCastable>
    <SpellType>Tactical</SpellType>
    <SpellClass>Offensive</SpellClass>
    <SpellSubClass>Damage</SpellSubClass>
    <SpellTargetType>EnemyUnit</SpellTargetType>
    <Radius>0</Radius>
    <CanStack>1</CanStack>
    <GameModifier>
      <ModType>Unit</ModType>
      <Attribute>AdjustUnitStat</Attribute>
      <StrVal>UnitStat_MagicResist</StrVal>
      <Duration>10</Duration>
      <Value>-3</Value>
    </GameModifier>
    <GameModifier>
      <ModType>Unit</ModType>
      <Attribute>AdjustUnitStat</Attribute>
      <StrVal>UnitStat_MagicResist</StrVal>
      <Duration>10</Duration>
      <ApplyToCaster>1</ApplyToCaster>
      <Value>3</Value>
    </GameModifier>
    <GameModifier>
      <ModType>Unit</ModType>
      <Attribute>AdjustUnitStat</Attribute>
      <StrVal>UnitStat_MagicPower</StrVal>
      <Duration>10</Duration>
      <Value>-3</Value>
    </GameModifier>
    <GameModifier>
      <ModType>Unit</ModType>
      <Attribute>AdjustUnitStat</Attribute>
      <StrVal>UnitStat_MagicPower</StrVal>
      <Duration>10</Duration>
      <ApplyToCaster>1</ApplyToCaster>
      <Value>3</Value>
    </GameModifier>
    <AIData AIPersonality="AI_General">
      <AIPriority>40</AIPriority>
    </AIData>
    <HitSoundFX>Spell_Fireball_01</HitSoundFX>
    <SpellDefEffect>
      <EffectName>T_Soulburning_Particle</EffectName>
      <LocalPosition>0, 0 ,0</LocalPosition>
      <EffectScale>0.50</EffectScale>
      <EffectDelay>0.25</EffectDelay>
      <SnapToTerrain>1</SnapToTerrain>
    </SpellDefEffect>
  </SpellDef>
End of quote

It works just as stated, wearer gains 3 spell resist and 3 spell mastery for every time the enemy is stricken, and target loses 3 of both every time.

 

Reply #4 Top

Not to be picky (ok, to be picky) shouldn't SpellSubClass be Debuff in this case?

Reply #5 Top

Since it never appears in any spellbook it doesn't matter.

Reply #6 Top

You're right.  I guess the AI never picks an item based off what spell it may apply.

Reply #7 Top

is it possible the problem is with "canstack" ?

 

my buff cannot stack

so maybe the bug is that each modifier apply something the game read as stacks and so doesnt put the second after the first modifier is in?

Reply #8 Top

Post your XML and I'll check it out.

Reply #9 Top

i changed it since it wasnt working :D

anyway it was something like this:

 

    <SpellDef InternalName="spell_cripplingpoison">
        <DisplayName>crippling poison</DisplayName>
        <Description>apply crippling poison to your dagger for 3 turns</Description>
        <Image>T_Chaos_Painting.png</Image>
        <IconFG>Ability_PathOfTheAssassin_Icon.png</IconFG>
        <IconColor>32,45,243</IconColor>
        <Cooldown>6</Cooldown>
        <AutoUnlock>1</AutoUnlock>
        <SpellBookSortCategory>Unit</SpellBookSortCategory>
        <SpellBookSortSubCategory>UnitEnchantment</SpellBookSortSubCategory>
        <SpellType>Tactical</SpellType>
        <SpellClass>Defensive</SpellClass>
        <SpellSubClass>Buff</SpellSubClass>
        <SpellTargetType>Self</SpellTargetType>
        <CastTime>1</CastTime>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>MeleeAppliesSpell</Attribute>
            <StrVal>cripplingpoison_effect</StrVal>
            <duration>3</duration>
        </GameModifier>
        <Prereq>
            <Type>AbilityBonusOption</Type>
            <Attribute>cripplingpoison</Attribute>
        </Prereq>
        <Prereq>
            <Type>UnitStat</Type>
            <Attribute>UnitStat_IsUsingDagger</Attribute>
            <value>1</value>
        </Prereq>
        <AIData AIPersonality="AI_General">
            <AIPriority>50</AIPriority>
        </AIData>
        </SpellDefEffect>
    </SpellDef>

 

    <SpellDef InternalName="cripplingpoison_effect">
        <DisplayName>crippling poison </DisplayName>
        <Description>reduce Target enemy unit attack by 25% and movement speed by 1</Description>
        <Image>T_Shrink_Painting.png</Image>
        <IconFG>T_Shrink_Icon.png</IconFG>
        <IconBG>T_Shrink_Icon_BG.png</IconBG>
        <IconColor>210,110,210</IconColor>
        <SpellType>Tactical</SpellType>
        <SpellClass>Offensive</SpellClass>
        <SpellSubClass>Damage</SpellSubClass>
        <SpellTargetType>EnemyUnit</SpellTargetType>
        <IsCastable>0</IsCastable>
         <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_Attack_Boost</StrVal>
            <DisplayName>Weakened</DisplayName>
            <Duration>2</Duration>
            <Calculate InternalName="Calc" ValueOwner="TargetUnit">
                <Expression><![CDATA[[UnitStat_CombinedAttack] * -0.25]]></Expression>
            </Calculate>
            <Calculate InternalName="Calc2" ValueOwner="TargetUnit">
                <Expression><![CDATA[[Unit_GetTroopCount]]]></Expression>
            </Calculate>
           <Calculate InternalName="Value">
                <Expression><![CDATA[[Calc] / [Calc2]]]></Expression>
            </Calculate>
        </GameModifier>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_Moves</StrVal>
            <Duration>2</Duration>
            <Value>-1</Value>
        </GameModifier>
        <AIData AIPersonality="AI_General">
            <AIPriority>5</AIPriority>
        </AIData>
    </SpellDef>

 

 

Reply #10 Top

Try setting the moves attribute to "setunitstat" with a value of 1. I think 0 moves causes combat to freeze.

Reply #11 Top

It certainly is bugged, only one effect gets applied. If I put <CanStack>1</CanStack> it works, but that's not a solution.

Time to go through my meleeappliesspell stuff and see if I need to change anything. Thanks for posting this bug.

 If you want a work-around, make the spell apply a trait instead to the target. The trait can expire after 5 turns, and you obviously don't need to worry about it stacking.

Reply #12 Top

Another solution is to split the effect in two so you do two meleeappliesspell to different spells. A bit spammy but it works.

Reply #13 Top

Quoting Heavenfall, reply 12
It certainly is bugged, only one effect gets applied. If I put <CanStack>1</CanStack> it works, but that's not a solution.

Time to go through my meleeappliesspell stuff and see if I need to change anything. Thanks for posting this bug.

 If you want a work-around, make the spell apply a trait instead to the target. The trait can expire after 5 turns, and you obviously don't need to worry about it stacking.
End of Heavenfall's quote
Quoting Heavenfall, reply 12
It certainly is bugged, only one effect gets applied. If I put <CanStack>1</CanStack> it works, but that's not a solution.

Time to go through my meleeappliesspell stuff and see if I need to change anything. Thanks for posting this bug.

 If you want a work-around, make the spell apply a trait instead to the target. The trait can expire after 5 turns, and you obviously don't need to worry about it stacking.
End of Heavenfall's quote

whats the  command to apply a trait?

Reply #14 Top

See this reply first, it's a more elegant solution: https://forums.elementalgame.com/432806/get;3239436

  <GameModifier>
      <ModType>Unit</ModType>
      <Attribute>UnlockUnitAbility</Attribute>
      <StrVal>Reliquary_Cursed</StrVal>
    </GameModifier>

Reply #15 Top

ok ty, the additional code needed seems to be about the same anyway

 

or i might just cut the movement part anyway ai will never be able to use this advantage and will never be able to get abused by it so i might just not have it uhmmm

Reply #16 Top

i just noticed that i had the type on the trait giving this spell set to "spell"

 

is it for ai choices only or it has some purpose ?

Reply #17 Top

I doubt that does more than AI and sorting. 

Reply #18 Top

Looks like this bug is getting fixed! From the 0.99 changelog

Fixed a bug where spells applied on melee attack or defense only applied the first modifier
End of quote

Reply #19 Top

yay!