A little modification to the Calabim

Behcio

Chieftain
Joined
Jan 4, 2008
Messages
19
Hi.

I've been thinking about modifying Calabim a little bit. What I mean is that feasting cannot raze a city - it just stops you at 1 population. So I thought why not let it happen? Why not let Calabim raze cities by feasting on them? (You know, very useful when you conquer cities far away from your homeland)

Thing is, I just don't know how to do it. Can anyone give instructions on how to change the xml files? It'd be better than just getting the modified xml since later patches will just erase the change.
 
I've had it like that in my modmod for a while (well, I think I might have made a slight mistake in the version I publicly released, but it is working now). It requires both xml and python.

My XML Code Change (The part of C:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword\Mods\Fall from Heaven 2 030\Assets\XML\Units\CIV4SpellInfos.xml that I changed for this particular spell):
Code:
        <SpellInfo>
            <Type>SPELL_FEAST</Type>
            <Description>TXT_KEY_SPELL_FEAST</Description>
            <Civilopedia>TXT_KEY_SPELL_FEAST_PEDIA</Civilopedia>
            <Strategy>NONE</Strategy>
            <Help>TXT_KEY_SPELL_FEAST_HELP</Help>
            <PromotionPrereq1>PROMOTION_VAMPIRE</PromotionPrereq1>
            <PromotionPrereq2>NONE</PromotionPrereq2>
            <UnitPrereq>NONE</UnitPrereq>
            <UnitClassPrereq>NONE</UnitClassPrereq>
            <UnitCombatPrereq>NONE</UnitCombatPrereq>
            <UnitInStackPrereq>NONE</UnitInStackPrereq>
            <CivilizationPrereq>NONE</CivilizationPrereq>
            <ReligionPrereq>NONE</ReligionPrereq>
            <StateReligionPrereq>NONE</StateReligionPrereq>
            <TechPrereq>NONE</TechPrereq>
            <bAllowAI>1</bAllowAI>
            <bAdjacentToWaterOnly>0</bAdjacentToWaterOnly>
            <bCausesWar>0</bCausesWar>
            <bGlobal>0</bGlobal>
            <bInBordersOnly>1</bInBordersOnly>
            <bInCityOnly>1</bInCityOnly>
            <iAIWeight>0</iAIWeight>
            <bDisplayWhenDisabled>1</bDisplayWhenDisabled>
            <bHasCasted>1</bHasCasted>
            <bIgnoreHasCasted>0</bIgnoreHasCasted>
            <bResistable>0</bResistable>
            <iRange>0</iRange>
            <iResistModify>0</iResistModify>
            <iDamage>0</iDamage>
            <iDamageLimit>0</iDamageLimit>
            <DamageType>NONE</DamageType>
            <AddPromotionType1>NONE</AddPromotionType1>
            <AddPromotionType2>NONE</AddPromotionType2>
            <AddPromotionType3>NONE</AddPromotionType3>
            <RemovePromotionType1>NONE</RemovePromotionType1>
            <RemovePromotionType2>NONE</RemovePromotionType2>
            <RemovePromotionType3>NONE</RemovePromotionType3>
            <bBuffCasterOnly>1</bBuffCasterOnly>
            <ConvertUnitType>NONE</ConvertUnitType>
            <CreateBuildingType>NONE</CreateBuildingType>
            <CreateFeatureType>NONE</CreateFeatureType>
            <CreateImprovementType>NONE</CreateImprovementType>
            <SpreadReligion>NONE</SpreadReligion>
            <CreateUnitType>NONE</CreateUnitType>
            <iCreateUnitNum>0</iCreateUnitNum>
            <bPermanentUnitCreate>0</bPermanentUnitCreate>
            <CreateUnitPromotion>NONE</CreateUnitPromotion>
            <bImmuneTeam>0</bImmuneTeam>
            <bImmuneNeutral>0</bImmuneNeutral>
            <bImmuneEnemy>0</bImmuneEnemy>
            <bImmuneFlying>0</bImmuneFlying>
            <bImmuneNotAlive>0</bImmuneNotAlive>
            <bDispel>0</bDispel>
            <bPush>0</bPush>
            <bRemoveHasCasted>0</bRemoveHasCasted>
            <bSacrificeCaster>0</bSacrificeCaster>
            <iChangePopulation>-1</iChangePopulation>
            <iCost>0</iCost>
            <iImmobileTurns>0</iImmobileTurns>
            <iMiscastChance>0</iMiscastChance>
            <PyMiscast></PyMiscast>
            <PyResult>spellFeast(pCaster)</PyResult>
            <PyRequirement>reqFeast(pCaster)</PyRequirement>
            <Effect>EFFECT_SACRIFICE</Effect>
            <Sound>AS3D_SPELL_FEAST</Sound>
            <HotKey></HotKey>
            <bAltDown>0</bAltDown>
            <bShiftDown>0</bShiftDown>
            <bCtrlDown>0</bCtrlDown>
            <bGraphicalOnly>0</bGraphicalOnly>
            <iHotKeyPriority>0</iHotKeyPriority>
            <Button>Art/Interface/Buttons/Spells/Feast.dds</Button>
        </SpellInfo>
My Python Code Change(the pasrt of C:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword\Mods\Fall from Heaven 2 030\Assets\python\entrypoints\CvSpellInterface.py that I changed to make this work):
Code:
def reqFeast(caster):
	pPlayer = gc.getPlayer(caster.getOwner())
	pCity = pPlot.getPlotCity()
	if (pPlayer.isHuman() == False):
		if pCity.getPopulation() < 5:
			if not pCity.isDisorder():
				return False
	return True

def spellFeast(caster):
	pPlot = caster.plot()
	pCity = pPlot.getPlotCity()
	caster.changeExperience(pCity.getPopulation()-2, -1, false, false, false)
	pCity.changeHurryAngerTimer(3)
	if pCity.getPopulation() < 2:
			pCity.kill()
 
I've got some bad news :(
I've just installed the "i" patch and then modified the proper files (with the notepad, if hta changes anything). But now, feast won't work at all, in any circumstances - it's just grayed out. Checked in the World Builder :(

Do these changes brake saved games? If not, I'll just revert back to "i" and maybe try again later.


EDIT:
Hmm, just realised that patching with "i" doesn't give the original python and xml codes back :/ Can anyone paste the original codes for that spell please? I forgot to make a backup :/
 
Ok, I managed to get the original code back :) I just didn't notice that the path in the patch is always set to somewhere in C:\Program Files etc.

Anyway, your modification doesn't work Magister, I'm afraid :/


EDIT:
I found a mistake in your code, Magister. Seems you forgot one line in that python :)

It should be like this:
Code:
def reqFeast(caster):
	pPlot = caster.plot()
	pPlayer = gc.getPlayer(caster.getOwner())
	pCity = pPlot.getPlotCity()
	if (pPlayer.isHuman() == False):
		if pCity.getPopulation() < 5:
			if not pCity.isDisorder():
				return False
	return True

The line after the def was missing, I guess that broke the spell.
However, there's still one glitch - you can raze a city now but if it has 2 population, not 1. When it's only 1, the spell is grayed out. Maybe I'll do some random typing, maybe I'll manage to fix this :p I'm not that much of a programmer but I kinda understand what does what in there :)

Just to make sure, that part of code after if (pPlayer.isHuman() == False): is to keep the AI from feasting when it doesn't make much sense? (Since you would get no XP anyway)
 
Top Bottom