strategyonly
C2C Supreme Commander
I need someone/anyone to put this in modular format: PLEASE!!
http://forums.civfanatics.com/downloads.php?do=file&id=9337
I tried but none of the code is marked anyplace
and it hard to figure out what to put where.
Here is an example of a way it needs to be formatted: (But for each python that ONLY needs to be used for these Expanded GP.)
EDIT: Minus the Inquisitor, dont need that part, thx.

http://forums.civfanatics.com/downloads.php?do=file&id=9337
I tried but none of the code is marked anyplace

Here is an example of a way it needs to be formatted: (But for each python that ONLY needs to be used for these Expanded GP.)

Spoiler :
Code:
from CvPythonExtensions import *
import CvEventManager
import CvUtil
import BugUtil
import PyHelpers
# globals
gc = CyGlobalContext()
localText = CyTranslator()
PyPlayer = PyHelpers.PyPlayer
PyInfo = PyHelpers.PyInfo
PyCity = PyHelpers.PyCity
PyGame = PyHelpers.PyGame
class SubdueAnimals:
def __init__(self, eventManager):
eventManager.addEventHandler("combatResult", self.onCombatResult)
def findClearPlot(self, pUnit):
BestPlot = -1
iBestPlot = 0
pOldPlot = pUnit.plot()
iX = pOldPlot.getX()
iY = pOldPlot.getY()
for iiX in range(iX-1, iX+2, 1):
for iiY in range(iY-1, iY+2, 1):
iCurrentPlot = 0
pPlot = CyMap().plot(iiX,iiY)
if pPlot.getNumUnits() == 0:
iCurrentPlot = iCurrentPlot + 5
if iCurrentPlot >= 1:
iCurrentPlot = iCurrentPlot + CyGame().getSorenRandNum(5, "findClearPlot")
if iCurrentPlot >= iBestPlot:
BestPlot = pPlot
iBestPlot = iCurrentPlot
return BestPlot
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())
pPlayer = gc.getPlayer(pWinner.getOwner())
if pWinner.isHasPromotion(gc.getInfoTypeForString('PROMOTION_SUBDUE_ANIMAL')):
if pLoser.getUnitCombatType() == gc.getInfoTypeForString('UNITCOMBAT_ANIMAL'):
iUnit = pLoser.getUnitType()
pClearPlot = self.findClearPlot(pLoser)
if (pLoser.plot().getNumUnits() == 1 and pClearPlot != -1):
pPlot = pLoser.plot()
pLoser.setXY(pClearPlot.getX(), pClearPlot.getY(), false, true, true)
else:
pPlot = pWinner.plot()
newUnit = pPlayer.initUnit(iUnit, pPlot.getX(), pPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_NORTH)
pLoser.setDamage(75, False)
#newUnit.convert(pLoser)
#pLoser.setDamage(100, False)
newUnit.finishMoves()
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()))
EDIT: Minus the Inquisitor, dont need that part, thx.