Help Applying AppliesRandomModifier to only some GameModifier Effects?

Making a lot of progress with this spell, SO close to figuring it out!

I'm trying to create a Strategic spell that (1) randomly transforms a friendly shard into either a Fire Shard or a Death Shard AND (2) cannot be used more than once on the same shard.

I've gotten (1) to work as an independent spell, by using <AppliesRandomModifier> to choose between two separate <GameModifier> tags.  

I've gotten (2) to work as an independent spell, thanks to Heavenfall's really clever solution, bless his heart:  Make the spell also change the terrain type beneath the shard, and restrict the spell from being cast on that terrain type.  This, too, works perfectly---the spell can change the terrain type while changing the shard, and doing so prevents the spell from working again on the same shard.

Problem: Getting (1) and (2) to work together in the same spell.  

If I simply add the terrain-changing effect from (2) into (1) as a third <GameModifier>, it becomes affected by <AppliesRandomModifier> along with the two Shard-change options.   (So, instead of a 50/50 chance to create a Fire/Death shard, with a 100% chance to change the terrain, I get a 33/33/33 split between creating a fire shard, creating a death shard, or changing the terrain.)

So, I'm looking for a way to restrict the scope of <AppliesRandomModifier> to the two shard-changing effects, and ensure the spell always applies the terrain-change effect.

Right now, I'm trying to solve this by breaking (1) and (2) into two independent "Sub-Spells", then having the main spell cast both of them via the UseSpell attribute.  Unfortunately, this doesn't work:  When I cast the spell, nothing happens but for the particle effect.

Here are the three spells:

Main Spell:

Code: xml
  1. &lt;SpellDef InternalName="PromiseOfAsshai"&gt;
  2.     &lt;DisplayName&gt;Promise of Asshai&lt;/DisplayName&gt;
  3.     &lt;Description&gt;Channel the essence of Asshai into the land of Elemental, randomly transforming a shard in your empire into a Fire shard or a Death shard.&lt;/Description&gt;
  4.     &lt;Image&gt;S_PromiseOfAsshai_Painting.png&lt;/Image&gt;
  5.     &lt;IconFG&gt;S_PromiseOfAsshai_Icon.png&lt;/IconFG&gt;
  6.     &lt;AutoUnlock&gt;1&lt;/AutoUnlock&gt;
  7.     &lt;SpellType&gt;Strategic&lt;/SpellType&gt;
  8.     &lt;SpellClass&gt;Other&lt;/SpellClass&gt;
  9.     &lt;SpellSubClass&gt;Other&lt;/SpellSubClass&gt;
  10.     &lt;SpellTargetType&gt;RegularShard&lt;/SpellTargetType&gt;
  11.     &lt;SpellBookSortCategory&gt;World&lt;/SpellBookSortCategory&gt;
  12.     &lt;SpellBookSortSubCategory&gt;Other&lt;/SpellBookSortSubCategory&gt;
  13.     &lt;SpellTargetZOCType&gt;Friendly&lt;/SpellTargetZOCType&gt;
  14.     &lt;Prereq&gt;
  15.         &lt;Type&gt;UnitStat&lt;/Type&gt;
  16.         &lt;Attribute&gt;Spell_PromiseOfAsshai&lt;/Attribute&gt;
  17.         &lt;Value&gt;1&lt;/Value&gt;
  18.     &lt;/Prereq&gt;
  19.     &lt;GameModifier&gt;
  20.         &lt;ModType&gt;Unit&lt;/ModType&gt;
  21.         &lt;Attribute&gt;UseSpell&lt;/Attribute&gt;
  22.         &lt;StrVal&gt;PromiseOfAsshai_ShardChange&lt;/StrVal&gt;
  23.         &lt;Provides&gt;Channel the essence of Asshai into the land of Elemental, randomly transforming a shard in your empire into a Fire shard or a Death shard.&lt;/Provides&gt;
  24.     &lt;/GameModifier&gt;
  25.     &lt;GameModifier&gt;
  26.         &lt;ModType&gt;Unit&lt;/ModType&gt;
  27.         &lt;Attribute&gt;UseSpell&lt;/Attribute&gt;
  28.         &lt;StrVal&gt;PromiseOfAsshai_AshenLand&lt;/StrVal&gt;
  29.         &lt;Provides&gt;Channel the essence of Asshai into the land of Elemental, randomly transforming a shard in your empire into a Fire shard or a Death shard.&lt;/Provides&gt;
  30.     &lt;/GameModifier&gt;
  31.     &lt;SpellResourceCost&gt;
  32.         &lt;Resource&gt;Mana&lt;/Resource&gt;
  33.         &lt;Amount&gt;50&lt;/Amount&gt;
  34.     &lt;/SpellResourceCost&gt;
  35.         &lt;!-- Not sure if "BarredTerrain" works here, but I&#39;d already done it this way when I saw that tag even existed, so... yeah. --&gt;
  36.     &lt;ValidTerrainType&gt;Land&lt;/ValidTerrainType&gt;
  37.     &lt;ValidTerrainType&gt;Rugged_Land&lt;/ValidTerrainType&gt;
  38.     &lt;ValidTerrainType&gt;Fertile_Land&lt;/ValidTerrainType&gt;
  39.     &lt;ValidTerrainType&gt;Chasm&lt;/ValidTerrainType&gt;
  40.     &lt;ValidTerrainType&gt;ChasmEdge&lt;/ValidTerrainType&gt;
  41.     &lt;ValidTerrainType&gt;DesertTerrain&lt;/ValidTerrainType&gt;
  42.     &lt;ValidTerrainType&gt;HillsTerrain&lt;/ValidTerrainType&gt;
  43.     &lt;ValidTerrainType&gt;SwampTerrain&lt;/ValidTerrainType&gt;
  44.     &lt;ValidTerrainType&gt;ArcticTerrain&lt;/ValidTerrainType&gt;
  45.     &lt;ValidTerrainType&gt;MountainRange&lt;/ValidTerrainType&gt;
  46.     &lt;ValidTerrainType&gt;MountainSide&lt;/ValidTerrainType&gt;
  47.     &lt;ValidTerrainType&gt;Forest&lt;/ValidTerrainType&gt;
  48.     &lt;ValidTerrainType&gt;Beach&lt;/ValidTerrainType&gt;
  49.     &lt;ValidTerrainType&gt;Cliff&lt;/ValidTerrainType&gt;
  50.     &lt;ValidTerrainType&gt;River&lt;/ValidTerrainType&gt;
  51.     &lt;ValidTerrainType&gt;City&lt;/ValidTerrainType&gt;
  52.     &lt;ValidTerrainType&gt;Submerged&lt;/ValidTerrainType&gt;
  53.     &lt;ValidTerrainType&gt;BurningLands&lt;/ValidTerrainType&gt;
  54.     &lt;ValidTerrainType&gt;Fissure&lt;/ValidTerrainType&gt;
  55.     &lt;ValidTerrainType&gt;CurgensTomb&lt;/ValidTerrainType&gt;
  56.     &lt;ValidTerrainType&gt;Imperium&lt;/ValidTerrainType&gt;
  57.     &lt;ValidTerrainType&gt;Scrapyard&lt;/ValidTerrainType&gt;
  58.     &lt;ValidTerrainType&gt;CaveWall&lt;/ValidTerrainType&gt;
  59.     &lt;ValidTerrainType&gt;Unknown&lt;/ValidTerrainType&gt;
  60.     &lt;ValidTerrainType&gt;Tomb&lt;/ValidTerrainType&gt;
  61.     &lt;AIData AIPersonality="AI_General"&gt;
  62.         &lt;AIPriority&gt;5&lt;/AIPriority&gt;
  63.     &lt;/AIData&gt;
  64.     &lt;HitSoundFX&gt;Spell_Consume_01&lt;/HitSoundFX&gt;
  65.     &lt;SpellDefEffect&gt;
  66.         &lt;EffectName&gt;S_Corruption_Particle&lt;/EffectName&gt;
  67.         &lt;LocalPosition&gt;0,0,0&lt;/LocalPosition&gt;
  68.         &lt;EffectScale&gt;2&lt;/EffectScale&gt;
  69.         &lt;EffectDelay&gt;0&lt;/EffectDelay&gt;
  70.         &lt;SnapToTerrain&gt;1&lt;/SnapToTerrain&gt;
  71.     &lt;/SpellDefEffect&gt;
  72. &lt;/SpellDef&gt;

"Sub-Spell" (1), Changing the Shard:

Code: xml
  1. &lt;SpellDef InternalName="PromiseOfAsshai_ShardChange"&gt;
  2.     &lt;DisplayName&gt;Promise of Asshai&lt;/DisplayName&gt;
  3.     &lt;Description&gt;Channel the essence of Asshai into the land of Elemental, randomly transforming a shard in your empire into a Fire shard or a Death shard.&lt;/Description&gt;
  4.     &lt;Image&gt;S_PromiseOfAsshai_Painting.png&lt;/Image&gt;
  5.     &lt;IconFG&gt;S_PromiseOfAsshai_Icon.png&lt;/IconFG&gt;
  6.     &lt;SpellType&gt;Strategic&lt;/SpellType&gt;
  7.     &lt;CanStack&gt;0&lt;/CanStack&gt;
  8.     &lt;HideInHiergamenon&gt;1&lt;/HideInHiergamenon&gt;
  9.     &lt;SpellClass&gt;Other&lt;/SpellClass&gt;
  10.     &lt;SpellSubClass&gt;Other&lt;/SpellSubClass&gt;
  11.     &lt;SpellTargetType&gt;RegularShard&lt;/SpellTargetType&gt;
  12.     &lt;SpellTargetZOCType&gt;Friendly&lt;/SpellTargetZOCType&gt;
  13.     &lt;IsCastable&gt;0&lt;/IsCastable&gt;
  14.     &lt;Prereq&gt;
  15.         &lt;Type&gt;AbilityBonusOption&lt;/Type&gt;
  16.         &lt;Attribute&gt;Unknowable&lt;/Attribute&gt;
  17.     &lt;/Prereq&gt;
  18.     &lt;AppliesRandomModifier&gt;1&lt;/AppliesRandomModifier&gt;
  19.     &lt;GameModifier&gt;
  20.         &lt;ModType&gt;Map&lt;/ModType&gt;
  21.         &lt;Attribute&gt;ChangeShardType&lt;/Attribute&gt;
  22.         &lt;StrVal&gt;DeathShard&lt;/StrVal&gt;
  23.     &lt;/GameModifier&gt;
  24.     &lt;GameModifier&gt;
  25.         &lt;ModType&gt;Map&lt;/ModType&gt;
  26.         &lt;Attribute&gt;ChangeShardType&lt;/Attribute&gt;
  27.         &lt;StrVal&gt;FireShard&lt;/StrVal&gt;
  28.     &lt;/GameModifier&gt;
  29.     &lt;AIData AIPersonality="AI_General"&gt;
  30.         &lt;AIPriority&gt;5&lt;/AIPriority&gt;
  31.     &lt;/AIData&gt;
  32.     &lt;SpellDefEffect&gt;
  33.         &lt;EffectName&gt;S_Corruption_Particle&lt;/EffectName&gt;
  34.         &lt;LocalPosition&gt;0,0,0&lt;/LocalPosition&gt;
  35.         &lt;EffectScale&gt;2&lt;/EffectScale&gt;
  36.         &lt;EffectDelay&gt;0&lt;/EffectDelay&gt;
  37.     &lt;SnapToTerrain&gt;1&lt;/SnapToTerrain&gt;
  38.     &lt;/SpellDefEffect&gt;
  39. &lt;/SpellDef&gt;

"Sub-Spell" (2), Changing the Terrain:

Code: xml
  1. &lt;SpellDef InternalName="PromiseOfAsshai_AshenLand"&gt;
  2.     &lt;DisplayName&gt;Promise of Asshai&lt;/DisplayName&gt;
  3.     &lt;Description&gt;Channel the essence of Asshai into the land of Elemental, randomly transforming a shard in your empire into a Fire shard or a Death shard.&lt;/Description&gt;
  4.     &lt;Image&gt;S_PromiseOfAsshai_Painting.png&lt;/Image&gt;
  5.     &lt;IconFG&gt;S_PromiseOfAsshai_Icon.png&lt;/IconFG&gt;
  6.     &lt;SpellType&gt;Strategic&lt;/SpellType&gt;
  7.     &lt;CanStack&gt;0&lt;/CanStack&gt;
  8.     &lt;HideInHiergamenon&gt;1&lt;/HideInHiergamenon&gt;
  9.     &lt;SpellClass&gt;Other&lt;/SpellClass&gt;
  10.     &lt;SpellSubClass&gt;Other&lt;/SpellSubClass&gt;
  11.     &lt;SpellTargetType&gt;RegularShard&lt;/SpellTargetType&gt;
  12.     &lt;SpellTargetZOCType&gt;Friendly&lt;/SpellTargetZOCType&gt;
  13.     &lt;IsCastable&gt;0&lt;/IsCastable&gt;
  14.     &lt;Prereq&gt;
  15.         &lt;Type&gt;AbilityBonusOption&lt;/Type&gt;
  16.         &lt;Attribute&gt;Unknowable&lt;/Attribute&gt;
  17.     &lt;/Prereq&gt;
  18.     &lt;GameModifier&gt;
  19.         &lt;ModType&gt;Map&lt;/ModType&gt;
  20.         &lt;Attribute&gt;PlaceTerrain&lt;/Attribute&gt;
  21.         &lt;TerrainType&gt;AshenLand&lt;/TerrainType&gt;
  22.     &lt;/GameModifier&gt;
  23.     &lt;AIData AIPersonality="AI_General"&gt;
  24.         &lt;AIPriority&gt;5&lt;/AIPriority&gt;
  25.     &lt;/AIData&gt;
  26.     &lt;SpellDefEffect&gt;
  27.         &lt;EffectName&gt;S_Corruption_Particle&lt;/EffectName&gt;
  28.         &lt;LocalPosition&gt;0,0,0&lt;/LocalPosition&gt;
  29.         &lt;EffectScale&gt;2&lt;/EffectScale&gt;
  30.         &lt;EffectDelay&gt;0&lt;/EffectDelay&gt;
  31.         &lt;SnapToTerrain&gt;1&lt;/SnapToTerrain&gt;
  32.     &lt;/SpellDefEffect&gt;
  33. &lt;/SpellDef&gt;

I suspect this has something to do with "UseSpell" not being intended for use in this manner (it only appeared on consumable items).  But I couldn't find any other attributes that could call another spell outside of tactical combat.

Anyone know how I could pull this off?  It's the final piece of the puzzle!

25,924 views 4 replies
Reply #2 Top

Quoting Primal_Savage, reply 1

Hi Eunomiac. Welcome to the Modding forum!

Thank you!  I just discovered this forum today, after wandering around the FE Modding forum and wondering why it was so quiet in there ;)

Your solution works far better than anything I've tried, but it introduces a new hiccup:  The goodie hut it places needs to be walked over before it becomes the Death/Fire shard.  Is there any way to make a Goodie Hut automatically "pop" on generation?

(And it's gotta be said, your solution---as have many of the solutions to my various problems presented by the fine folk 'round these parts---blew my mind a bit, not gonna lie.  Goodie Huts!  Never would have thought of that :) )

Thanks again, and if you've got an idea for auto-popping that goodie hut, you'll be my hero of the week!

Reply #4 Top

Works PERFECTLY!  Even better than I'd hoped---the <TileDesign> tag for the Goodie Hut lasts a turn or so, which is just enough time to create a nifty temporary effect to represent the shard waffling between light and shadow before "choosing" when the Goodie Hut auto-pops.

As promised, you are my    !!!HERO OF THE WEEK!!!   

Perks include being granted my personal    SEAL OF APPROVAL   *

* receipt of aforementioned SEAL OF APPROVAL subject to and dependent upon grantor's successful navigation of the complex web of laws and international treaties governing cross-border shipping of large aquatic mammals