Modmodding Q&A Thread

Cool thanks. However as soon as I make any changes to dll and run a build I get this error. Any ideas what the issue might be?

1>------ Build started: Project: CvGameCoreDLL, Configuration: Release Win32 ------
1> "C:\Program Files (x86)\Microsoft Visual C++ Toolkit 2003\bin\cl.exe" /nologo /MD /O2 /Oy /Oi /G7 /DNDEBUG /DFINAL_RELEASE /Fp"Release\CvGameCoreDLL.pch" /GR /Gy /W3 /EHsc /Gd /Gm- /DWIN32 /D_WINDOWS /D_USRDLL /DCVGAMECOREDLL_EXPORTS /Yu"CvGameCoreDLL.h" /IBoost-1.32.0/include /IPython24/include /I"C:\Program Files (x86)\Microsoft Visual C++ Toolkit 2003/include" /I"C:\Program Files (x86)\Windows Kits\8.1\Include\shared" /I"C:\Program Files (x86)\Windows Kits\8.1/Include/mfc" /I"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include" /I"C:\Program Files (x86)\2K Games\Civilization 4 Complete\Beyond The Sword\CvGameCoreDLL\Boost-1.32.0/include" /I"C:\Program Files (x86)\2K Games\Civilization 4 Complete\Beyond The Sword\CvGameCoreDLL\Python24/include" /FoRelease\CvRhyes.obj /c CvRhyes.cpp
1>'C:\Program' is not recognized as an internal or external command,
1>operable program or batch file.
1>NMAKE : warning U4010: 'Release\CvRhyes.obj' : build failed; /K specified, continuing ...
1>NMAKE : warning U4011: 'Release\CvGameCoreDLL.dll' : not all dependents available; target not built
1>NMAKE : warning U4011: 'Release' : not all dependents available; target not built
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3073: The command "nmake /NOLOGO /K Release" exited with code 1.
1>Done building project "CvGameCoreDLL.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
 
"C:\Program Files (x86)\Microsoft SDKs" is this where you actually put the SDK? Make sure your Makefile points to the right directories.
 
I'm getting the following error:
Traceback (most recent call last):
File "<string>", line 1, in ?
File "<string>", line 52, in load_module
File "CvEventInterface", line 13, in ?
File "<string>", line 52, in load_module
File "CvRFCEventManager", line 6, in ?
File "<string>", line 52, in load_module
File "CvRFCEventHandler", line 14, in ?
File "<string>", line 35, in load_module
File "<string>", line 13, in _get_code
File "RiseAndFall", line 2729
if (iCiv == iSumeria):
^
SyntaxError: invalid syntax
load_module CvAppInterface

I'm guessing its because Sumeria is not defined somewhere?
 
No, more likely your actual syntax error is in the last line before it and it fails parsing that one.
 
Well I deleted the Sumerian line, and that fixed the problem! :confused:
Not sure what the issue is, but the Sumerians don't need to start with any technology anyway!
 
That's another way of solving the problem :D In general when you have syntax errors with your code it helps to include a snippet of the surrounding lines in your question for the future.
 
Will do, and you know me there is always another question!
My next and final question for the time being should be a simple one.
Is there a way to auto play a game, so you can watch and see how the computer plays the civs?
 
If cheat mode is enabled, you can dismiss the autoplay loading bar by hitting escape and then view the entire map with Ctrl+Z. The only downside is that the Canadian spawn is the latest you can go this way.
 
I'm getting the following error:
Traceback (most recent call last):
File "<string>", line 1, in ?
File "<string>", line 52, in load_module
File "CvEventInterface", line 13, in ?
File "<string>", line 52, in load_module
File "CvRFCEventManager", line 6, in ?
File "<string>", line 52, in load_module
File "CvRFCEventHandler", line 14, in ?
File "<string>", line 35, in load_module
File "<string>", line 13, in _get_code
File "RiseAndFall", line 2729
if (iCiv == iSumeria):
^
SyntaxError: invalid syntax
load_module CvAppInterface

I'm guessing its because Sumeria is not defined somewhere?

Check your indentation. That could be the problem.
 
If cheat mode is enabled, you can dismiss the autoplay loading bar by hitting escape and then view the entire map with Ctrl+Z. The only downside is that the Canadian spawn is the latest you can go this way.

I have heard of this cheat mode, but never use it as I play DOC with honor, and without cheating valiantly fail to achieve most UHVs!
How do I activate cheat mode?

Also I'm going to throw this question out here. When I am playing Civ 4 I am periodically getting sound warping (which coincides with the game going slow), it seems to affect all mods and also occurs before loading any mods. My thought is I'm going to have to uninstall Civ 4 and reinstall it, but if anyone else has a better idea...
 
Did you know that cheat codes were initially invented not to help players without honour, but rather to help developers debugging their games?

Anyways, edit Beyond the Sword/_Civ4Config and search for "CheatCode" and replace the line with "CheatCode = chipotle" (if it doesn't exist, add it). Afterwards a couple of shortcuts become available, e.g. Ctrl+Z to reveal the whole map and Alt+Z and Alt-Shift-Z to switch forward and backward between players.
 
Did you know that cheat codes were initially invented not to help players without honour, but rather to help developers debugging their games?

Anyways, edit Beyond the Sword/_Civ4Config and search for "CheatCode" and replace the line with "CheatCode = chipotle" (if it doesn't exist, add it). Afterwards a couple of shortcuts become available, e.g. Ctrl+Z to reveal the whole map and Alt+Z and Alt-Shift-Z to switch forward and backward between players.

I learn a new thing everyday!
 
Me again!
I'm want to implement this function into RFCGW const py, "# converted to years - edead tBirth = ("
How do I do that? Is it coded in one of the dll files?
Many thanks,
 
This depends on the getTurnForYear function, which is implemented in the DLL and then exported to Python.
 
@EdmundIronside

I'm by no means a mod expert but assuming you're looking at consts.py, you're probably looking at this:
Code:
# converted to years - edead
tBirth = (
-3000, # 0, #3000BC            # Egypt
-3000, # 0, #3000BC            # China
[...]
-3000
)

All that code does is to set some values into an array so that they can be looked up later to determine e.g. whether it's time to spawn a civ. The affected civ is determined by its position (slot) in the list of players. Three sections near the top of the Consts file, after, "# initialise player variables to player IDs from WBS", determine which slot corresponds to which player. The first section sets up a zero-based range (iNumPlayers) enumerating the players; the second iterates the game context for that range to determine which civ (player) is represented by each, and the third section determines which team in that range each civ (player) is represented.

To actually determine whether a specific year has been reached, you call the DLL function getTurnForYear(iYear) where iYear is the integer year you're after, e.g. -3000, 1600, whatever. The number returned is the turn number corresponding to iYear. (There is also a proc called getTurns in RFCUtils.py that can be used to calculate durations in turns allowing for the game speed, but that's outside the scope of this post.)

Thus if you use getTurnForYear(tBirth[1]) or getTurnForYear(tBirth[iChina]) you will get the turn corresponding to slot 1 (3000 BC - the birth year for China).

Edit: () > []
 
Last edited:
Yes, but it's important to know that base RFC and RFCGW do not have getTurnForYear. Instead you had to actually store turn numbers in tBirth and similar tuples, which was hard to read and maintain. Embryodead originally introduced that change in SoI and I ported it over to DoC, and as I said it depends on a DLL implementation.
 
BTW I haven't tried to compile a DLL yet but I can see it in my future. Do you know offhand whether C++ 2010 Express makes valid Civ4 DLLs or do I need to go back a few versions?
 
VS 2010 is recommended actually. See my guide here for setting up the DLL in the easiest way possible.
 
Back
Top Bottom