Ok, to get what I'm talking about, think about an archer. When you train a group, team, squad, whatever, of archers, you do 4x or 9x more damage depending on how many troups are in the group. So if you have an individual that does 10 dmg, the group (4) of archers would do 40. As it is right now, if you assign a special ability to a unit, it does NOT stack if you were to train a group. As in, if you train a squad of guys that have an ability thats a tactical spell (say, fireball for example), they will do the same dmg as an individual using the same ability. I believe this is by design. Howvever, with the help of Heavenfall I discovered a way to get around this. I have a unit for my mod that has a special ability thats a tactical spell (basicaly like fireball but different particle effect). I tihnk that if i have a "unit" of four of these guys with this ability, it should do 4 times the dmg. I'm assuming you know how to attach an ability to a unit, as there is already a tutorial for that. This problem is solved in the spell definition (the calculate tags to be exact).
Bear with me, as this spell also is modified by the amount of fireshards, and caster's INT. Here's the original lines in the spelldef (just the calculate tags)
Code: xml
- <Calculate InternalName="ExtraDamageFromShards" ValueOwner="CastingUnit">
- <Expression><![CDATA[[UnitStat_NumFireShards] * -3]]></Expression>
- </Calculate>
- <Calculate InternalName="ExtraDamageFromIntelligence" ValueOwner="CastingUnit">
- <Expression><![CDATA[[UnitStat_Intelligence]/-10]]></Expression>
- </Calculate>
- <Calculate InternalName="TotalBonusDamage">
- <Expression><![CDATA[[ExtraDamageFromShards] + [ExtraDamageFromIntelligence]]]></Expression>
- </Calculate>
- <Calculate InternalName="MinValue">
- <Expression><![CDATA[[TotalBonusDamage] + -3]]></Expression>
- </Calculate>
- <Calculate InternalName="MaxValue">
- <Expression><![CDATA[[TotalBonusDamage] + -6]]></Expression>
- </Calculate>
Ok, now, all I really did was to add the TroopCount variable to the whole thing to produce:
Code: xml
- <Calculate InternalName="ExtraDamageFromShards" ValueOwner="CastingUnit">
- <Expression><![CDATA[[UnitStat_NumFireShards] * -3]]></Expression>
- </Calculate>
- <Calculate InternalName="ExtraDamageFromIntelligence" ValueOwner="CastingUnit">
- <Expression><![CDATA[[UnitStat_Intelligence]/-5]]></Expression>
- </Calculate>
- <Calculate InternalName="TotalBonusDamage1" ValueOwner="CastingUnit">
- <Expression><![CDATA[[ExtraDamageFromShards] + [ExtraDamageFromIntelligence]]]></Expression>
- </Calculate>
- <Calculate InternalName="TotalBonusDamage" ValueOwner="CastingUnit">
- <Expression><![CDATA[[TotalBonusDamage1] * [TroopCount]]]></Expression>
- </Calculate>
-
- <Calculate InternalName="MinValue">
- <Expression><![CDATA[[TotalBonusDamage] + -5]]></Expression>
- </Calculate>
- <Calculate InternalName="MaxValue">
- <Expression><![CDATA[[TotalBonusDamage] + -12]]></Expression>
- </Calculate>
Ok. That will make it work now. One thing I discovered is that you can make a spell "scale" to the troops you're attacking. If you take the ValueOwner="CastingUnit" out of the line which uses TroopCount (Defining TotalBonusDamage" above), it will use the troopcount of the enemy. So, your spell will do more damage to a group than an individual.
Thanks again Heavenfall for seting me straight about calculate!
I hope this helps someone else out, as it drove me nuts for a while.