Wiping a city off the face of the Earth

Civkid1991

in shade of poison trees
Joined
Feb 20, 2006
Messages
871
Does anyone know if theres a function for deleting cities from a map?

Im looking for a function that would be the opposite of gc.getPlayer(iplayer).initCity(x,y). I've looked through the files but i can't seem to find a function for it.. do i have to go through the sdk? If so how should i go doing this?
 
primordial stew said:
maybe there is a simpler way, but this works for me:

Code:
        def destroyCity(self,pPlot):
		ccity = pPlot.getPlotCity()
		ccity.kill()

This didn't really work for me. Have you tired this? if so can you show me how you used it?

btw this is what i tried:

Spoiler :

Code:
def onBeginGameTurn(self, argsList):
		'Called at the beginning of the end of each turn'
		iGameTurn = argsList[0]
		if iGameTurn != gc.getDefineINT("START_YEAR"):
			for iPlayer in range(gc.getMAX_PLAYERS()):
				if gc.getPlayer(iPlayer).isHuman():
					py = PyPlayer(iPlayer)
					cCity = py.getCapitalCity()
					pPlot = cCity.plot()
					cCity.destoryCity(pPlot)


maybe i just coded this part wrong :hmm: if so could you show me what i did wrong. Ty
 
It took 10 tries to finally get that to work.. but it does, so there must be some error. It should show up in the My Documents\My Games\civ4\Logs\PythonErr.log

Logging probably needs to be enabled in the civilization4.ini file.

destroyCity was my name, did you paste that in as well?
 
Civkid1991 said:
This didn't really work for me. Have you tired this? if so can you show me how you used it?

btw this is what i tried:

Spoiler :

Code:
def onBeginGameTurn(self, argsList):
		'Called at the beginning of the end of each turn'
		iGameTurn = argsList[0]
		if iGameTurn != gc.getDefineINT("START_YEAR"):
			for iPlayer in range(gc.getMAX_PLAYERS()):
				if gc.getPlayer(iPlayer).isHuman():
					py = PyPlayer(iPlayer)
					cCity = py.getCapitalCity()
					pPlot = cCity.plot()
					cCity.[b]destoryCity(pPlot)[/b]


maybe i just coded this part wrong :hmm: if so could you show me what i did wrong. Ty

I think you have a misspell. :) I've highlighted the relevant part in your code.
 
Top Bottom