1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

How to tweak lairs exploration outcomes?

Discussion in 'Civ4 - Fall from Heaven' started by Zongo, Apr 20, 2010.

  1. Zongo

    Zongo Warlord

    Joined:
    Oct 11, 2007
    Messages:
    161
    I would like to change the relative frequency of lair exploration outcomes.

    Ideally, I would like Bradeline Well to always spawn baddies and have a higher chance of getting the real bad ones. Alternatively I could live with a similar behaviour for all epic lairs.

    I tried a quick search through the XML and Python files, to no avail. Possibly I tried the wrong words. Can someone enlighten me, please?
     
  2. esvath

    esvath Apprentice of Erebus

    Joined:
    Mar 27, 2008
    Messages:
    1,403
    The spell to explore a lair is defined in CIV4SpellInfos.xml, just search for SPELL_EXPLORE_LAIR_BRADELINES_WELL.

    Then, the result is invoked through python, using this code in the spell :
    Code:
                <PyResult>spellExploreLairEpic(pCaster)</PyResult>
                <PyRequirement>reqExploreLair(pCaster)</PyRequirement>
    
    All Epic Lair use the same python, so you have to create your own python, such as spellExploreBradeline. Use this to you PyResult.

    Then, create a function in CvSpellInterface.py
    Code:
    def spellExploreBradelinecaster):
    	pPlot = caster.plot()
    	iRnd = CyGame().getSorenRandNum(100, "Explore Lair") + caster.getLevel()
    	iDestroyLair = 0
    	if iRnd < 54:
    		iDestroyLair = cf.exploreLairBigBad(caster)
    	if iRnd >= 54:
    		iDestroyLair = cf.exploreLairBad(caster)
    	if iDestroyLair > CyGame().getSorenRandNum(100, "Explore Lair"):
    		CyInterface().addMessage(caster.getOwner(),True,25,CyTranslator().getText("TXT_KEY_MESSAGE_LAIR_DESTROYED", ()),'AS2D_POSITIVE_DINK',1,'Art/Interface/Buttons/Spells/Explore Lair.dds',ColorTypes(8),pPlot.getX(),pPlot.getY(),True,True)
    		pPlot.setImprovementType(-1)
    	caster.finishMoves()
    	caster.changeExperience(1, -1, false, false, false)
    
    For the actual spawning of baddies, you can look at CustomFunctions.py, under
    Code:
    	def exploreLairBigBad(self, caster):
    
    and
    
    	def exploreLairBad(self, caster):
    
    Of course, you can create your own super-big-bad-extreme-baddies (spawning 12 hostile Death Angels, just for example :p) by changing iDestroyLair = cf.exploreLairBigBad(caster) into something you like.

    Hope this will help :)
     
  3. Zongo

    Zongo Warlord

    Joined:
    Oct 11, 2007
    Messages:
    161
    It certainly helps insofar it answer my question! As I am a Python neophite, I will have to intuitively dig my way through the code, but it looks feasible. Your help is concise and informative enough to make it seem so :)
     
  4. Zongo

    Zongo Warlord

    Joined:
    Oct 11, 2007
    Messages:
    161
    It does not work, though.

    I created a copy of spellExploreLairEpic(pCaster) and renamed it spellExploreLairEpicBradeline(pCaster) in the file CvSpellInterface.py;

    then I modified Civ4SpellInfos.xml as follows

    Code:
            <SpellInfo>
                <Type>SPELL_EXPLORE_LAIR_BRADELINES_WELL</Type>
                <Description>TXT_KEY_SPELL_EXPLORE_LAIR</Description>
                <Civilopedia>TXT_KEY_SPELL_PLACEHOLDER_PEDIA</Civilopedia>
                <ImprovementPrereq>IMPROVEMENT_BRADELINES_WELL</ImprovementPrereq>
                <bDisplayWhenDisabled>1</bDisplayWhenDisabled>
                <bHasCasted>1</bHasCasted>
                <bAbility>1</bAbility>
    <PyResult>[COLOR="Red"]spellExploreLairEpicBradeline(caster)[/COLOR]</PyResult>
                <PyRequirement>reqExploreLair(pCaster)</PyRequirement>
                <Effect>EFFECT_SPELL1</Effect>
                <Sound>AS3D_SPELL_HASTE</Sound>
                <bGraphicalOnly>1</bGraphicalOnly>
                <Button>Art/Interface/Buttons/Spells/Explore Lair.dds</Button>
            </SpellInfo>
    
    The exploration of Bradeline's well does not do anything, now. I just get the message "explore lair" and that's it.
     
  5. a_civilian

    a_civilian Warlord

    Joined:
    Jun 7, 2007
    Messages:
    161
    caster instead of pCaster a typo?
     
  6. Zongo

    Zongo Warlord

    Joined:
    Oct 11, 2007
    Messages:
    161
    most likely :blush: Still new to Python. Thanks :)
     

Share This Page