Well, one of my units in my mod is supposed to destroy tanks by firing small nukes at them. So, I decided, why not make them make fallout when they attack? So I tried (again) at Python. here's what I made, copying and modifing existing code. Please don't laugh out loud when you read this, I've barely ever coded before. Ok, here it is:
So, how many mistakes, errors, or forgetifications did I make?
Please tell me so that I can improve!
Code:
def onCombatResult(self, argsList):
'Combat Result'
pWinner,pLoser = argsList
playerX = PyPlayer(pWinner.getOwner())
unitX = PyInfo.UnitInfo(pWinner.getUnitType())
playerY = PyPlayer(pLoser.getOwner())
unitY = PyInfo.UnitInfo(pLoser.getUnitType())
####Zapotec###
iZapotec = gc.getInfoTypeForString("UNIT_ZAPOTEC")
if (unitX or unitY) == iZapotec
iX = pUnit.getX()
iY = pUnit.getY()
terrain.setHasFeature(gc.getInfoTypeForString("FEATURE_FALLOUT"), True)
###Zapotec END###
if (not self.__LOG_COMBAT):
return
if playerX and playerX and unitX and playerY:
CvUtil.pyPrint('Player %d Civilization %s Unit %s has defeated Player %d Civilization %s Unit %s'
%(playerX.getID(), playerX.getCivilizationName(), unitX.getDescription(),
playerY.getID(), playerY.getCivilizationName(), unitY.getDescription()))
So, how many mistakes, errors, or forgetifications did I make?
Please tell me so that I can improve!