Newbie Question: Granting Strategic Spells via Equipped Weapon?

Alas, it stubbornly insists on not working.

By on March 14, 2014 6:48:42 PM from Elemental Forums Elemental Forums

Eunomiac

Join Date 09/2008
+3

I'm trying to create a staff that, for as long as it remains equipped, gives the sovereign/champion access to the Corruption spell (turn a shard into a Death shard).  I've had no problem getting combat spells to work, but no matter what I try, I can't get Corruption to show up outside of tactical combat.  (I did manage to have it appear within combat, but that's not entirely useful.)

Here's the staff:

Code: xml
  1. <GameItemType InternalName="Staff_Soulwrack">
  2. <DisplayName>Soulwrack Staff</DisplayName>
  3. <Description>The Soulwrack Staff is not merely a symbol of the High Priest's office:  It is a conduit to his dying homeland.  Reaching across the infinite nothing of the Fractured Deep, it writhes with the corrupt magics of Hex---and it bequeaths upon its wielder the ability to channel the Void in the land of Elemental.</Description>
  4. <Type>Weapon</Type>
  5. <Type>Defense</Type>
  6. <WeaponType>Spear</WeaponType>
  7. <WeaponUpgradeType>Staff</WeaponUpgradeType>
  8. <CanBeEquipped>1</CanBeEquipped>
  9. <CustomizationPointCost>2</CustomizationPointCost>
  10. <ShopValue>390</ShopValue>
  11. <GameModifier>
  12. <ModType>Unit</ModType>
  13. <Attribute>AdjustUnitStat</Attribute>
  14. <StrVal>UnitStat_Attack_Pierce</StrVal>
  15. <Value>4</Value>
  16. </GameModifier>
  17. <GameModifier>
  18. <ModType>Unit</ModType>
  19. <Attribute>AdjustUnitStat</Attribute>
  20. <StrVal>UnitStat_ChanceToCrit</StrVal>
  21. <Value>-1</Value>
  22. </GameModifier>
  23. <GameModifier>
  24. <ModType>Unit</ModType>
  25. <Attribute>AdjustUnitStat</Attribute>
  26. <StrVal>UnitStat_SpellDamage</StrVal>
  27. <Value>25</Value>
  28. <Provides>+25% Spell Damage</Provides>
  29. </GameModifier>
  30. <GameModifier>
  31. <ModType>Unit</ModType>
  32. <Attribute>UnlockUnitAbility</Attribute>
  33. <StrVal>Spell_ExNihilo</StrVal>
  34. <Provides>Unlocks Ex Nihilo, a spell that can convert any shard under your control into a Death shard.</Provides>
  35. </GameModifier>
  36. <GameModifier>
  37. <ModType>Unit</ModType>
  38. <Attribute>UnlockCombatAbility</Attribute>
  39. <StrVal>ShadowsReach</StrVal>
  40. <Provides>Unlocks Shadow's Reach, a spell that causes all negative spells on a unit to spread to each of its allies.</Provides>
  41. </GameModifier>
  42. <IsAvailableForSovereignCustomization>1</IsAvailableForSovereignCustomization>
  43. <RarityDisplay>Unique</RarityDisplay>
  44. <HeroOnly>1</HeroOnly>
  45. <IsAvailableForUnitDesign>0</IsAvailableForUnitDesign>
  46. <AIData AIPersonality="AI_General">
  47. <AIPrefType>AIPrefType_BLUNT</AIPrefType>
  48. <AIPriority>79</AIPriority>
  49. </AIData>
  50. <ArtDef>Staff_Spell_ArtDef</ArtDef>
  51. <GameItemTypeArtDef InternalName="Staff_Spell_ArtDef">
  52. (art def stuff)
  53. </GameItemTypeArtDef>
  54. </GameItemType>

 

Shadow's Reach works fine; Ex Nihilo is the problem.  I originally had it set up like Shadow's Reach (as a combat ability), but that only made it available in combat.  After poking around the game's XML files, I followed the template for Spell_ObsessionAbility (in CoreAbilities.xml), and tried to make the staff grant an ability, which in turn granted access to the spell:

 

Code: xml
  1. <AbilityBonus InternalName="Spell_ExNihiloAbility">
  2. <AbilityBonusOption InternalName="Spell_ExNihilo">
  3. <DisplayName>Ex Nihilo</DisplayName>
  4. <Description>Unlocks Ex Nihilo, a spell that can convert any shard under your control into a Death shard.</Description>
  5. <Icon>S_ExNihilo_Icon.png</Icon>
  6. <GameModifier>
  7. <Provides>Darken a shard in your empire with the long shadow of Hex, destroying all that it was until only the empty void of a Death shard remains.</Provides>
  8. </GameModifier>
  9. <IsCombatAbility>1</IsCombatAbility>
  10. <AIData AIPersonality="AI_General">
  11. <AIPriority>5</AIPriority>
  12. </AIData>
  13. </AbilityBonusOption>
  14. </AbilityBonus>

 

... and then the spell itself:

 

Code: xml
  1. <SpellDef InternalName="ExNihilo">
  2. <DisplayName>Ex Nihilo</DisplayName>
  3. <Description>Darken a shard in your empire with the long shadow of Hex, destroying all that it was until only the empty void of a Death shard remains.</Description>
  4. <Image>S_ExNihilo_Painting.png</Image>
  5. <IconFG>S_ExNihilo_Icon.png</IconFG>
  6. <AutoUnlock>1</AutoUnlock>
  7. <SpellBookSortCategory>World</SpellBookSortCategory>
  8. <SpellBookSortSubCategory>Other</SpellBookSortSubCategory>
  9. <SpellType>Strategic</SpellType>
  10. <SpellClass>Other</SpellClass>
  11. <SpellSubClass>Other</SpellSubClass>
  12. <SpellTargetType>RegularShard</SpellTargetType>
  13. <SpellTargetZOCType>Friendly</SpellTargetZOCType>
  14. <Prereq>
  15. <Type>AbilityBonusOption</Type>
  16. <Attribute>Spell_ExNihilo</Attribute>
  17. </Prereq>
  18. <SpellResourceCost>
  19. <Resource>Mana</Resource>
  20. <Amount>50</Amount>
  21. </SpellResourceCost>
  22. <GameModifier>
  23. <ModType>Map</ModType>
  24. <Attribute>ChangeShardType</Attribute>
  25. <StrVal>DeathShard</StrVal>
  26. </GameModifier>
  27. <AIData AIPersonality="AI_General">
  28. <AIPriority>5</AIPriority>
  29. </AIData>
  30. <HitSoundFX>Spell_Consume_01</HitSoundFX>
  31. <SpellDefEffect>
  32. <EffectName>S_Corruption_Particle</EffectName>
  33. <LocalPosition>0,0,0</LocalPosition>
  34. <EffectScale>2</EffectScale>
  35. <EffectDelay>0</EffectDelay>
  36. <SnapToTerrain>1</SnapToTerrain>
  37. </SpellDefEffect>
  38. </SpellDef>

 

It occurs to me that this might not be doable, considering there's little use for it (I mean, for strategic spells, you could always just equip the weapon, cast the spell, then tuck it away somewhere).  But I'm hoping it's possible, as I'm going for a thematic effect here more than anything.

 

Any help/insights you can offer are much appreciated, and I apologize in advance if I've made some obvious typo that explains everything---I've been tinkering and experimenting with this all afternoon to no avail, and this is only my most recent attempt!

Locked Post 7 Replies
Search this post
Subscription Options


Reason for Karma (Optional)
Successfully updated karma reason!
March 17, 2014 4:53:56 AM from Elemental Forums Elemental Forums

I would try taking out both the AutoUnlock and the Prereq from the ExNihilo spell XML.

Reason for Karma (Optional)
Successfully updated karma reason!
March 17, 2014 8:31:10 AM from Elemental Forums Elemental Forums

I haven't tried it but looking at that code I think it would probably work.

But you might need to modify the AbilityBonusOption "Spell_ExNihilo".... make it a spellbook type ability, i.e. add <AbilityBonusType>Unit_Spell_Rank</AbilityBonusType> to it.  

Take a look at an ability like Hydromancy to see what I mean.  I think that without the spellbook thing the spell prereq might not work.

 

 

Reason for Karma (Optional)
Successfully updated karma reason!
March 18, 2014 4:37:49 PM from Elemental Forums Elemental Forums

Alas, I tried both of your suggestions, and neither worked.  I also re-templated the spell off of Hydromancy, which gave me a few lines to add (e.g. "<Type>Spell</Type>"), but nothing worked.

If I add "<SelectedAbilityBonusOption>Spell_ExNihilo</SelectedAbilityBonusOption>" directly to the Sovereign, it works perfectly---spell appears in the spellbook and everything.  But trying to make an equipped weapon add the ability doesn't seem to work.

Hydromancy was a great thing to point me towards, since it's closest to what I want to do; can you think of any other examples that might be helpful?  Items (or anything) that provide out-of-combat abilities, whether in standard FE or in other mods?

And, if I can't get this to work directly, can you think of any clever work-arounds I could try?  Perhaps using hidden resources, maybe triggering spells that add/remove the ability when the item is equipped/de-equipped, something like that?

 

Reason for Karma (Optional)
Successfully updated karma reason!
March 19, 2014 9:08:08 AM from Elemental Forums Elemental Forums

Ok I think it's pretty much not possible.  This just happens to be one of those things that FE/LH doesn't allow for.  Obviously you can do this for a tactical spell, but not so for a strategic spell.

I don't actually think that UnlockUnitAbility works.  It certainly doesn't appear to work for an item.  I had a look at the Boots of Stealth which use this (they're supposed to grant the wearer the MasterScount ability) and I'm fairly sure that it actually doesn't work.  You could probably log a bug report for that if you want but given it's about the only item that uses UnlockUnitAbility it's probably not about to be fixed in a hurry.  Still doesn't hurt to try.

You can grant an ability via a spell, but that doesn't really help you.  

You can have an item that is a one-use item grant you an ability, eg. like the Tomes grant Spell abilities see Tome of the Wind.  But that's nto quite what you want.  Even if you have a spell that grants an ability (or an item).... it is also very difficult/impossible to remove the ability.

You could make it so that your custom Corruption spell requires a special resource.... but the problem there is that to the best of my knowledge an item can not produce a resource..... an ability can, but then we're back to the same problem.  So not really a solution there.

 

There is one thing that I think would work... but it would kinda suck.  I'm fairly certain that you can set a minimum required UnitStat to be able to cast a spell.  So what yo do is create a new UnitStat called UnitStat_StaffObession or whatever, then have the staff grant +1 to that UnitStat..... then you have your spell require the unitstat using <RequiredStat>UnitStat_StaffObession , 1</RequiredStat> in a SpellDef.

I think that would work, but even if it does it has 2 issues:

1) The spell would have to be Autounlocked for everyone, so you'd always see it in the spellbook... just greyed out until you equip the staff.

2) If you want this to apply correctly for your Sov, you have to change <IsSovereignExemptFromSpellStatReqs> to 0 (default is 1) in ElementalDefs.xml.... though you can probably do that with a file in your mod folder.

 

Depending on what you are trying to do there might be alternatives that would work easier/better.  Where is the staff in question coming from.... do you plan on making it a random loot drop.... or something that is granted via a quest?    Could you give out something like a Corruption Scroll instead... that when used grants the champion an ability that unlocks a Corruption spell?  If you're giving the staff out via a quest you could just unlock the Corruption spell directly instead.

 

Hopefully something in that helps.  But yeah, unfortunately sometimes with modding FE/LH even though an idea might not be possible so you need to go for a similar idea instead.  There's a lot of things that you can't do with modding, but there certainly is a lot of things you can do also.

Let us know how it goes.

 


Reason for Karma (Optional)
Successfully updated karma reason!
March 19, 2014 9:55:01 AM from Elemental Forums Elemental Forums

Eunomiac wrote:

I'm trying to create a staff that, for as long as it remains equipped, gives the sovereign/champion access to the Corruption spell...

Later, abob101 wrote:

I don't actually think that UnlockUnitAbility works.  It certainly doesn't appear to work for an item.

[/quote]

Check out "Relinquary_Skystrike" in Heavenfall's Children of Storm mod.  It's a bow that's supposed to grant the ability to strategically fire arrows at a target in your territory.  I've never actually found it in-game, but it sounds like what you guys are looking for.

[quote who="abob101" reply="4" id="3450039"] I had a look at the Boots of Stealth which use this (they're supposed to grant the wearer the MasterScount ability) and I'm fairly sure that it actually doesn't work.  You could probably log a bug report for that if you want but given it's about the only item that uses UnlockUnitAbility it's probably not about to be fixed in a hurry.  Still doesn't hurt to try.

Derek Paxton previously indicated in this thread:

http://forums.elementalgame.com/449976/page/1/#3440649

...that there was some internal coding magic for that item/ability, so it may not be the best example.

 

Edit: ugh...nested quote hell I give up.

 

Reason for Karma (Optional)
Successfully updated karma reason!
March 19, 2014 10:19:59 AM from Elemental Forums Elemental Forums

Quoting Crastiloowa,
Derek Paxton previously indicated in this thread:

http://forums.elementalgame.com/449976/page/1/#3440649

...that there was some internal coding magic for that item/ability, so it may not be the best example.

Wow good memory you have there.... and good spot too.  So yeah it ain't going to work that way, but wait...........

 

Quoting Crastiloowa,
Check out "Relinquary_Skystrike" in Heavenfall's Children of Storm mod.  It's a bow that's supposed to grant the ability to strategically fire arrows at a target in your territory.  I've never actually found it in-game, but it sounds like what you guys are looking for.

Aha!   I think he's onto something here, I was very skeptical but i've just done a bit of a test and it seem to me that this does indeed work.  The key seems to be this bit of magic:


<Prereq>
   <Type>UnitStat</Type>
   <Attribute>Reliquary_Skystrike</Attribute>
   <Value>1</Value>
</Prereq>

Where HF comes up with this stuff I'll never know.  Try that Eunomiac, should work by the looks.... let us know if it works for you.

 

Well done Crastiloowa and HF.

 

Reason for Karma (Optional)
Successfully updated karma reason!
March 19, 2014 4:50:16 PM from Elemental Forums Elemental Forums

Wow, worked like a charm --- ability only shows up when the staff is equipped, and disappears from the spellbook when the staff isn't.  Excellent!  Thanks all (and HF, whose XML I've added to my "Resources/Are You A Wizard" folder, and will be pouring over for nifty tricks whenever I hit a wall).

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