• 📚 A new project from the admin: Check out PictureBooks.io, an AI storyteller that lets you create personalized picture books for kids in seconds. Give it a try and let me know what you think!

Quick Modding Questions Thread

Anything over 25 MB gets rejected and my zip file is just 48 MB. I was under impression that 146 MB was the magic limit number, has it been changed recently?
Maybe you reached the limit of total files volume uploaded. Post attachments count.
 
Hi all, I'm wondering about the advisor tags on each building/tech/unit, like ADVISOR_SCIENCE on the Library.

Do they actually do anything, or are they just cosmetic?

Is it possible to add new advisor tags? For example if I wanted to reassign Jail and similar buildings to an ADVISOR_ESPIONAGE? I can't find where they're declared.
 
Turns out I was blind, there's a CIV4AdvisorInfos.xml file where they're declared. From initial testing, adding new ones is easy.
 
Can someone tell me why this model is causing CTD? I was working on it with NifScope
 

Attachments

What is the safest and most efficient way to extend the available slots in the GameFont.tga files? I am running out of slots and would like to add more, and it would be fine to either add another row or add a few slots to the right in every row.

GameFontEditor seems to not support this functionality, and just opening the TGA file in e.g. GIMP loads it as a transparent layer where it seems the editing of the underlying pink/white boxes that Civ4 expects is opaque to me. Is there a different tool/plugin to help with this or is the best approach still to export the two TGA layers to BMP and add more slots manually?
 
Is it possible to control Improvement buildability via python code?

What I want to do:
Preserve improvement could be placed on certain features (Natural Wonders) OR certain resources (Elephant, Fur, etc) OR if there is another Preserve improvement on a neighboring tile BUT you cannot build more than (let's say) 8 within a 3 tiles range of a city.

Do we have python code for such behavior?
 
Is it possible to control Improvement buildability via python code?

What I want to do:
Preserve improvement could be placed on certain features (Natural Wonders) OR certain resources (Elephant, Fur, etc) OR if there is another Preserve improvement on a neighboring tile BUT you cannot build more than (let's say) 8 within a 3 tiles range of a city.

Do we have python code for such behavior?
I'm pretty new, but I think canBuild() in CvGameUtils.py is where you'd put this check.

You'd start with `if iBuild == gc.getInfoTypeForString('BUILD_PRESERVE')`. Then `pPlot = CyMap().plot(iX, iY)` to get the plot and `pPlot.getWorkingCity()` (or maybe `gc.getMap().findCity()` and `gc.getMap().calculatePathDistance()`?) to find the city to count from. Return 0 if there's no city in range. Then loop over the city's plots to count the number of preserves around it.

If the city isn't capped out, then you'd finally check that plot's features, bonuses, and its neighbouring plots' improvements.
 
It was asked in CoM thread but (1) I don't know the answer and (2) it's not a mod specific but a more general question:
Hello.
I ask a question already made 100 times.
Playing in 2k resolution I find UI's texts and fonts terribly small. I know there is a file to edit (civ4theme_common) but my attempts were disastrous. Do you have a guide or a pre-edited file?
Thank you
 
Does anyone have an easy solution to the problem of custom religion names overlapping in the religious advisor screen? Is there any way I can shrink the text size, make the advisor screen bigger or add a scroll bar or such? I just hate the way it looks when the long names start blending into eachother!

1763119129784.png
 
Does anyone have an easy solution to the problem of custom religion names overlapping in the religious advisor screen? Is there any way I can shrink the text size, make the advisor screen bigger or add a scroll bar or such? I just hate the way it looks when the long names start blending into eachother!

View attachment 747752
I'm not sure but maybe Tamriel mod has custom religions with longer names. You could check it.
My other guesses are Fall From Heaven and Conflict on Chiron mods with custom religions that may have longer names.
But this is just what I vaguely remeber.

Edit: if any of these mods have a solution for your question than you'll have to look for the python files - ReligionAdvisor.py maybe?
 
Last edited:
Does anyone have an easy solution to the problem of custom religion names overlapping in the religious advisor screen? Is there any way I can shrink the text size, make the advisor screen bigger or add a scroll bar or such? I just hate the way it looks when the long names start blending into eachother!
The screen in question is drawn by CvReligionScreen.py. This file seems to be missing in warlords and BTS, so the original one is used. Copy this one to your mod if it's not already present in Assets\Python\Screens
Code:
			szLabel = gc.getReligionInfo(i).getDescription()
#			if (self.iReligionSelected == i):
#				szLabel = localText.changeTextColor(szLabel, gc.getInfoTypeForString("COLOR_YELLOW"))
			screen.setText(szName, szArea, szLabel, CvUtil.FONT_CENTER_JUSTIFY, xLoop + self.X_RELIGION_AREA, self.Y_RELIGION_AREA + self.Y_RELIGION_NAME, 2*self.DZ, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
			xLoop += self.DX_RELIGION
That's the code in question.
I suppose you can alter the first line to specify the size if you like, like
Code:
			szLabel = u"<font=2>" + gc.getReligionInfo(i).getDescription() + u"</font>"
It's a bit trial and error to see which size fits best. Obviously the screen can be altered to make more space for each religion, but that requires more programming knowledge. Make sure you don't alter the leading tabs/spaces. Python doesn't like that.
 
I'm not sure but maybe Tamriel mod has custom religions with longer names. You could check it.
My other guesses are Fall From Heaven and Conflict on Chiron mods with custom religions that may have longer names.
But this is just what I vaguely remeber.

Edit: if any of these mods have a solution for your question than you'll have to look for the python files - ReligionAdvisor.py maybe?

base Fall from Heaven 2 actually has the same problem haha. Looks like they just accepted it. I did try looking at Extramodmod which has a bunch of UI changes, but unfortunately I can't make heads or tails of the python because I am not a very intelligent person

The screen in question is drawn by CvReligionScreen.py. This file seems to be missing in warlords and BTS, so the original one is used. Copy this one to your mod if it's not already present in Assets\Python\Screens
Code:
            szLabel = gc.getReligionInfo(i).getDescription()
#            if (self.iReligionSelected == i):
#                szLabel = localText.changeTextColor(szLabel, gc.getInfoTypeForString("COLOR_YELLOW"))
            screen.setText(szName, szArea, szLabel, CvUtil.FONT_CENTER_JUSTIFY, xLoop + self.X_RELIGION_AREA, self.Y_RELIGION_AREA + self.Y_RELIGION_NAME, 2*self.DZ, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
            xLoop += self.DX_RELIGION
That's the code in question.
I suppose you can alter the first line to specify the size if you like, like
Code:
            szLabel = u"<font=2>" + gc.getReligionInfo(i).getDescription() + u"</font>"
It's a bit trial and error to see which size fits best. Obviously the screen can be altered to make more space for each religion, but that requires more programming knowledge. Make sure you don't alter the leading tabs/spaces. Python doesn't like that.
Thank you so much, that does the trick!

By the by, I am confused by another small issue - I have removed/renamed a bunch of UNITCOMBAT classes for my mod, and I'm able to launch and start the game fine without any XML error warnings. However my XML log keeps spitting out this, which is really confusing to me because there is no reference to any UNITCOMBAT in the Civ4EspionageMissionInfo.xml as far as I can see:
1763123460038.png
 
I did try looking at Extramodmod which has a bunch of UI changes, but unfortunately I can't make heads or tails of the python because I am not a very intelligent person
You figured out how to ask the right question and you figured out how to use the answer to get the problem solved. You already did better than the average player. Not understanding the python UI code is normal. The code is unacceptably poorly written by modern standards and is generally hard to read. Mods doesn't fix that because part of the problem is the calls to the EXE, which can't be modded.
 
base Fall from Heaven 2 actually has the same problem haha. Looks like they just accepted it. I did try looking at Extramodmod which has a bunch of UI changes, but unfortunately I can't make heads or tails of the python because I am not a very intelligent person
As @Nightinggale said, it's not unintelligence, just lack of skill and limitations of the game. Skills you can acquire or even 'cheat'. I have almost no coding skills but I often ask ChatGPT to explain/write/modify some code for me. And it does miracles... I mean you still need some skills and understanding but it's a great help 🙂
 
By the by, I am confused by another small issue - I have removed/renamed a bunch of UNITCOMBAT classes for my mod, and I'm able to launch and start the game fine without any XML error warnings. However my XML log keeps spitting out this, which is really confusing to me because there is no reference to any UNITCOMBAT in the Civ4EspionageMissionInfo.xml as far as I can see:
The Civ4EspionageMissionInfo.xml thing is incorrect. The Unitcombats are referenced after loading XML, probably via python.
 
Does anyone know any DLL mods where you can gain access to a different civ's UBs? It's a feature in History Rewritten (Hagia Sophia wonder lets you capture UBs) but it's a bit buggy — they can't trigger events and aren't affected by civics — and I'm looking for examples for how to fix it.
 
Does anyone know any DLL mods where you can gain access to a different civ's UBs? It's a feature in History Rewritten (Hagia Sophia wonder lets you capture UBs) but it's a bit buggy — they can't trigger events and aren't affected by civics — and I'm looking for examples for how to fix it.
Pretty sure it was a feature in FfH2, so you should ask Ashes of Erebus people (discord below).
 
Back
Top Bottom