Quick Modding Questions Thread

1) Is there a limit on the number of CityArtStyles that the game will (accurately) use?
I think it is hit by the same limit as with all other xml files, meaning max 32768 entries (non negative values for a signed 2 byte int). You will run out of memory long before hitting this limit. That is unless most styles points to the same graphics, but then what is the point?

I'm not aware of any limits other than this and memory limitations. I would pay attention to memory usage if you want to go all out on this though. No graphics are good enough to allow a mod to become unstable due to running out of memory.
 
I would like to run some Python code after XML is loaded (and I can call something like gc.getBuildingInfo successfully) but before actually starting a game. That is, when still in the main menu / scenario selection screen. Is that possible? Is there an event being fired after XML loading is complete, or is it possible to create and fire such an event?
 
You could try adding a call to python at the end of CvXMLLoadUtility::LoadPreMenuGlobals in CvXMLLoadUtilitySet.cpp.
Oh, good idea. That may be worth a shot.
 
I would like to run some Python code after XML is loaded (and I can call something like gc.getBuildingInfo successfully) but before actually starting a game. That is, when still in the main menu / scenario selection screen. Is that possible? Is there an event being fired after XML loading is complete, or is it possible to create and fire such an event?
I am still tinkering with doing stuff with Python before the main menu is loaded.

Unfortunately, I run into a NPE when trying to use the CyTranslator / CvDllTranslator class, in particular it seems that it is impossible to call getSymbolID as is happening when this class is instantiated. Is it possible at all to use this class before the main menu is loaded (and I am just a bit too early), or should I give up trying to get this to work?
 
Unfortunately, I run into a NPE when trying to use the CyTranslator / CvDllTranslator class, in particular it seems that it is impossible to call getSymbolID as is happening when this class is instantiated. Is it possible at all to use this class before the main menu is loaded (and I am just a bit too early), or should I give up trying to get this to work?
I'm not quite sure what you are trying to accomplish as I see no reason to use python at this point of starting the game, but if your goal is to do something once symbols have been loaded, maybe put it in the end of CvGameTextMgr::assignFontIds.
 
Essentially I would like to rely on a Python function to render part of the menu screen, in particular the civ description in the civ selection dialog. I'll give assignFontIds a try, thanks!

Edit: that seems to do it, thanks again.
 
Last edited:
Hopefully I can find some assistance for two problems with DCM (Revdcm).

First, how would one go about adding a new unitcombat for Mounted_Archers that would possess the same bombard capabilities as the unitcombat for archers?

Second, how would one go about enabling the ability for archer bombard inside the borders of other civs? For example, I like to reinforce my vassals with my own units, but my archers are unable to bombard enemies inside my vassal’s culture border. Another example would be if I’m fighting Japan and we meet inside Babylonian territory, my archers are unable to bombard the Japanese units.

Unfortunately I don’t possess any sdk or python abilities.
 
Unfortunately, no such option exists in either the in-game mod options interface or the xml.
 
I'd like to turn off the tile yields visible on map when settler is active - to make settler act as any other unit in this matter. I don't see anything related to it in the xml files.
 
I've only managed to change this through the DLL. The EXE decides whether to show the Yield Display by calling CvUnit::shouldShowFoundBorders. Returning false there also disables the founding borders around the settler iirc. Well, highlighting adjacent tiles isn't helpful anyway, and founding borders covering the whole city radius can be (re-)implemented in the DLL.
 
Hi,

How would you change the leaderhead art that's displayed for a given civilization during the game? I'm using 2D images for the leaderheads, if that makes a difference.
Specifically, it's when the negotiations that I want to have artwork that changes over the game.
 
I've only managed to change this through the DLL. The EXE decides whether to show the Yield Display by calling CvUnit::shouldShowFoundBorders. Returning false there also disables the founding borders around the settler iirc. Well, highlighting adjacent tiles isn't helpful anyway, and founding borders covering the whole city radius can be (re-)implemented in the DLL.

Oh, then it's beyond my skills.
 
Is there a common cause for crashes to desktop on unit construction? Getting a crash when a worker is built in a specific city. I've had problems like this before but only when building modded units. The crash only occurs when I'm in debug mode or otherwise have the city revealed. I've never actually figured out the cause of these crashes in the past, usually just redoing the XML seems to fix it. But this time I haven't modded workers at all so not sure how that would help. Given how often I've had this problem I was hoping there was some fairly common cause for this sort of crash.
 
If you say unmodded, does that mean the art define of the worker unit is one that comes with the game? If not, it would be interesting first to know if the art displays correctly in the pedia. If it does, I would guess that the button is custom, but still has the "," in front of its path definition in the xml. If the game crashes trying to display the unit in the pedia, probably the "ArtDefineTag" in the "CIV4UnitInfos.xml" or in the "CIV4UnitArtStyleTypeInfos.xml" within the entry of that civilisation is leading nowhere, mostly likely due to a spelling error.
 
  • Like
Reactions: Set
Thank you! The art did display correctly in the pedia and I had made no changes to the button or the art. It was definitively an art issue though. I removed all art related XML files from the mod and that got things working. I also did clean install of BTS since I had BUG installed in custom assets (I had somewhat clumsily removed it before but this time I did a clean install to make sure I got all of it) so it's possible that was messing with things.
 
In base BTS, the AI only plots war when it can build at least two attacking units (basically when it has access to metals). What is it that determines whether a unit qualifies as an "attacking" unit? And is there a non-dll way to change this behavior?
 
@Set: This is the calculation in the DLL: CvPlayerAI.cpp#L13764
Looks like it's only a matter of the <UnitAIs> set in Civ4UnitInfos.xml:
At least one of these Unit AI types needs to be present:
UNITAI_RESERVE, UNITAI_ATTACK_CITY, UNITAI_COUNTER, UNITAI_PILLAGE.
Notably absent from this list is UNITAI_ATTACK – which is why Archer doesn't count.

Unique units with UNITAI_ATTACK or UNITAI_ATTACK_CITY count double unless they also have UNITAI_CITY_DEFENSE – i.e. a single such unit is enough to get the AI out of the GET_BETTER_UNITS strategy that prevents war planning.
 
  • Like
Reactions: Set
Back
Top Bottom