Quick Modding Questions Thread

I am working on a mod (which I took over after it was abandoned).
One issue I am having is that the game date is not displaying, it simply says 'stone age'.
Does anyone have any idea how I can fix it so it displays the game date, or at least which files determine this information?
Thanks,
It may not be an error. There are some mods that only display the Era. Mostly to stop people complaining that the date does not match reality. I think Platyping showed how to do it in one of his mods.
 
Since this is a Rhye mod, it's likely implemented in Assets/Python/CvMainInterface.py. That's not very helpful because this is a huge file that draw basically the entire game UI (by the way, why? I feel like the game would benefit from a more modular approach). My suggestion is to find the text "Stone Age" in the text XML, then search for its TXT_KEY in the Python files.
 
Last edited:
Assets/Python/CvMainInterface.py. That's not very helpful because this is a huge file that draw basically the entire game UI (by the way, why? I feel like the game would benefit from a more modular approach).
Why are there so many various xml files in GameInfo? It feels a bit like they made files for specific tasks and then there are "the rest". I suspect CvMainInterface.py is written like it is for easy access and the main interface is running when all other python files control the screen. This means if you open another screen in another python file, if it doesn't fill the entire screen, what's left over will be the main interface. In Colonization this is used by the Domestic Advisor, which have the main interface at the bottom if you select a city in DA, the main interface will show the yield panel from the city screen. This works because the city screen is part of the main interface (which is often really annoying when modding the city screen).

I can certainly see the idea in putting everything together to allow access like this, but I still don't like the design because it's not modder friendly. I prefer one file, one task. It's kind of bad when you have to pay attention to minimap updating, drawing BuildInfo buttons, draw unit promotions and stuff like that when all you want to to change how the city screen displays the build queue. It's not like I have never talked about splitting the file up, though that would be a significant task in itself and not on top of the todo list.
 
Yeah, exactly. I mean at least a split between city screen and world screen would have been nice. Also maybe we would have a more vibrant ecosystem of interface mods that you can easily plug into each other now if it worked like that.
 
Since this is a Rhye mod, it's likely implemented in Assets/Python/CvMainInterface.py. That's not very helpful because this is a huge file that draw basically the entire game UI (by the way, why? I feel like the game would benefit from a more modular approach).
It is on my to do list along with dozens of other big projects.:lol: I want things that are like a city but not a city eg Forts and mining camps.
 
It is on my to do list along with dozens of other big projects.:lol: I want things that are like a city but not a city eg Forts and mining camps.
WTP has fort improvements. While they do not have city screens, they do act like cities for combat and culture purposes, though developed cities are far better at culture spreading. You don't have to add a city to a plot to add something like this, though there are multiple ways to do it and "the best" depends on how you want it to work with the game mechanics.

I suspect the hardest part about this is teaching the AI to value controlling forts and place forts at strategic locations. Maybe it will be easier to teach the AI if it just views forts as cities to conquer/defend.

If you ever do something about splitting up CvMainInterface.py, please do it in a public svn/git repository and tell us about it. I would be very interested in observing how somebody else will accomplish this task and how the game reacts to such changes.
 
WTP has fort improvements. While they do not have city screens, they do act like cities for combat and culture purposes, though developed cities are far better at culture spreading. You don't have to add a city to a plot to add something like this, though there are multiple ways to do it and "the best" depends on how you want it to work with the game mechanics.

I suspect the hardest part about this is teaching the AI to value controlling forts and place forts at strategic locations. Maybe it will be easier to teach the AI if it just views forts as cities to conquer/defend.

If you ever do something about splitting up CvMainInterface.py, please do it in a public svn/git repository and tell us about it. I would be very interested in observing how somebody else will accomplish this task and how the game reacts to such changes.
Already have StolenRays' (correct modder?) Super Forts mod that does this but I want Forts that are more strategic and able to be upgraded in special ways eg Weapons Arsenals or Training Camps and the like. It may turn out to be "not fun" to play but who knows it might. Basically have some special buildings that can only be built in forts. Yes the AI is always the problem.

I was going to start with Platyping's merged with BUG as a base. Basically getting the best of both. Platyping's efficiency improvements plus BUG's functionality. Platyping tidyed up a lot of the UI removing excess lines of code and moving some functions to a more logical place. It is fairly obvious the original coders were being paid by line.
 
Managed to fix the date on the interface screen thanks to the tips I was given on this thread. The bread crumb trail ultimately ended in the cvgametextmgr, and by reverting some of the edits Rhyes made it restored the date display. :woohoo:
 
I am working with History in the Making. So far I have mainly added units. The latest intended addition was Motorized Infantry from LoR. It worked, but resulted in the Upgrade Tree in the Civilopedia no longer showing. Looking around I also noticed that the Civilopedia does not show the Upgrade Tree when playing germany. Any ideas what the issue might be ?
 
I am working with History in the Making. So far I have mainly added units. The latest intended addition was Motorized Infantry from LoR. It worked, but resulted in the Upgrade Tree in the Civilopedia no longer showing. Looking around I also noticed that the Civilopedia does not show the Upgrade Tree when playing germany. Any ideas what the issue might be ?
Open My games/Beyond the Sword/CivilizationIV.ini
Here you make sure you have python errors enabled by setting it like this:
Code:
; Set to 1 for no python exception popups
HidePythonExceptions = 0
I'm far from certain this will help, but it's always the best place to start whenever something in the python display is missing.
Different question, same reply. Something in a python display isn't working, meaning the first step is to make the game show python errors to see if it will write something, which hints what goes wrong.
 
Does anyone have a python code for manipulating ProcessInfos?
What I'd like to have is: if player has a certain building than he than when building :culture: he converts not 50% :hammers: to :culture: but 100%
Can it be done?
I'm zero at coding.
 
I think so. You would have to create another process in ProcessInfo with 100% conversion rate. Then you need to make sure that it is impossible to run unless you have the required building. Fortunately the DLL exposes a "cannotMaintain" (maintain is what the code calls running a process) function to Python. You can implement it in Assets/Python/EntryPoints/CvGameInterface.py (I think). The function call comes with the city object and the process ID in question, so in case it's your new process you have to return True if the city lacks the required building.
 
I modified the CIV4UnitInfos.xml to change the Persian UU from a Chariot replacement to a Spearman replacement, but when I tested it, I couldn't build chariots and the spearman is still just an ordinary spearman. I can't figure out what else I need to do... can anyone help?
 
I modified the CIV4UnitInfos.xml to change the Persian UU from a Chariot replacement to a Spearman replacement, but when I tested it, I couldn't build chariots and the spearman is still just an ordinary spearman. I can't figure out what else I need to do... can anyone help?
You also need to make the appropriate adjustments in CIV4CivilizationsInfos.xml.
 
After I added a new civilization I am now getting the following python error?

File "RiseAndFall", line 126, in ?
AttributeError: 'NoneType' object has no attribute 'getTeam'

line 126 is teamBarbarian = gc.getTeam(pBarbarian.getTeam())

Cannot work out what I did could have caused this to happen. :confused:
 
AttributeError: 'NoneType' object has no attribute 'getTeam'

line 126 is teamBarbarian = gc.getTeam(pBarbarian.getTeam())
The problem is not that line, but the line where pBarbarian comes from. For some reason it has become a None reference (NULL pointer). Did you start a new game after adding the civilization? It's possible that the old civilization indexes are kept in the savegame, hence is out of sync with your new xml file.

And to be clear: I did not read the source file. It's more like a general reply to the error message and how the game engine works in general.
 
Yep I did start a new game. Not certain where the pBarbarian data comes from. Is there any method for working out where data is being pulled from?
 
I'm trying to make it so that a conquered city can at least work the first ring of tiles surrounding it, even if the nearest city that isn't mine has 10K culture. Can anyone tell me which files to edit? I'd rather not have to wipe out an entire civ just to conquer a few border cities.

I know it works when you make a civ capitulate, but that can be hard to do when the AI is being extremely persistent. :sad:
 
I'm trying to make it so that a conquered city can at least work the first ring of tiles surrounding it, even if the nearest city that isn't mine has 10K culture. Can anyone tell me which files to edit? [...]
Primarily calculateCulturalOwner in CvPlot.cpp. That's also where the master is given priority over its vassals. That would require recompilation of the DLL. Alternatively, it should be possible through Python to reduce foreign tile culture upon the conquest of a city or to add tile culture of the new owner, but I don't know how this would be done specifically. Maybe through onCityAcquiredAndKept in CvEventManager.py.
 
Back
Top Bottom