Casting Spells that give spell abilities onto normal units

By on October 20, 2013 3:23:55 PM from Elemental Forums Elemental Forums

Winnihym

Join Date 03/2006
+17

One of my personal disappointments with FE/LH is that a priest like normal unit never made it into the game.  There is, to my knowledge, no way for a regular unit to gain the ability to heal another unit.  There are spells that confer that ability onto a champion, but not a regular unit. 

I am not a modder.

Before I start learning how to do this, I wanted to know if such a thing was even theoretically possible, or if there were tags that prevented a regular unit from ever having a spell cast upon them that confers a spell (the heal one in particular).

Locked Post 22 Replies
Search this post
Subscription Options


Reason for Karma (Optional)
Successfully updated karma reason!
October 20, 2013 4:43:31 PM from Elemental Forums Elemental Forums

You can create an ability or trait that you can attach to a trained unit and give them ability to heal another unit. This is already in the game in theory with the henchmen of altar. They have a life henchman that can cast heal on the units. But it is perfectly reasonable to attach this to a regular unit.

Reason for Karma (Optional)
Successfully updated karma reason!
October 21, 2013 10:18:39 AM from Elemental Forums Elemental Forums

There are some summoner units in one of the mods I use that can summon elementals, so it is definitely possible for regular non-henchman units to cast spells, even ones that cost mana (like the elemental summoners).

Reason for Karma (Optional)
Successfully updated karma reason!
October 21, 2013 10:35:39 AM from Elemental Forums Elemental Forums

Hmmm... I think I know that summoner mod

 

Reason for Karma (Optional)
Successfully updated karma reason!
October 21, 2013 10:52:20 AM from Elemental Forums Elemental Forums

Quoting parrottmath,
Hmmm... I think I know that summoner mod

I hear the guy who did that knows his stuff...

Reason for Karma (Optional)
Successfully updated karma reason!
October 21, 2013 11:26:16 AM from Elemental Forums Elemental Forums

BIG SELF-PLUG ALERT!!!

Reason for Karma (Optional)
Successfully updated karma reason!
October 21, 2013 11:36:56 AM from Elemental Forums Elemental Forums

Oops, maybe I should clarify... the guy who did the summoner units mod mentioned here:

http://forums.elementalgame.com/444851/page/7/#3403768

knows what he's doing.

 

The guy responsible for this though:

http://forums.elementalgame.com/446891/page/3/#3392066

...is a clown.  Don't listen to a word he says.

 

Reason for Karma (Optional)
Successfully updated karma reason!
October 21, 2013 11:40:10 AM from Elemental Forums Elemental Forums

Alright. <grin>  Nice mods though (by both of you ).

Reason for Karma (Optional)
Successfully updated karma reason!
October 21, 2013 12:19:51 PM from Elemental Forums Elemental Forums

N/A

Reason for Karma (Optional)
Successfully updated karma reason!
October 21, 2013 1:51:25 PM from Elemental Forums Elemental Forums

i believe if you make it a tactical SKILL you'll have no problems. I doubt normal units can cast SPELLS, tactical or strategical. Add <IsSpecialAbility>1</IsSpecialAbility> to a spelldef to turn a SPELL into a SKILL.

Reason for Karma (Optional)
Successfully updated karma reason!
October 22, 2013 7:56:17 PM from Elemental Forums Elemental Forums

So, what tag on champions makes them able to have the spell that grants healing cast upon them, but disallows that spell to be cast on, say, a group of archers?

Reason for Karma (Optional)
Successfully updated karma reason!
October 22, 2013 8:14:23 PM from Elemental Forums Elemental Forums

<SpellTargetType>Self</SpellTargetType>

<SpellTargetType>FriendlyChampion</SpellTargetType>

<SpellTargetType>FriendlyChampionOrSov</SpellTargetType>

Reason for Karma (Optional)
Successfully updated karma reason!
October 22, 2013 9:18:49 PM from Elemental Forums Elemental Forums


So, in theory, you could make a new spell def as this:

 

-<SpellDef InternalName="BlessingOfRestoration">

<DisplayName>Blessing of Restoration</DisplayName>

<Description>Allows the targeted Champion to be able to cast Heal.</Description>

<Image>S_BlessingOfRestoration_Painting.png</Image>

<IconFG>S_BlessingOfRestoration_Icon.png</IconFG>

<SpellBookSortCategory>Unit</SpellBookSortCategory>

<SpellBookSortSubCategory>UnitEnchantment</SpellBookSortSubCategory>

<SpellType>Strategic</SpellType>

<SpellClass>Defensive</SpellClass>

<SpellSubClass>Buff</SpellSubClass>

<SpellTargetType>FriendlyUnit</SpellTargetType>

<CasterMustBeSov>1</CasterMustBeSov>

<UniqueSpellUnlock>Heal</UniqueSpellUnlock>

-<Prereq>

<Type>Allegiance</Type>

<Attribute>Kingdom</Attribute>

</Prereq>

-<SpellResourceCost>

<Resource>Mana</Resource>

<Amount>50</Amount>

</SpellResourceCost>

-<SpellResourceCost>

<Resource>Mana</Resource>

<PerTurn>1</PerTurn>

<Amount>1</Amount>

</SpellResourceCost>

-<GameModifier>

<ModType>Unit</ModType>

<Attribute>UnlockSpell</Attribute>

<StrVal>Heal</StrVal>

<Duration>-1</Duration>

</GameModifier>

-<AIData AIPersonality="AI_General">

<AIPriority>30</AIPriority>

</AIData>

<HitSoundFX>Spell_MantleOfFire_01</HitSoundFX>

-<SpellDefEffect>

<EffectName>S_MantleofFire_Particle</EffectName>

<LocalPosition>0,0,0</LocalPosition>

<EffectScale>1</EffectScale>

<EffectDelay>0</EffectDelay>

<SnapToTerrain>1</SnapToTerrain>

</SpellDefEffect>

</SpellDef>

 

And this would allow me to have units that cast heal.  I could further pull a unit count and have the mana cost be tied to the number of units in the stack, and to have <Prereq> requirements of no armor or weapons.  Correct?

 

Also, could someone point me to the posting that explains how to cut and paste XML into this forum so that I don't have to insert my own CRs?

 

Thanks!

Reason for Karma (Optional)
Successfully updated karma reason!
October 23, 2013 11:15:26 AM from Elemental Forums Elemental Forums

Yes and no.

See what Heavenfall said... a normal unit can't cast a spell, so if you do it just like you have there it won't quite work.

If you want it to work on normal units, you've have to create a new SpellDef that is a Skill, rather than a Spell... so make a copy of the Heal spell but add the tag that Heavenfall said <IsSpecialAbility>1</IsSpecialAbility>.

Look in your CoreSpell.xml, and see how there is a spell called "Fireball" and a copy called "Fireball_Ability".  The one with _ability is activated via the Skill button in tactical rather than the Spell button.

I think you can still have a mana cost for a skill ability but you'll need to test it to be sure.

 

BTW do yo particularly want it to be granted to the unit by casting a spell on the unit ala Blessing of Restoration?  Because you can always make it a Unit Design ability if that's what you're after.

Reason for Karma (Optional)
Successfully updated karma reason!
October 25, 2013 10:30:22 AM from Elemental Forums Elemental Forums

Thanks for helping, all.  Yes, from a gameplay standpoint, hit points on units are a precious consumable commodity.  They regenerate slowly over time, much like coin or mana, but they get consumed during battles.  Being able to convert one resource to another (in this case, mana to hit points) is a strategic decision.  One of the design flaws, IMO, with the skills system is that the opportunity cost you pay for a resource is paid up front, once, in the building of a skill into a unit, and then no further opportunity cost is generated (except maybe a small coin cost; I'm not sure if skills increase the maintenance cost of a unit).  But the benefit, from a game design perspective, of having it be a spell with a maintenance cost per turn is that you're turning a consumable mana into a consumable hit point cost every turn, so the balance of resource allocation is better.  But, if the engine doesn't support it, the engine doesn't support it.

 

How do you give a skill to a unit, other than assigning it a special ability tag?  What do you need to do to the unit definition to assign that skill?  Do these come as  trait medallion in design?

 

Thanks!

Reason for Karma (Optional)
Successfully updated karma reason!
October 25, 2013 10:55:05 AM from Elemental Forums Elemental Forums

Can you clarify the objective?  i.e what exactly are you after?  Because i'm building priest like units right now for my mod, and i'm 90% sure that what you are after is definitely possible... i'm just quite sure I get what you want to do.

For example, this is possible....

A new Unit Design ability called "Healer Priest", that you can give to a unit via the Unit Design screen (just like the other Unit Design abilities).

The Healer Priest ability can unlock a skill called "Healing", that grants a tactical healing spell that can be used to heal a friendly unit.  You can make the Healing ability cost mana to use.  Or gold, or whatever other resource you want.

If you want, you could also make the Healer Priest ability cost 1 mana to maintain, i.e. the ability will reduce your mana pool by 1 each turn.

You can create some default units called "Priest" that have this ability.

 

Reason for Karma (Optional)
Successfully updated karma reason!
October 25, 2013 2:46:31 PM from Elemental Forums Elemental Forums

Following is xml for a spell that, when cast, grants all friendly undead units a spell/ability. You could, of course, change the targeting scope or the spell/ability granted to whatever you like.

 

Spell:

Code: xml
  1. <SpellDef InternalName="NC_ExplosiveDeanimation_Spell">
  2. <DisplayName>Explosive Deanimation</DisplayName>
  3. <Description>You destabilize the magic reanimating the undead you control in the area, allowing you to trigger a violent explosion that deals their hit point potential in damage to themselves and all surrounding units.</Description>
  4. <Image>T_SoulBurning_Painting.png</Image>
  5. <IconFG>T_Berzerk_Icon.png</IconFG>
  6. <AutoUnlock>1</AutoUnlock>
  7. <SpellBookSortCategory>Unit</SpellBookSortCategory>
  8. <SpellBookSortSubCategory>UnitEnchantment</SpellBookSortSubCategory>
  9. <SpellType>Tactical</SpellType>
  10. <SpellClass>Offensive</SpellClass>
  11. <SpellSubClass>Buff</SpellSubClass>
  12. <SpellTargetType>AllFriendlyUnits</SpellTargetType>
  13. <SpellTargetCreatureType>Undead</SpellTargetCreatureType>
  14. <SpellResourceCost>
  15. <Resource>Mana</Resource>
  16. <Amount>60</Amount>
  17. </SpellResourceCost>
  18. <Prereq>
  19. <Type>AbilityBonusOption</Type>
  20. <Attribute>NecromanticCompendium</Attribute>
  21. <Target>Player</Target>
  22. </Prereq>
  23. <Prereq>
  24. <Type>AbilityBonusOption</Type>
  25. <Attribute>Necromancy1</Attribute>
  26. </Prereq>
  27. <GameModifier>
  28. <ModType>Unit</ModType>
  29. <Attribute>UnlockCombatAbility</Attribute>
  30. <StrVal>NC_ExplosiveDeanimation_Ability</StrVal>
  31. </GameModifier>
  32. <AIData AIPersonality="AI_General">
  33. <AIPriority>5</AIPriority>
  34. </AIData>
  35. <HitSoundFX>Spell_CullTheWeak_01</HitSoundFX>
  36. <SpellCastSoundFX>Spell_CullTheWeakCast_01</SpellCastSoundFX>
  37. <SpellCastEffectName>T_Erosion_Particle</SpellCastEffectName>
  38. <SpellCastEffectScale>1</SpellCastEffectScale>
  39. <SpellDefEffect>
  40. <EffectName>S_StealSpirit_Particle</EffectName>
  41. <LocalPosition>0,0,0</LocalPosition>
  42. <EffectScale>1</EffectScale>
  43. <SnapToTerrain>1</SnapToTerrain>
  44. </SpellDefEffect>
  45. </SpellDef>

 

Ability granted to units:

Code: xml
  1. <SpellDef InternalName="NC_ExplosiveDeanimation_Ability">
  2. <DisplayName>Explosive Deanimation</DisplayName>
  3. <Description>The magic reanimating this creature is unstable, allowing you to trigger a violent explosion that will deal its hit point potential in damage to itself and all surrounding units.</Description>
  4. <FormattedDescription>You can catastrophically deanimate this creature, dealing %d physical damage and %d fire damage to all surrounding units.</FormattedDescription>
  5. <IconFG>T_Berzerk_Icon.png</IconFG>
  6. <SpellBookSortCategory>Unit</SpellBookSortCategory>
  7. <SpellBookSortSubCategory>Other</SpellBookSortSubCategory>
  8. <SpellType>Tactical</SpellType>
  9. <SpellClass>Offensive</SpellClass>
  10. <SpellSubClass>UnitDamage</SpellSubClass>
  11. <SpellTargetType>EnemyUnit</SpellTargetType>
  12. <AllowFriendlyFireInRadius>1</AllowFriendlyFireInRadius>
  13. <HideInHiergamenon>1</HideInHiergamenon>
  14. <IsSpecialAbility>1</IsSpecialAbility>
  15. <IsCastable>1</IsCastable>
  16. <Radius>1</Radius>
  17. <Range>0</Range>
  18. <GameModifier>
  19. <ModType>Unit</ModType>
  20. <Attribute>DefendableDamage</Attribute>
  21. <AttackStat>UnitStat_Attack_Pierce</AttackStat>
  22. <IsForFormattedDescription>1</IsForFormattedDescription>
  23. <Calculate InternalName="Calc" ValueOwner="CastingUnit">
  24. <Expression><![CDATA[[UnitStat_HitPoints] * -0.75]]></Expression>
  25. </Calculate>
  26. <Calculate InternalName="Value">
  27. <Expression><![CDATA[[Calc]]]></Expression>
  28. </Calculate>
  29. <Calculate InternalName="ValueForFormattedDescription">
  30. <Expression><![CDATA[[Calc]]]></Expression>
  31. </Calculate>
  32. </GameModifier>
  33. <GameModifier>
  34. <ModType>Unit</ModType>
  35. <Attribute>DefendableDamage</Attribute>
  36. <AttackStat>UnitStat_Attack_Fire</AttackStat>
  37. <IsForFormattedDescription>1</IsForFormattedDescription>
  38. <Calculate InternalName="Calc" ValueOwner="CastingUnit">
  39. <Expression><![CDATA[[UnitStat_HitPoints] * -0.25]]></Expression>
  40. </Calculate>
  41. <Calculate InternalName="Value">
  42. <Expression><![CDATA[[Calc]]]></Expression>
  43. </Calculate>
  44. <Calculate InternalName="ValueForFormattedDescription">
  45. <Expression><![CDATA[[Calc]]]></Expression>
  46. </Calculate>
  47. </GameModifier>
  48. <GameModifier>
  49. <ModType>Unit</ModType>
  50. <Attribute>CurHealth</Attribute>
  51. <Calculate InternalName="Calc" ValueOwner="CastingUnit">
  52. <Expression><![CDATA[[UnitStat_HitPoints] * -1]]></Expression>
  53. </Calculate>
  54. <Calculate InternalName="Value">
  55. <Expression><![CDATA[[Calc]]]></Expression>
  56. </Calculate>
  57. <ApplyToCaster>1</ApplyToCaster>
  58. <ApplyToSpellRadiusCenterOnly>1</ApplyToSpellRadiusCenterOnly>
  59. </GameModifier>
  60. <AIData AIPersonality="AI_General">
  61. <AIPriority>5</AIPriority>
  62. </AIData>
  63. <HitSoundFX>Spell_Sunder_01</HitSoundFX>
  64. <SpellDefEffect>
  65. <EffectName>E_FireballExplosion_Particle</EffectName>
  66. <LocalPosition>0,0,0</LocalPosition>
  67. <EffectScale>3</EffectScale>
  68. <EffectDelay>0</EffectDelay>
  69. <SnapToTerrain>1</SnapToTerrain>
  70. </SpellDefEffect>
  71. </SpellDef>
Reason for Karma (Optional)
Successfully updated karma reason!
October 25, 2013 7:35:24 PM from Elemental Forums Elemental Forums

Thanks for the replies.

 

Sounds like you're very close to what I want to do, abob.  The only thing two things I'd change it that the Unit Design ability costs 1 mana per unit, so a squad would cost 4, and a company 6, mana per turn.  Encourages smaller, weaker healers.  I'd also have a block that says you can't have armor or cutting weapons on the unit (ie, clubs only).

Dhuran, could you explain how you're posting xml in window?  I can't figure that out.  Thanks!


Chris

Reason for Karma (Optional)
Successfully updated karma reason!
October 25, 2013 7:48:12 PM from Elemental Forums Elemental Forums

code="xml"

Code here.

/code

 

With the two tags enclosed in square brackets. Or the insert code button just to the left of the smiley icon adds the tags automatically.

Reason for Karma (Optional)
Successfully updated karma reason!
April 1, 2014 6:10:56 PM from Elemental Forums Elemental Forums

One of my personal disappointments with FE/LH is that a priest like normal unit never made it into the game.  There is, to my knowledge, no way for a regular unit to gain the ability to heal another unit.  There are spells that confer that ability onto a champion, but not a regular unit. 

I am not a modder.

Before I start learning how to do this, I wanted to know if such a thing was even theoretically possible, or if there were tags that prevented a regular unit from ever having a spell cast upon them that confers a spell (the heal one in particular).

 

Possible. See A_LHLIB_CanCast

 

 

 

_________________________

LH Mods by Primal

XtraDeconstruct

XtraDeconstruct Canons

Reason for Karma (Optional)
Successfully updated karma reason!
April 1, 2014 6:16:40 PM from Galactic Civilizations III Forums Galactic Civilizations III Forums

Quoting Primal_Savage,


One of my personal disappointments with FE/LH is that a priest like normal unit never made it into the game.  There is, to my knowledge, no way for a regular unit to gain the ability to heal another unit.  There are spells that confer that ability onto a champion, but not a regular unit. 

I am not a modder.

Before I start learning how to do this, I wanted to know if such a thing was even theoretically possible, or if there were tags that prevented a regular unit from ever having a spell cast upon them that confers a spell (the heal one in particular).

 

Possible. See A_LHLIB_CanCast

Did you check the date on this post?

Reason for Karma (Optional)
Successfully updated karma reason!
April 1, 2014 6:22:59 PM from Elemental Forums Elemental Forums


EDIT: Heh, Ok. Seems you missed the fact that one is activated through Spells and the other through Skills. For those interested in TrainedUnits Spells, use link in post #19 [Link removed]. Keywords: CanCastSpells, Strategic, Tactical, Spells, Not Skills.

 

 


I sure did! 

 

It's just in case someone finds this thread through Google and then believes it's not possible...

 

 

_________________________

LH Mods by Primal

XtraDeconstruct

XtraDeconstruct Canons

Reason for Karma (Optional)
Successfully updated karma reason!
April 1, 2014 6:27:39 PM from Galactic Civilizations III Forums Galactic Civilizations III Forums

If they read the second post they would see it's possible
Have fun bringing threads from the dead...  

Reason for Karma (Optional)
Successfully updated karma reason!
Stardock Forums v1.0.0.0    #101114  walnut1   Server Load Time: 00:00:00.0002547   Page Render Time: