Modmodding Q&A Thread

I think this is answered but I can't find it: How to log in python?
IIRC Go into the .ini file in your MyGames Beyond the Sword folder and search for the string log, the rest should be self evident.

EDIT: My Games/Beyond the Sword/CivilizationIV.ini search for
Code:
; Enable the logging system
LoggingEnabled = 0

Replace 0 with 1
 
IIRC Go into the .ini file in your MyGames Beyond the Sword folder and search for the string log, the rest should be self evident.

EDIT: My Games/Beyond the Sword/CivilizationIV.ini search for
Code:
; Enable the logging system
LoggingEnabled = 0

Replace 0 with 1

Thanks but I mean to log what I want i.e. put a line something like:
Code:
log(iPlayer, iMasonry)
and get a line like:
Code:
victory.py:  China, Masonry
in a log
 
Simply use print, the output is redirected to PythonDbg.log.
 
Which file(s) are responsible for showing UHV relevant tiles when mousing over them? Asking for the Rhodes Colossus so he can always be sure where to place his feet.
 
CvScreensInterface def getUHVTileInfo
Uhmmmmm... okay, so this is a function that assigns each UHV tile or UHV area a certain number, like Asia (for England and Portugal) is 34, but how does the game turn that 34 into the text string "Asia"? I searched like a dozen Python files and nowhere else could I find the function getUHVTileInfo even mentioned.

Edit: Hm, I just now realized (when booting up England in 1700AD) that the tiles I want to have marked as "Cape" or "Suez Canal" already have "Africa" in the tooltip for the colonization goal. Is it even possible to have a tile "marked" two different ways for two different goals? IIRC this isn't presently the case for any civ. The closest thing, Eastward Expansion for Russia, sidesteps this by just having Siberia marked and not adding an extra string for coastal Siberian tiles.
 
Last edited:
You can define a text key TXT_KEY_UHV_AREA_<id> that will be displayed, they are defined in Regions.xml.
 
Does anyone have any experience designing terrain features? Like rivers, marshes, etc. How does that work? Is it all coded or do they typically use image files of some kind. Curious to dip into design stuff as I have no aptitude for coding.

If this is not the right place or it's too complicated to explain here, if you can direct me to an appropriate thread that would be very much appreciated.
 
Rivers are hardcoded into the engine and cannot be changed (maybe the art can? I don't know). Features can be freely changed, but their creation is not trivial because you need to create assets that reflect other bordering features. See Assets/XML/Art/CIV4ArtDefines_Feature.xml for pointers.
 
For the last few weeks in CMC I've been getting a Access violation - no RTTI data error every now and then during autoplay, though curiously enough no one has reported any crashes. I've been trying to figure out why it's happening, though Debug DLLs have so many warning popups that it's hard to tell which is the source. What would you say I should be on the lookout for from and error such as this?

Code:
Traceback (most recent call last):

  File "CvWBInterface", line 18, in writeDesc

  File "CvWBDesc", line 1889, in write

  File "CvWBDesc", line 660, in write

RuntimeError: Access violation - no RTTI data!
ERR: Python function writeDesc failed, module CvWBInterface
Traceback (most recent call last):
  File "BugEventManager", line 400, in _handleDefaultEvent
  File "CvRFCEventHandler", line 632, in onBeginGameTurn
  File "Stability", line 55, in checkTurn
  File "Stability", line 586, in completeCollapse
  File "Stability", line 528, in secedeCities
  File "Stability", line 555, in secedeCity
  File "RFCUtils", line 1940, in flipOrCreateDefenders
  File "RFCUtils", line 1908, in flipUnits
  File "RFCUtils", line 1914, in flipUnit
  File "RFCUtils", line 182, in makeUnit
RuntimeError: unidentifiable C++ exception
 
Are you rebased to the latest DoC? I have tried to cut down the number of failed asserts by either fixing their issues or removing them. I remember this error but unfortunately not what caused it. But if it results from WBDesc than there is something problematic in one of your scenario files. Adding more logging to the WBDesc file might help uncover which part it is.
 
Are you rebased to the latest DoC? I have tried to cut down the number of failed asserts by either fixing their issues or removing them. I remember this error but unfortunately not what caused it. But if it results from WBDesc than there is something problematic in one of your scenario files. Adding more logging to the WBDesc file might help uncover which part it is.
Not sure how I missed so many updates...

Thanks for the help! I'll respond with the results.
 
Merging the latest fixed the issue entirely. Cool!

EDIT: What's the best way to check why an AI civ collapses, Babylonia keeps collapsing too early in CMC.
 
Last edited:
Apparently it's still happening, though less often and without the CvWBDesc thingy.

Code:
Traceback (most recent call last):
  File "BugEventManager", line 400, in _handleDefaultEvent
  File "CvRFCEventHandler", line 632, in onBeginGameTurn
  File "Stability", line 55, in checkTurn
  File "Stability", line 582, in completeCollapse
  File "Stability", line 484, in secedeCities
  File "Stability", line 551, in secedeCity
  File "RFCUtils", line 1941, in flipOrCreateDefenders
  File "RFCUtils", line 1909, in flipUnits
  File "RFCUtils", line 1915, in flipUnit
  File "RFCUtils", line 182, in makeUnit
RuntimeError: unidentifiable C++ exception

If you already read the Edit to the above post, you can ignore the question below.

What's the best way to check why an AI civ collapses, Babylonia keeps collapsing too early in CMC.
 
I'm still looking for a reproducing save for the above issue, so it exists in DoC too.
 
I'm still looking for a reproducing save for the above issue, so it exists in DoC too.
From what I've played, it seems to only happen in autoplay. It happens pretty reliably in CMC when running a Hittite spawn, so if it's the same as in DoC then this might be the most reproducible we're gonna get. Unless I'm wrong and it also happens in normal gameplay.
 
Knowing that it will occur in autoplay is already useful for reproducing it, even though it will make checking if it is fixed harder.
 
Speaking of autoplay and debugging, do debug DLLs use the same seed for every game? I've been rolling Hittite games in the Debug DLL for 20 minutes and haven't gotten any crashes, I'm starting to suspect it's using the same seed. I keep flipping a Great Prophet.
 
Not that I know but it's possible.
 
Back
Top Bottom