Modmodding Q&A Thread

In the guide for creating a civ says “In the beginning, you should make a copy of the constant from Consts.py and get the PyPlayer and PyTeam objects for your player.”

Could what is involved here be elaborated on please.
 
In the guide for creating a civ says “In the beginning, you should make a copy of the constant from Consts.py and get the PyPlayer and PyTeam objects for your player.”

Could what is involved here be elaborated on please.

You can skip that. That is outdated because you load all consts from Consts.py directly.
 
Cool thanks.

Do you have any idea why I might be getting these errors when loading the civ in the scenario? They tend to appear while it is loading the map.



Assert Failed

File: .\.\CvPlot.cpp

Line: 7193

Expression: eIndex >= 0

Message: iIndex is expected to be non-negative (invalid Index)

FAssertMsg(eIndex >= 0, "iIndex is expected to be non-negative (invalid Index)");


Assert Failed

File: .\.\CvPlot.cpp

Line: 7340

Expression: getCulture(eIndex) >= 0

Message:

FAssert(getCulture(eIndex) >= 0);
 
I have no idea. I usually create a release DLL instead of a debug one, so I don't have this errors. (And they appear not to be critical) When I do create a debug DLL and get them, I just click them away.
 
I have no idea. I usually create a release DLL instead of a debug one, so I don't have this errors. (And they appear not to be critical) When I do create a debug DLL and get them, I just click them away.

Cool thanks.
Last couple of questions I promise.

How do I create a release DLL?

Also any idea what this python error I am getting in the python error log is about?




Traceback (most recent call last):
File "CvWBInterface", line 47, in applyInitialItems
File "CvWBDesc", line 2028, in applyInitialItems
File "CvWBDesc", line 1676, in applyCity
File "CvWBDesc", line 1340, in apply
File "CvWBDesc", line 25, in getPlayer
ArgumentError: Python argument types in
CyGlobalContext.getPlayer(CyGlobalContext, NoneType)
did not match C++ signature:
getPlayer(class CyGlobalContext {lvalue}, int)
ERR: Python function applyInitialItems failed, module CvWBInterface
Traceback (most recent call last):
File "BugUtil", line 691, in <lambda>
File "BugEventManager", line 706, in preGameStart
File "CvAppInterface", line 74, in preGameStart
File "CvScreensInterface", line 106, in showMainInterface
File "CvMainInterface", line 463, in interfaceScreen
File "CvMainInterface", line 377, in initState
File "PLE", line 180, in PLE_CalcConstants
File "PLE", line 851, in getMaxRow
ZeroDivisionError: integer division or modulo by zero
ERR: Python function preGameStart failed, module CvAppInterface
Traceback (most recent call last):
File "CvScreensInterface", line 106, in showMainInterface
File "CvMainInterface", line 463, in interfaceScreen
File "CvMainInterface", line 377, in initState
File "PLE", line 180, in PLE_CalcConstants
File "PLE", line 851, in getMaxRow
ZeroDivisionError: integer division or modulo by zero
ERR: Python function showMainInterface failed, module CvScreensInterface
 
Cool thanks.
Last couple of questions I promise.

How do I create a release DLL?

Also any idea what this python error I am getting in the python error log is about?

In Visual studio, there is a dropdown menu, which says DEBUG by default. Select Release in that menu and build the DLL as usual.

I'll download your mod and see if I can help with the errors.
EDIT:
I see that you put all the modified files in the main folder of DoC. The game doesn't load you modified files this way. It load all files in the Assets folder, which are currently unmodified. Make sure you move all files to the correct subfolders first.
 
Last edited:
Okay, everything should be in the correct assets folder now.
 
Nice. But the main mod folder is still full of changed files. I recommend removing them to keep everything clean.

Did you include the new CvGameCoreDLL? I cannot find you included it in the log.
It looks like you didn't move the XML files.

- You made a typo in the Zulu UP code. Line 559, you have pZzulu.xxxxx() (Note the double z)
- The function for the Zulu UP is not called anywere. Make sure this function is called. (Personally, I would modify the utils.captureUnit() function (used for the Aztec UP) to code the Zulu UP, as they are very similar)
- The victory help code, the "elif iGoal == 1" and "elif iGoal == 2" should have an additional tab in front of it. (To match the indentation of "if iGoal == 0"
- The code for the 3rd victory have 1 tab to many.
 
Last edited:
Did you include the new CvGameCoreDLL? I cannot find you included it in the log.
It looks like you didn't move the XML files.

- You made a typo in the Zulu UP code. Line 559, you have pZzulu.xxxxx() (Note the double z)
- The function for the Zulu UP is not called anywere. Make sure this function is called. (Personally, I would modify the utils.captureUnit() function (used for the Aztec UP) to code the Zulu UP, as they are very similar)
- The victory help code, the "elif iGoal == 1" and "elif iGoal == 2" should have an additional tab in front of it. (To match the indentation of "if iGoal == 0"
- The code for the 3rd victory have 1 tab to many.

Thanks, have cleaned it up, hopefully uploaded all the modified files, and have made the changes you pointed out.
 
The new code in the PR.

Code:
    def write(self, f, sign):
        "write sign data"
        f.write("BeginSign\n")
        f.write("\tplotX=%d\n" %(sign.getPlot().getX(),))
        f.write("\tplotY=%d\n" %(sign.getPlot().getY(),))
        iPlayer = sign.getPlayerType()
        if sign.getPlayerType() == -1:
            f.write("\tplayerType=%d, (%s)\n" %(iPlayer, "All"))
        else:
            f.write("\tplayerType=%d, (%s)\n" %(iPlayer, gc.getPlayer(iPlayer).getName().encode(fileencoding)))
        f.write("\tcaption=%s\n" %(sign.getCaption(),))
        f.write("EndSign\n")
 
I have made some progress with my zulu civ. They now spawn correctly, but as soon as I build my capital (currently its pretoria as I have borrowed elements of Stebs Boers temporarily) the game crashes. I don't know if this is related, but on the menu screen it says they have no unique building (even though I set it as the Ikhanda).
 
For the UB, I guess you still have the following line in the XML entry of the Ikhanda. (Last line of the entry) Simply remove it. (It is only an graphical issue. You should be able to build it. Although you couldn't have seen this because of the crash)
Code:
<bGraphicalOnly>1</bGraphicalOnly>

What do the error messages say when it crashes?

Spoiler :
BTW, I made the Boers, not steb. ;) (Actually novicenoble made them, I only updated it to the latest version of DoC.)
 
Ikhanda issue fixed! :goodjob:

Okay a number of issues when playing zulu game.
1. There is no display info - such as no end turn sign, no bar with civs in contact with, when asked to examine city nothing displays, etc
2. I was contacted by Poland or ?Tibet. It said Poland, but the person I spoke with looked like a Budhist monk!

Python error log:
Traceback (most recent call last):
File "BugUtil", line 691, in <lambda>
File "BugEventManager", line 706, in preGameStart
File "CvAppInterface", line 74, in preGameStart
File "CvScreensInterface", line 106, in showMainInterface
File "CvMainInterface", line 463, in interfaceScreen
File "CvMainInterface", line 377, in initState
File "PLE", line 180, in PLE_CalcConstants
File "PLE", line 851, in getMaxRow
ZeroDivisionError: integer division or modulo by zero
ERR: Python function preGameStart failed, module CvAppInterface
 
Okay I have just updated the GIT.
 
I spotted the problem. When you edited the scenario files, you replaced some UnitOwner with UNITOWNER and CityOwner with cityowner. The code is capital sensitive. Make sure all lines are correct.

When I fixed this, I got an C++ runtime error. This was easily fixed by rebuilding the DLL. Are you sure you included the new DLL?

With these changes, I was able to run a Zulu start without issues and found my first city. I spotted some errors when I opened victory screen. The code below shows the fixes it.

1. Add iZulu as the first argument of isControlled().
2. Replace "bAfrica" with "bSouthAfrica" as the argument of getIcon().

Victory.py, @ line 4055 (victory help text)
Code:
            bSouthAfrica = isControlled(iZulu, utils.getPlotList(tBoerAfricaTL, tBoerAfricaBR))
            aHelp.append(getIcon(bSouthAfrica) + localText.getText("TXT_KEY_VICTORY_CONTROL_SOUTH_AFRICA", ()))

And Victory.xml
(Just use "South Africa". Or do you intend that you should control X% of South Africa)

Code:
    <TEXT>
        <Tag>TXT_KEY_VICTORY_CONTROL_SOUTH_AFRICA</Tag>
        <English>South Africa territory: %s1 / %s2%%</English>
    </TEXT>

EDIT:
Why can't I underline parts in the code section? :wallbash:
 
Last edited:
Because it's code!
 
Thank you so much merijn_v1, it finally is working!! :thumbsup:
The only python error I am getting now is:

"Traceback (most recent call last):
File "BugPath", line 461, in initNoCustomAssetsSetting
File "configobj", line 337, in __getitem__
KeyError: 'CONFIG'"

Hopefully its nothing important.

I had to remove UHV 3 because it was causing the game to say I was automatically defeated!
Something for me to work on. The important thing is the mod is finally working! :king:
 
Back
Top Bottom