deanej
Deity
I'm trying to make it so that you can only have 5 of a certain unit at any given time. Unfortunately, the code for this doesn't work at all - it doesn't do anything, not errors, no nothing, it's like its not even there. Here's what I added:
at the start of CvFinalFrontierEvents, after #globals:
in onGameStart:
in onUnitBuilt:
in onUnitLost:
in cannotTrain of CvGameUtils:
What on Earth am I doing wrong?
I NEED this limit in my mod. Please help.
at the start of CvFinalFrontierEvents, after #globals:
Code:
iNumKazon = 0
in onGameStart:
Code:
global iNumKazon
iNumKazon = 0
in onUnitBuilt:
Code:
iKazonUU = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_KAZON_TORPEDO')
global iNumKazon
if(pUnit.getUnitType() == iKazonUU):
iNumKazon += 1
in onUnitLost:
Code:
iKazonUU = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_KAZON_TORPEDO')
global iNumKazon
if(unit.getUnitType() == iKazonUU):
iNumKazon -= 1
in cannotTrain of CvGameUtils:
Code:
FinalFrontier = CvEventInterface.getEventManager()
if (eUnit == iKazonUU):
if (FinalFrontier.iNumKazon == 5):
return True
What on Earth am I doing wrong?
