Jeff1787
Sarge
I really like the mod. Promotions are now showing. I found another bug, I think. My Warrior number 4 built in Paris shows to be an archer built in Bejing....

typenumber = 0
UnitTypeNumber = {
TYPENUMBER : typenumber }
sdEntityInit("UnitStats", unitI.getDescription(), UnitTypeNumber)
number = sdGetVal("UnitStats", unitI.getDescription(), TYPENUMBER)
number = number + 1
sdSetVal("UnitStats", unitI.getDescription(), TYPENUMBER, number)
unit.setName(unitI.getDescription() + " " + str(number))
#######SD Tool Kit#######
import SdToolKit
sdEcho = SdToolKit.sdEcho
sdModInit = SdToolKit.sdModInit
sdModLoad = SdToolKit.sdModLoad
sdModSave = SdToolKit.sdModSave
sdEntityInit = SdToolKit.sdEntityInit
sdEntityExists = SdToolKit.sdEntityExists
sdGetVal = SdToolKit.sdGetVal
sdSetVal = SdToolKit.sdSetVal
############################
if (len(unit.getNameNoDesc()) == 0):
unitI = PyInfo.UnitInfo(unit.getUnitType())
if(sdEntityExists("UnitStats", unitI.getDescription()) == False):
typenumber = 0
UnitTypeNumber = {
TYPENUMBER : typenumber }
sdEntityInit("UnitStats", unitI.getDescription(), UnitTypeNumber)
number = sdGetVal("UnitStats", unitI.getDescription(), TYPENUMBER)
number = number + 1
sdSetVal("UnitStats", unitI.getDescription(), TYPENUMBER, number)
unit.setName(unitI.getDescription() + " " + str(number))
So if Tank 4 is destroyed and you build tank #6 it will still be named Tank 6 and not Tank 4. Correct?
So ships fall under 8, and ground units (land) fall under 1 thru 6. Helicopter is 7. Where do bombers, and planes go??
#check if unit is sea unit
(if unit.getUnitClassType() >= 44 and unit.getUnitClassType() <= 54):
The other part of this is instead of using the number of that type built I wanted to use a list. So, is there a way to create an entity with a list? Several entities (Like a database stroage) for several lists?
namelist = ['Tom', 'Snappy', 'Kitty', 'Jessie', 'Chester']
unit.setName(unitI.getDescription() + " " + namelist(number))
I also need the tables so if Tank 2nd Army 4th Corp 3rd Div dies, the next tank will be named that.
gc.getGame().getActivePlayer().getUnitList()
for name in namelist:
for unit in unitList:
if unit.getNameNoDesc() = name:
#here you'd have to code a way that the name is only changed to the
#current value of namelist if the above condition is not true for
#any value of the unitlist.
RogerBacon said:A very small critique:
"AD" is supposed to come before the year and "BC" comes after the year. Many people don't know this though. In my Kill List mod I had it set up like this but your expansion of my mod seems to have removed this. Was this intentional or an oversite?
Roger Bacon
Teg_Navanis said:the high score function take too long to load (13 sec with 200 units). I have disabled it by default and will think of an alternative way of calculating them.
Traceback (most recent call last):
File "CvEventInterface", line 27, in onEvent
File "CvCustomEventManager", line 82, in handleEvent
File "CvCustomEventManager", line 93, in _handleDefaultEvent
File "CvUnitStatisticsEventManager", line 162, in onUnitLost
File "UnitStatisticsUtils", line 290, in onUnitLost
File "SdToolKit", line 144, in sdGetVal
KeyError: u'Settler0'
ERR: Python function onEvent failed, module CvEventInterface
Kimbal and Teg, you can use the CvCustomEventManager file from the Merc Mod special edition and strip out the merc related info. Otherwise if you want I'll upload a copy of the merged CvCustomEventManager file for the merge between PnP V0.5 and Unit Stats.Teg_Navanis said:I'll re-implement a classical CustomEventsManager - file for those of you who want to combine it with another mod via copy & paste.