Pirates Cove

Kasdar

Warlord
Joined
Jul 29, 2006
Messages
268
Location
Minnesota
I was wondering which file I would need to change and where at in the file the information telling Pirate coves can't be built within 3 tiles of each other is. I would like to change the number of tiles apart they can be built.
 
FFHSpells.py, the function reqPirateCove.
 
FFHSpells.py, the function reqPirateCove.

Thanx Snarko what do I need to change here? to make it; 0 tiles? 5 tiles?
Code:
def reqPirateCove(caster):
	if caster.getUnitClassType() != gc.getInfoTypeForString('UNITCLASS_WORKER'):
		return False
	if not canCast(caster):
		return False
	pPlayer = gc.getPlayer(caster.getOwner())
	if pPlayer.getCivilizationType() != gc.getInfoTypeForString('CIVILIZATION_LANUN'):
		return False
	if pPlayer.isHuman() == False:
		return False
	iX = caster.getX()
	iY = caster.getY()
	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
	bValid = False
	for iiX in range(iX-1, iX+2, 1):
		for iiY in range(iY-1, iY+2, 1):
			pPlot = CyMap().plot(iiX,iiY)
			if pPlot.isWater():
				bValid = True
	if bValid == False:
		return False
	for iiX in range(iX-2, iX+3, 1):
		for iiY in range(iY-2, iY+3, 1):
			pPlot = CyMap().plot(iiX,iiY)
			if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_PIRATE_COVE'):
				return False
	return True

def spellPirateCove(caster):
	doCast(caster)
	pPlayer = gc.getPlayer(caster.getOwner())
	pPlot = caster.plot()
	caster.setXY(pPlayer.getCapitalCity().getX(), pPlayer.getCapitalCity().getY())
	pPlot.setBonusType(-1)
	pPlot.setFeatureType(-1, -1)
	pPlot.setPlotType(PlotTypes.PLOT_OCEAN, True, True)
	pPlot.setTerrainType(gc.getInfoTypeForString('TERRAIN_COAST'),True,True)
	pPlot.setImprovementType(gc.getInfoTypeForString('IMPROVEMENT_PIRATE_COVE'))
	caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_GOLEM'), True)
	caster.kill(True, 0)
	CyMap().recalculateAreas()
 
This part
Code:
	for iiX in range(iX-2, iX+3, 1):
		for iiY in range(iY-2, iY+3, 1):
			pPlot = CyMap().plot(iiX,iiY)
			if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_PIRATE_COVE'):
				return False

If you want the range to be 0 you can just comment out that part, starting each line with ##. Otherwise change iX-2, iX+3 and iY-2, iY+3 to the numbers you want. The subtraction should be one less than the addition because range start at the lowest value and end at the value below the highest.
 
That didn't work they still are built 3 tiles apart even after commenting out those lines..

Also tried
Code:
def reqPirateCove(caster):
	if caster.getUnitClassType() != gc.getInfoTypeForString('UNITCLASS_WORKER'):
		return False
	if not canCast(caster):
		return False
	pPlayer = gc.getPlayer(caster.getOwner())
	if pPlayer.getCivilizationType() != gc.getInfoTypeForString('CIVILIZATION_LANUN'):
		return False
	if pPlayer.isHuman() == False:
		return False
	iX = caster.getX()
	iY = caster.getY()
	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
	bValid = False
##	for iiX in range(iX-1, iX+2, 1):
##		for iiY in range(iY-1, iY+2, 1):
##			pPlot = CyMap().plot(iiX,iiY)
##			if pPlot.isWater():
##				bValid = True
##	if bValid == False:
##		return False
##	for iiX in range(iX-2, iX+3, 1):
##		for iiY in range(iY-2, iY+3, 1):
##			pPlot = CyMap().plot(iiX,iiY)
##			if pPlot.getImprovementType() == gc.getInfoTypeForString('IMPROVEMENT_PIRATE_COVE'):
##				return False
	return True
 
That code keeps them from being build from within 3 tiles of each other. If you comment it out they will be able to be built within 3 tiles.

If you want to increase the distance between them change the second loop from:

Code:
		for iiY in range(iY-2, iY+3, 1):

to:

Code:
		for iiY in range(iY-4, iY+5, 1):

The above code ups it so that coves can't be built within 5 tiles of each other.
 
You should not comment out the first loop, that checks if there's water nearby. Commenting out the second loop will work. I just did so and then built three piratecoves next to eachother.
 
You should not comment out the first loop, that checks if there's water nearby. Commenting out the second loop will work. I just did so and then built three piratecoves next to eachother.

I tried that but it wouldnt let me. Do I need to start a new game or do something else?
 
No you do not need to start a new game. You can even make the python changes while playing. That's what I did. (But if you do make the changes while in the game you'll need to move the worker for the option to show up)
 
No you do not need to start a new game. You can even make the python changes while playing. That's what I did. (But if you do make the changes while in the game you'll need to move the worker for the option to show up)

You can do that? Great! Never thought of trying to change something while running the game. Does it work with XML changes as well? Probably not, because it's all read in when starting the game, but it can't hurt to ask.
 
You can do that? Great! Never thought of trying to change something while running the game. Does it work with XML changes as well? Probably not, because it's all read in when starting the game, but it can't hurt to ask.

It does not work for XML or SDK changes. Only python. But it will break PLE causing all sorts of problems. Loading a save or going back to the main menu will fix it.
 
Thanx everyone I got it working.
 
Back
Top Bottom