Modding Pirate Coves

Discussion in 'Civ4 - Fall from Heaven' started by schlalex, May 5, 2008.

  1. schlalex

    schlalex Warlord

    Joined:
    Feb 3, 2008
    Messages:
    151
    Hey Guys.
    I had some thoughts about the Lanun recently. I would like to give them the power to build pirate coves everywhere they want, so one adjacent to another. At the moment they cannot be built within 3 tiles. I am a noob about modding, but took my time and searched all the xms files. Unfortunately i cannot find the entry about the distance. Maybe someone could give me a hint, what i have to do.
    I wanna mod the cove, because i like the idea that the lanun could turn their land to their native terrain, *water*. Thus, they would have an advantage when figting inside their borders, cause their were only a few tiles the enemy could use, to get close to cities. Plus they had a much better chance on maps with a lot of land.

    Thanks for the help, i cant wait to try this out :).
     
  2. Vehem

    Vehem Modmod Monkey

    Joined:
    Nov 22, 2005
    Messages:
    3,219
    In Assets\Python\Screens\CvSpellInterface.py

    Code:
    def reqPirateCove(caster):
    	pPlot = caster.plot()
    	if pPlot.isWater():
    		return False
    	if pPlot.area().getNumTiles() == 1:
    		return False
    	if pPlot.getNumUnits() > 1:
    		return False
    	if pPlot.isCity():
    		return False
    	if (pPlot.isOwned() and pPlot.getOwner() != caster.getOwner()):
    		return False
    	if pPlot.getImprovementType() != -1:
    		return False
    	[b]iPirateCove = gc.getInfoTypeForString('IMPROVEMENT_PIRATE_COVE')
    	iPirateHarbor = gc.getInfoTypeForString('IMPROVEMENT_PIRATE_HARBOR')
    	iPiratePort = gc.getInfoTypeForString('IMPROVEMENT_PIRATE_PORT')
    	iX = caster.getX()
    	iY = caster.getY()
    	for iiX in range(iX-2, iX+3, 1):
    		for iiY in range(iY-2, iY+3, 1):
    			pPlot = CyMap().plot(iiX,iiY)
    			iImprovement = pPlot.getImprovementType()
    			if iImprovement == iPirateCove:
    				return False
    			if iImprovement == iPirateHarbor:
    				return False
    			if iImprovement == iPiratePort:
    				return False[/b]
    	return True
    All of the section in bold is the check for nearby coves/ports/harbours. If you remove that section, the check is not carried out so you can build them closer together.
     
  3. schlalex

    schlalex Warlord

    Joined:
    Feb 3, 2008
    Messages:
    151
    It WORKS :).
    Thank you a lot Vehem for the fast answer! i had never searched in the python files.
    Now a great game awaits me :).

    P.S.: The CvSpellInterface.py was in the folder *entrypoints* not *screens*. I hope that is ok...
     
  4. Vehem

    Vehem Modmod Monkey

    Joined:
    Nov 22, 2005
    Messages:
    3,219
    It is - and thanks for reminding me of that. I'd managed to move my version of entrypoints somehow when I was merging Fall Further and one of the previous versions of Fall from Heaven (saved the changed version to the wrong directory most likely - luckily the changed version was the "dominant" one as it was read last (or first - never quite sure with the python load order)). I've been meaning to change it back and have done so now.
     

Share This Page