Big Idea, but need lots of Help

I've been stalking the forums for a little while now, and have learned enough to start modding.  However I've recently ran into a problem that is only visual, but highly irritating.

UnitStat_BonusHealing    Default Value = 1  (This is because the game multiplies the value of the character for all heals, which lead to my display issue)

UnitStat_SpellDamage Default Value = 0 (Presumed, because I cannot find anywhere in the XMLs that it is even being used.)

Now I've looked through the files and see that Spell Damage is based off of 1=1%, but Bonus healing 1=100% .  So the ingame display percentage feature is not working correctly.  It displays percentages that are 100 times to low.  For example the default value of BonusHealing is 1.

So if I have it display the percentage of Bonus healing on the character screen it show up as 2% when in reality that character has 200% bonus healing. (yes, double effect on healing spells)

My question is how do I get this to display [*100] so that it is effectively the correct display?  Thanks in Advance.

 

Also, was wondering if anyone has figured out how to add effects to the autodefend feature.  For instance i want to make a unit that automatically provides a small heal to surrounding allies if it "defends" (no mana usage, just like 2hp heal)

 

11,914 views 12 replies
Reply #1 Top

1) It is not possible to do this.

2) Check out autodefend in CoreSpells.xml

Reply #2 Top

Look at the defender ability in CoreAbilities as well. I believe you could create a new unit stat like UnitStat_Tactical_Auto_Attack_Boost and edit Auto Defend to look at it as well so units with a points in UnitStat_Tactical_Auto_Attack_Boost get a attack boost when they defend.

Reply #3 Top

Quoting Davion1089, reply 4
Hm, I guess I don't know near enough about XML...How would I make auto defend ALSO look at something else.  Also I was under the impression that spells\abilities you edit with the mods folder are not really changed, but only stuff added.

Depends on the items that you would like to change. For example, when you overwrite spells it removes the entire spell (except the mana cost). If you overwrite a unit, it removes the entire unit. If you edit ability, it adds stuff to the ability. There is a nice forum post that describes more of this in greater detail... something about object sanity (or insanity).

+1 Loading…
Reply #4 Top

    <SpellDef InternalName="AutoDefend">
        <DisplayName>Defending</DisplayName>
        <Description>When a unit passes their attack action, their Defense is improved until their next action.</Description>
        <Image>Ability_Defend_Icon.png</Image>
        <IconFG>Ability_Defend_Icon.png</IconFG>
        <SpellBookSortCategory>Unit</SpellBookSortCategory>
        <SpellBookSortSubCategory>UnitEnchantment</SpellBookSortSubCategory>
        <SpellType>Tactical</SpellType>
        <SpellClass>Defensive</SpellClass>
        <SpellSubClass>Buff</SpellSubClass>
        <SpellTargetType>Self</SpellTargetType>
        <HideInHiergamenon>1</HideInHiergamenon>
        <IsCastable>0</IsCastable>
        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_Defense_Pierce</StrVal>
            <Duration>1</Duration>
            <UpdateDurationAtTurnStart>1</UpdateDurationAtTurnStart>
            <Effect>Y_Defend_Particle</Effect>
            <Calculate InternalName="Calc" ValueOwner="CastingUnit">
                <Expression><![CDATA[[UnitStat_Tactical_Auto_Defense_Boost]]]></Expression>
            </Calculate>
            <Calculate InternalName="Value">
                <Expression><![CDATA[[Calc]]]></Expression>
            </Calculate>
        </GameModifier>
    </SpellDef>

Well here is Auto Defend. As you can see all it does is look at the hidden stat UnitStat_Tactical_Auto_Defense_Boost and give a unit that much defense when it defends. UnitStat_Tactical_Auto_Defense_Boost is given by Defender abilities. So you need to create a new unit stat and then edit AutoDefend to also look at that hidden stat like UnitStat_Tactical_Auto_Attack_Boost and then give them attack equal to it. So you add this to it.

        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_Attack_Pierce</StrVal>
            <Duration>1</Duration>
            <UpdateDurationAtTurnStart>1</UpdateDurationAtTurnStart>
            <Effect>Y_Defend_Particle</Effect>
            <Calculate InternalName="Calc" ValueOwner="CastingUnit">
                <Expression><![CDATA[[UnitStat_Tactical_Auto_Attack_Boost]]]></Expression>
            </Calculate>
            <Calculate InternalName="Value">
                <Expression><![CDATA[[Calc]]]></Expression>
            </Calculate>
        </GameModifier>

Of course you would still need a trait that grants UnitStat_Tactical_Auto_Attack_Boost and you would want a version that heals using a new stat like UnitStat_Tactical_Auto_Healing_Boost instead.

 

Reply #5 Top

So, you can set up an ability that will put the character into defend mode and cast the spell. Think of the guard ability for example, and this will give you the animation.

You can also, use the UnitStat_IsPriest to set up whether a 'pass' does cast a spell. To get the animation to cast when defending, well you are going to have to probably create an entirely new animation scheme that overwrites the default animation of defend with this particular unit type. Using the stat to actually heal the unit. The shimmers around the surrounding units that get healed will be the only issue that cannot resolve be resolved this way.

I do not know anything about creating new animations, this as I've not done it before so I'm not sure of all the details that need to go into creating such an animation for the unit.

I nominate solution one and create just another ability (for ease).

Reply #6 Top

I haven't tested this to see if this would work with AutoDefend, so that is on you. This is the basic idea on how to get an if then statement to work in this game. The values are just 0 unless the unit has the stat, the it is a desired amount. There may be some tweaking needed to do exactly what you want but this is a shell.

    <SpellDef InternalName="AutoDefend">
        <DisplayName>Defending</DisplayName>
        <Description>When a unit passes their attack action, their Defense is improved until their next action.</Description>
        <Image>Ability_Defend_Icon.png</Image>
        <IconFG>Ability_Defend_Icon.png</IconFG>
        <SpellBookSortCategory>Unit</SpellBookSortCategory>
        <SpellBookSortSubCategory>UnitEnchantment</SpellBookSortSubCategory>
        <SpellType>Tactical</SpellType>
        <SpellClass>Defensive</SpellClass>
        <SpellSubClass>Buff</SpellSubClass>
        <SpellTargetType>FriendlyUnit</SpellTargetType> <!-- Target only the friendly units -->
   
        <IgnoreInvalidTargetsInRadius>1</IgnoreInvalidTargetsInRadius> <!-- Be able to use ability even if bad guys are in the radius -->
        <HideInHiergamenon>1</HideInHiergamenon>
        <IsCastable>0</IsCastable>
          <Radius>1</Radius> <!-- Spell is 1 radius around center of target -->
          <Range>0</Range> <!-- centered on caster -->

        <GameModifier>
            <ModType>Unit</ModType>
            <Attribute>AdjustUnitStat</Attribute>
            <StrVal>UnitStat_Defense_Pierce</StrVal>
            <Duration>1</Duration>
                <ApplyToCaster>1</ApplyToCaster> <!-- Make this affect only the caster -->
            <UpdateDurationAtTurnStart>1</UpdateDurationAtTurnStart>
            <Effect>Y_Defend_Particle</Effect>
            <Calculate InternalName="Calc" ValueOwner="CastingUnit">
                <Expression><![CDATA[[UnitStat_Tactical_Auto_Defense_Boost]]]></Expression>
            </Calculate>
            <Calculate InternalName="Value">
                <Expression><![CDATA[[Calc]]]></Expression>
            </Calculate>
        </GameModifier>
        <GameModifier> <!-- Priest Type Bonus copied wellsprings bonus with a little modification -->
                  <ModType>Unit</ModType>
                  <Attribute>CurHealth</Attribute>
                  <Calculate InternalName="Calc" ValueOwner="CastingUnit">

                      <Expression><![CDATA[[UnitOwner_GetNumLifeShards] * 4]]></Expression>
                   </Calculate>
                   <Calculate InternalName="Calc2" ValueOwner="CastingUnit">
                      <Expression><![CDATA[[Calc] + 24]]></Expression>
                   </Calculate>
                   <Calculate InternalName="Calc3" ValueOwner="CastingUnit">
                      <Expression><![CDATA[[Calc2] * [UnitStat_BonusHealing]]]></Expression>
                   </Calculate>                  
                   <Calculate InternalName="Calc4" ValueOwner="CastingUnit">

                       <Expression><![CDATA[[Calc3] * [UnitStat_IsPriest]]]></Expression> <!-- Value is 0 unless unit is a priest -->
                   </Calculate>
                   <Calculate InternalName="Value">
                       <Expression><![CDATA[[Calc4]]]></Expression>
                   </Calculate>

            </GameModifier>
            <GameModifier> <!-- Warrior Type Bonus -->
                   <ModType>Unit</ModType>
                   <Attribute>AdjustUnitStat</Attribute>
                   <StrVal>UnitStat_Attack_Pierce</StrVal>
                   <Calculate InternalName="Calc" ValueOwner="CastingUnit">
                        <Expression><![CDATA[[UnitStat_IsWarrior] * 10]]></Expression> <!-- Value is 0 unless unit is a warrior -->
                   </Calculate>
                   <Calculate InternalName="Value">
                        <Expression><![CDATA[[Calc]]]></Expression>
                   </Calculate>
              </GameModifier>

    </SpellDef>

+2 Loading…
Reply #7 Top

I did forget the <Duration> tag for the second spell and I'm not sure why the friendly units are not getting the spell effects cast upon them.