[Modmod] Magic for Fun and Profit!

Onionsoilder

Reaver
Joined
Mar 19, 2007
Messages
3,173
I've been toying around with a few ideas over the past couple weeks, and I finally compiled them into a modmod. It's not very large at this point, and I would like to add more later, but I figured I could release what I have for now and see what people think about it. I haven't tested a full game so a few bugs might pop up, but I have tested each component individually and they all worked fine.

Changes:
• Additional Tier III Spells(Original Tier III still exist)
- Nature III: Summon Guardian Vines
- Body III: Augmentation(Adds Strong to the caster)
- Metamagic III: Spellshield(Adds Spellshield promotion to the stack; functions like Magic Resistance)
- Air III: Flight(Adds Flying to the caster)
- Shadow III: Shadowcloak(Adds Hidden to the caster)

• Ring of Fire damage changed to 15%/30% Cap
• Tsunami damage changed to 20%/40% Cap
• Blinding Light changed to -1 Visibility instead of Bind for 2 turns.
• Slow changed to +1 Terrain Movement Cost instead of -1 Movement.
• 5 new artifacts can be found in dungeons:
- Tome of Alsophocus: A tome of dark magic that should probably be burned, but that doesn't stop people for using it for their own gain.
- Crown of the Martyr: A crown of thorns that functions like an anti-War
- Lifesapper: A dagger that weakens the unit using it, but adds Canabalize-esque health recovery.
- Preserver: the Regeneration spell in amulet form.
- Seven League Boots: Increases movement speed of the wearer.

• Mercenary Overhaul
- Mercenaries can now be hired in any city with an Auxiliary Barracks.
- The Guild of the Nine provides a free Auxiliary Barracks in every city.
- All mercenaries start with Combat I and Drill I
- 4 types of mercenaries:
- Mercenary; Powerful Axeman, available from start.
- Mounted Mercenary: Powerful Horse Archer, available with Stirrups.
- Rogue: Powerful Assassin, available with Poisons.
- Spellsword: Powerful Adept, available with KotE.

• Miracles of Esus
- Nations following the Council of Esus can pay gold for miracles:
- Sway the Odds: Increases strength and adds 2 First Strikes for a single combat.
- Flee the Scene: Adds 2 extra movement but reduces strength.
- Recovery: Removes Plagued, Diseased and Withered akin to Priest's Cure, adds Regeneration.
- Shadowscry: Increases the power of a mage's next spell.
- Corruption: Removes non-Esus religions from a city; available at Fanaticism.

Plans for the future:
Add an additional Tier III spell for all spheres, excluding Death(which already has one)
Additional magic balancing/tweaks.
Add more artifacts, including some gained from events instead of dungeons.
Add a Griffon Rider unit(need model)
Turn Lucian into a Great Commander.
Add a second tier of mercenaries exclusive to the owner of the Guild of the Nine.
Find a way to make Nox Noctis' invisibility exclusive to CoE nations without altering the SDK.


Download
Installation: Extract the .zip to you Fall from Heaven 2 folder. You might want to make a backup or copy first.
 
Well, if you are interested in some ideas, here are some spells I add for my personal modmod :D

Code:
[B]Order Highpriest : Become Patriarch[/B]
	* Highest LVL Order Highpriest
	* PROMOTION_PATRIARCH
		> +2 Holy
		> Immune to Capture
		> Enable : [B]Call Holy War[/B] (spell)
				o peace amongst all-Order nations
				o war between all-Order nations with current caster-owner's enemies
				o kills the patriarch
	* Modification from FFH 0.23 
	
[B]Empyrean Highpriest : Tower of Sun[/B] 
	* +25% science, +25% culture
	* +2xp per units created in the city.
	* Pass PROMOTION_ENLIGHTED
		* +1 XP per turn
		* 100% expire (thus units have to be in city to get Enlighted)
	* Building req caster (thus "Settling the Highpriest")
	* Graphic : Tower of Wisdom
[B]
Kilmorph Highpriest : Bounty of Kilmorph[/B]
	* Transmute Gold <--> Copper when casted in Gold/Copper
	* +1% per caster level chance to discover resources when casted in hills without bonus.
	* +1% per Earth Mana chance to discover resources when casted in hills without bonus.
	* Minimum discovery chance per cast : 10%
	* Maximum discovery chance per cast : 90%
[B]
Leaves Highpriest : Forest Fury[/B]
	* Require : standing in Forest/Ancient Forest
	* Range : 2
	* 20-80% poison damage for units in range+standing in Forest/Ancient Forest tile
	* 20% chance to poison units.
	* 10% chance to created Treants (duration : 1) in Forest/Ancient Forest in range. 
[B]
Overlords Priest : Hideous Dream[/B]
	* Does 10-30% Unholy damage
	* Pass PROMOTION_DESPERATION
		> -10% combat
		> AiControl
		> Dispellable
		> ExpireChance : 30%
	* Remove PROMOTION_COURAGE (but not PROMOTION_COURAGE_PALADIN)
	* Immune team, immune neutral, immune not alive
	* Resistable
	* Range : 1
[B]
Overlords Highpriest : Ward of Terror[/B]
	* Range : 2
	* Push enemies
	* PROMOTION_TERROR
		> cause fear
		> immune to fear
		> Pyperturn push enemies
		> Removed by combat, removed by casting

PS : the OO spells are changed from water-themed into dream/nightmare/terror-themed. I keep the Kraken, though, as I presume the Krakens are Danalin's (or Hemah's?) nightmare manifested.

[B]Esus : none
[/B][B]
Veil Highpriest : Despair[/B]
	* Drain XP from victims (caster level - target level), min : 5 XP.
	* Halves XP drain for Heroes.
	* Damage per XP drained, damage cap : 50%.
	* 1% per (caster level - target level) to delete a promotion, halves for Heroes.
	* Doesn't delete Channeling 1-3 and Hero (that would be too much despair :lol:).
[B]
Fire 3 : Inferno[/B]
	* Calculate a best tiles in 2-tile (like Pillar of Fire)
	* Does damage to all units on the best tile and the surrounding tiles.
	* Damage : 20%, cap 50%, fire.
	* Effect : Fire Breath Explode
[B]
Earth 3 : Stone Avatar[/B]
	* Promotion : Stone Avatar 
		> 25% Collateral Damage
		> 25% Collateral Damage Protection
		> +1 Earth Affinity 
		> removed after combat, removed after casting
	* pass on combat : PROMOTION_SHATTERED (-20% combat, removed when healed)
[B]
Air 3 : Fly[/B]
	* Promotion : Fly (100% expire)
[B]
Water 3 : Torrent[/B]
	* Cast Tsunami (OO Priest old spell)
	* Castable if pPlot.isAdjacentToWater() OR pPlot.isRiverSide()
	[B]
Sun 3 : Searing Heat[/B]
	* 30% to 60% damage, holy, best tile
		> 60% to 90% damage, holy, to vampires
	* 20% chance to PARALYZE
		> 40% chance to Vampires
	[B]
Spirit 3 : Spirit Barrier[/B]
	* Create improvement, artmodel : ring of carcer
		> Py model : necrototem (fear on enemy units at war with caster's player)
		> Dispellable by any friendly units inside the Barrier
	* Create promotion : HOLD BARRIER
		> buff caster only
		> held caster
		> prereq for spell : remove barrier (destroy improvement, remove promotion HOLD BARRIER, castable by unit in-stack with caster)
	* If caster is killed, the improvement remains but has no fear effect. Any units can dispel it then.
[B]
Mind 3 : Feeblemind[/B]
	* Pass PROMOTION_FEEBLEMIND
		> Prereq for SPELL_SILENCED (a spell dummy to remove casting ability)
			o PyReq : reqSilenced(Caster)
			o caster.setHasCasted(True)
		> Dispellable
		> Resist Magic : -50
	* Remove PROMOTION_SPELLSTAFF
	* Resistable, Range : 2
	* Immune Team, Immune Neutral
	* Resistable, Resist Modify : -10
[B]
Law 3 : Summon High Angel[/B]
	* Summon random Seraph, Angel of Death, Ophanim, Herald, Repentant Angel
	* Setduration (2)
[B]
Life 3 : Summon Lifespark[/B]
	* Create UNIT_LIFESPARK (invisible, elemental, flying, move : 2, permanent summon)
	* Prereq for SPELL_TAP_LIFESPARK
		> Castable by living OR angelic friendly units
		> Heal the unit
		> Remove Feeblemind, Poisoned, Withered
		> Kill the Lifespark
	[B]
Enchantment 3 : Create Artifact[/B]
	* Create random artifact (20% chance to create minor artifacts, 10% miscast lost Ench III, 70% nothing)
[B]
Nature 3 : Summon Guardian Vine[/B]
	* Create UNIT_GUARDIAN_VINES
		> UnitCombat : Beast, Permanent
		> 0 moves, 8 strength + 2 poison
		> Promotions : Defensive, Guardman, Poison Resistance
		> Promotion from combat : PROMOTION_HASTED
		> Py postCombatWon : heal50
[B]
Body 3 : Shockwave[/B]
	* Damage 10% up to 50%, physical, 1-tile
	* Push enemy units
	* Radius 1 tile
	* Immune Team, Immune Neutral
[B]
Shadow 3 : Shadow Cloak[/B]
	* Add Promotion : Hidden
	* Buff caster only
[B]
Death 3 : Lichdom[/B]
[B]
Entropy 3 : Summon Greater Demon[/B]
	* Summon random Balor, Horned Dread (Infernal Phalanx UU, cause fear), Soul Hunter (Infernal Beastmaster UU, created manes from combat), Death Knight, Ira
	* Setduration (2)
[B]
Chaos 3 : Incite Mob[/B]
	* Promotion MOB 
		> AI Control
		> +20% combat strength
		> -20% combat def
		> blitz
		> +1 move
		> 30% barbarian chance
		> 30% expire chance
		> immune to fear
	* Remove promotions : Loyalty, Courage
	* Friendly units only, immune not alive
[B]
Metamagic 3 : Advanced Summon[/B]
	* Req promotions OR : Air3, Earth3, Fire3, Water3, Shadow3, Sun3
	* Summon random Air/Fire/Earth/Water/Aurealis/Mistform
		> Summoned unit based on caster promotions (so with Air3 and Sun3 it's Air Elemental or Aurealis)
		> Summoned unit starts with its respective magic promotion (Air2 for Air Elemental...)
		> Summoned unit starts with GREATER_SUMMON
			o Combat : +20%
			o Move : +1
			o Immune to Banishment
		> Setduration (2)	
[B]
Metamagic 3 : Banishment[/B]
	* Destroy any hostile summons in 2 radius instantly
	* Will not work on unit with Greater Summon promotion
 
How did you do code the push enemies thing on Ward of Terror? I assume it's some sort of knockback effect? I was wondering because I had a similar thing planned for my Water III spell, but I couldn't figure out how to code it.

As far as the spells go, I was aiming to add a summon to each effect Tier III, and add an effect to each summoning tier III(So each element has both a summon and a support/damage spell). That limits what I can use from your ideas, but there still are a few good ones.

As far as feedback on your spells, I noticed that Metamagic III allowed Greater Summons. Instead of summoning a random monster though, that if you just made the Metamagic III promotion pass the Greater summon promotion onto summoned units, so they could chose what to summon instead of it being random? Just a thought.

Alternatively, you could make a Metamagic III spell that added a promotion which made summons last an extra turn and have a bonus to strength... so the summon would essentially take an extra turn to cast, but be stronger. I like that idea... I might do something with it.

Oh, and does anybody know how Mobius Witches get their random promotions? I want to do something similar with my Spellsword mercenary, but I can't figure out how.
 
Has anyone gotten a crash while playing this mod? So far, in the two games I've played with this mod, I've encountered a reoccurring crash. The first game I was CoE Sidar, with the game crashing on turn 301. This last one I was Order Bannor with the game crashing on 448.

Can someone who has more experience debugging help me figure out what is wrong? Or is it just bad luck that both saves got corrupted(is that the right word?)
 
Has anyone gotten a crash while playing this mod? So far, in the two games I've played with this mod, I've encountered a reoccurring crash. The first game I was CoE Sidar, with the game crashing on turn 301. This last one I was Order Bannor with the game crashing on 448.

Can someone who has more experience debugging help me figure out what is wrong? Or is it just bad luck that both saves got corrupted(is that the right word?)

I've played a game a few days ago, as AV Sheaim, but forget what turn I played it to. I do believe it was past turn 400, though, as it was well over 700Kb in size for the save on a huge map and 16 civs. I didn't stop due to a crash but because I got bored with that particular game (and I prefer to play one of the modmods rather than "plain" FFH2. The only reason I played that particular game was to test your mod out and see if it worked with another mod at the same time).
 
I really like your changes, especially the way you improved Esus and Level III spells. Those areas really needed improvement :)
I prefer Orbis mercenary system, but yours is certainly improvement over base FFH one :)
 
I've played a game a few days ago, as AV Sheaim, but forget what turn I played it to. I do believe it was past turn 400, though, as it was well over 700Kb in size for the save on a huge map and 16 civs. I didn't stop due to a crash but because I got bored with that particular game (and I prefer to play one of the modmods rather than "plain" FFH2. The only reason I played that particular game was to test your mod out and see if it worked with another mod at the same time).

Hmm... Well that's good, I suppose. If anyone else has problems, let me know; I would like to get everything worked out rather than have a buggy mod.

I really like your changes, especially the way you improved Esus and Level III spells. Those areas really needed improvement :)
I prefer Orbis mercenary system, but yours is certainly improvement over base FFH one :)

Thank you! Now that FFH2 is in a feature lock, it is those areas that I am looking to improve on. Like Orbis, I'm trying to improve game mechanics instead of simply adding more stuff, so I'll have to take a look over there and see what I can improve on.
 
How did you do code the push enemies thing on Ward of Terror? I assume it's some sort of knockback effect? I was wondering because I had a similar thing planned for my Water III spell, but I couldn't figure out how to code it.

Sorry for not answering asap. Here are my codes on Ward of Terror.

Spoiler :
in CIV4SpellInfos.xml
Code:
        <SpellInfo>
            <Type>SPELL_WARD_OF_TERROR</Type>
            <Description>Ward of Terror</Description>
            <Civilopedia>TXT_KEY_SPELL_PLACEHOLDER_PEDIA</Civilopedia>
            <PromotionPrereq1>PROMOTION_CHANNELING3</PromotionPrereq1>
            <PromotionPrereq2>PROMOTION_DIVINE</PromotionPrereq2>
            <ReligionPrereq>RELIGION_OCTOPUS_OVERLORDS</ReligionPrereq>
            <bAllowAI>1</bAllowAI>
            <iAIWeight>100</iAIWeight>
            <bDisplayWhenDisabled>1</bDisplayWhenDisabled>
            <bHasCasted>1</bHasCasted>
            <iRange>1</iRange>
            <AddPromotionType1>PROMOTION_WARD_OF_TERROR</AddPromotionType1>
            <bBuffCasterOnly>1</bBuffCasterOnly>
            <bPush>1</bPush>
            <Effect>EFFECT_CONTAGION</Effect>
            <Sound>AS3D_SPELL_CONTAGION</Sound>
            <Button>Art/Interface/Buttons/Spells/wardofterror.dds</Button>
        </SpellInfo>

In CIV4PromotionInfos.xml
Code:
        <PromotionInfo>
            <Type>PROMOTION_WARD_OF_TERROR</Type>
            <Description>Ward of Terror</Description>
            <Help>[ICON_BULLET]Spread terror into enemy ranks.</Help>
            <Sound>AS2D_IF_LEVELUP</Sound>
            <TechPrereq>TECH_NEVER</TechPrereq>
            <Button>Art/Interface/Buttons/Spells/wardofterror.dds</Button>
	    <bFear>1</bFear>
	    <bImmuneToFear>1</bImmuneToFear>
            <bRemovedByCasting>1</bRemovedByCasting>
            <bRemovedByCombat>1</bRemovedByCombat>
            <iMinLevel>-1</iMinLevel>
            <PyPerTurn>effectWardofTerror(pCaster)</PyPerTurn>
        </PromotionInfo>

In CVSpellInterface.py
Code:
def effectWardofTerror(caster):
	caster.cast(gc.getInfoTypeForString('SPELL_WARD_OF_TERROR'))

Basically, the caster push enemy units using the original spell. To make it continuous per turn, I add promotion in the spell, and the promotion call the spell on the next round using py. It's just the same mechanic as Crown of Brilliance.


As far as the spells go, I was aiming to add a summon to each effect Tier III, and add an effect to each summoning tier III(So each element has both a summon and a support/damage spell). That limits what I can use from your ideas, but there still are a few good ones.

I did want to give a summoning spell and a sorcery spell for each branch of magic, but at some point, I just couldn't find the best combination for each. Thus, I left Mind with no summon. I tried to give Mind 3 a SUMMON_DUSTMAN (as in the lore) but it wasn't as exciting as FEEBLEMIND :lol:. The AIs also quite capable of using sorcery/effect/direct damage spells if I gave a high AIWeight on it too. :mischief:

As far as feedback on your spells, I noticed that Metamagic III allowed Greater Summons. Instead of summoning a random monster though, that if you just made the Metamagic III promotion pass the Greater summon promotion onto summoned units, so they could chose what to summon instead of it being random? Just a thought.

Alternatively, you could make a Metamagic III spell that added a promotion which made summons last an extra turn and have a bonus to strength... so the summon would essentially take an extra turn to cast, but be stronger. I like that idea... I might do something with it.

Yes, I could make PROMOTION_METAMAGIC3 grant PROMOTION_ADVANCED_SUMMON to all summoned units, the same as PROMOTION_COMBAT1 grants PROMOTION_EMPOWER1, but it is less fun, IMHO :lol:. With my current mechanism, I get a random factor, which elemental prince heeds my call? It is part of the fun, just as with LAW3 (Which high angel hear my plea?). I am thinking about replacing SUMMON_BALOR with SUMMON_GREATER_DEMON (current ENTROPY3) and make a new sorcery spell for ENTROPY3. It might be something with draining the land and replenish energy? Grant casting ability by turning land into hell terrain? Hmmm...

Oh, and does anybody know how Mobius Witches get their random promotions? I want to do something similar with my Spellsword mercenary, but I can't figure out how.

Mobius Witches got random promotions in CVEventManager.py, def onCityDoTurn. But if you just want to implant the code for your Spellsword, just use this part :

Code:
					if iUnit == gc.getInfoTypeForString('UNIT_MOBIUS_WITCH'):
						promotions = [ 'PROMOTION_AIR1','PROMOTION_BODY1','PROMOTION_CHAOS1','PROMOTION_DEATH1','PROMOTION_EARTH1','PROMOTION_ENCHANTMENT1','PROMOTION_ENTROPY1','PROMOTION_FIRE1','PROMOTION_LAW1','PROMOTION_LIFE1','PROMOTION_MIND1','PROMOTION_NATURE1','PROMOTION_SHADOW1','PROMOTION_SPIRIT1','PROMOTION_SUN1','PROMOTION_WATER1' ]
						for i in promotions:
							if CyGame().getSorenRandNum(10, "Bob") == 1:
								newUnit.setHasPromotion(gc.getInfoTypeForString(i), True)

I use that for my Djinn. So, whenever I summon a Djinn, there is a slight chance that my Djinn will start with random magic promotions, level 1 and 2. Quite useful with Summoning Trait, IMHO :D

One minor suggestion : you can make the spells more flavourful by changing and combining various visual effects and sounds. I did that and it worked like a charm.

Oh, and here is a model of Griffin Rider, if you had not have it. It was made by Ahwaric.
 
Thanks for your help!

As far as that griffin rider goes, it doesn't seem to work properly. The nif is extremely large and lacks an animation.
 
:/

On my third playthrough, game consistently freezes on turn 430. I think the AI doesn't understand one of my changes and it causes the game to lock up/crash. Only problem is, I don't know what the problem is.

No real point to continue developing this until it gets figured out, I guess. If anyone can help me get this figured out that would be great, but otherwise...
 
There is a possibility that the crashes were not of your modmod's fault. The vanilla FfH is having similar problem, from what I read in the bug thread. You might do some of Bruenor's tricks in detecting bugs via WB. It works like a charm from me. Thrice I got a WoC and once a CtD (never before when playing at .40z), and all of them are solveable using Bruenor's tricks.
 
:/

On my third playthrough, game consistently freezes on turn 430. I think the AI doesn't understand one of my changes and it causes the game to lock up/crash. Only problem is, I don't know what the problem is.

you could remove AllowAI from all the spells you added for a test. And if it helps add the AllowAI step by step to see which spell causes trouble. My guess is that the change to blinding light is the problem. The AI might have a unit with movement but no visibility and thus doesn't know what to do with the unit.

I have merged a few things, will report back if there is a problem or not with the items I merged.
 
Has any progress been done on this?

You should make a module like this for RifE when 1.3 comes out, then you'll have true modular python to play around with :D
 
Top Bottom