Teg_Navanis
King
- Joined
- Jan 21, 2006
- Messages
- 737
Abandon City/Raze Building mod modifies the same file as the unit statistics mod does, CvCustomEventManager.py. This means that only the mod you install last will work properly.
Yep, that error pops up when the program is expecting a list/dictionary object, but the object is actually an integer or string.
This usually happens when sdObjectGetVal (line 200, two lines before the line that returns an error) fails (it will then return 0). It will also print the error message "initialize object first!" to the file PythonDbg.log. You can go check if this is indeed the case, which would mean that my diagnosis is correct.
My guess would then be that the 'template' in which the actual values are later filled in (called UnitStatsData in UnitStatisticsDefines.py) is not created for new units, which in turn is most likely caused (assuming that you didn't fiddle with the python files themselves) by a wrong entry in PythonCallbackDefines.xml. USE_ON_UNIT_CREATED_CALLBACK and USE_ON_UNIT_LOST_CALLBACK have to be set to 1 for it to work correctly (and you need to add USE_UNIT_STATISTICS_CALLBACK).
<Define>
<DefineName>USE_ON_UNIT_CREATED_CALLBACK</DefineName>
<iDefineIntVal>1</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_ON_UNIT_LOST_CALLBACK</DefineName>
<iDefineIntVal>1</iDefineIntVal>
</Define>
<Define>
<DefineName>USE_UNIT_STATISTICS_CALLBACK</DefineName>
<iDefineIntVal>1</iDefineIntVal>
</Define>
</Civ4Defines>
else:
for i in range(14):
if (htype == DAMAGETYPE[i]):
for objUnit in unitList:
damagestats = sdObjectGetVal("UnitStats", objUnit, DAMAGESTATS)
if (not i / 7):
data = damagestats[INFLICTED][i % 7]
else:
data = damagestats[SUFFERED][i % 7]
datalist.append(data)
break
else:
for objUnit in unitList:
datalist.append(sdObjectGetVal("UnitStats", objUnit, htype))
# iTypeofAttack
# 0: (empty, reserved for total damage)
# 1: Attacker is hit
# 2: Defender is hit
# 3: Collateral damage (defender is hit)
# 4: Flanking strike (defender is hit)
# 5: Air Strike (defender is hit)
# 6: Other (FfH magic?) (defender is hit)