Quick Modding Questions Thread

Not without either modding the dll or having a kludge.
Theoretically, you could define a building that requires the AND bonuses as a prereq for the unit. The difficulty with this is whether the AI would create the building. You could give it a cost of 1 and a high iAIWeight I suppose, but it is all a bit messy. Then there is the issue of the city losing access to one resurce, but the building still existing so the bonus prereq appears to be being met, but isn't actually.
Jeez, that seems like such a random, gimmicky limitation of the system. I think I'll probably make stables require horses and then set the unit to require the other two resources and a stable.
 
Well, I'm making progress. Archid, I decided to take your suggestion and make a stable require horses, which is in turn required to build a unit that needs two other resources.

I'm now working on getting the mod to a play-testable state and am running into a crash that I don't have experience diagnosing. Basically, I am able to load the mod and start a game successfully, including playing the first turn as Player 1. But as soon as I hit end turn and it goes to the next civ, the game crashes. I am able to enter worldbuilder and place every unit and building without causing a crash before hitting end turn. But if I try to start a game as any civ other than Player 1, the game crashes before I get to play my first turn, but after the map finishes loading. It looks to me from the PythonDbg file that Player 1 does get to found their first city before the crash happens if I am not playing as them. Heck, I even have the autosave file from a game I start as Player 2, because the game crashes after the file is generated!

I've attached the log files here, but like I said, I don't have much experience reading these things. There are a few random graphics issues in the resmgr.log file, but nothing that I think would cause a crash. If anyone has some time, would they be willing to give it a look over?
 

Attachments

Last edited:
Crash during an AI turn – probably occurs in the (GameCore) DLL. Does your mod have its own DLL? If not, you could try it with a DLL that has assertions enabled (download), in windowed mode so that popups for failed assertions show up properly. With luck, a failed assertion will hint at the problem. The more reliable approach is to (install and) attach a debugger, but that's not easy to do the first time around. Enabling or inserting more logging code is probably not helpful. Can always revert changes systematically until the problem no longer occurs. :undecide:
 
Hi,

Is anyone aware of any python mapscript that makes use of the TerrainSchema tags; iTilesPer, iMinLandPercent, iUnique, iGroupRange & iGroupRand in bonus placement? Are they used anywhere?
 
CvMapGenerator in the DLL uses them for resource placement. Map scripts that override resource placement also use them, e.g. Totestra. In XML, they're used by Civ4BonusInfos.xml (obviously, I guess), and the DLL and Python access them via CvBonusInfo in the DLL.
 
If I were to remove resources or add new ones what would I need to modify to:
  1. Make existing mapscripts still work with my mod.
  2. Make them spawn some of those resources but not all of them.
 
If I were to remove resources or add new ones what would I need to modify to:
  1. Make existing mapscripts still work with my mod.
  2. Make them spawn some of those resources but not all of them.
Normal/most mapsripts will spawn all your new resources. It's basically just XML work.
 
Normal/most mapsripts will spawn all your new resources. It's basically just XML work.
Do I need to edit the mapscripts at all? Also how do I make a resource not spawn naturally?
 
They automatically spawn on their terrains or features or terrain feature combo. If none of those are defined, it won't spawn. Compare Stone, Rice, Horses and Hit Movies for example.
 
Well, I'm making progress. Archid, I decided to take your suggestion and make a stable require horses, which is in turn required to build a unit that needs two other resources.

I'm now working on getting the mod to a play-testable state and am running into a crash that I don't have experience diagnosing. Basically, I am able to load the mod and start a game successfully, including playing the first turn as Player 1. But as soon as I hit end turn and it goes to the next civ, the game crashes. I am able to enter worldbuilder and place every unit and building without causing a crash before hitting end turn. But if I try to start a game as any civ other than Player 1, the game crashes before I get to play my first turn, but after the map finishes loading. It looks to me from the PythonDbg file that Player 1 does get to found their first city before the crash happens if I am not playing as them. Heck, I even have the autosave file from a game I start as Player 2, because the game crashes after the file is generated!

I've attached the log files here, but like I said, I don't have much experience reading these things. There are a few random graphics issues in the resmgr.log file, but nothing that I think would cause a crash. If anyone has some time, would they be willing to give it a look over?
Like f1rpo says this is a dll issue and unless you have experience with compiling your own DLL the best way is to roll back your changes one by one to find out which one causes the issue. If you are not doing so already I strongly recommend that use a source control repository like GitHub to allow you to easily roll back your changes in future to make this task easier.
 
Okay, you knew this question was coming - surprisingly, I can only find piecemail tips and tricks in various threads, but not one cohesive tutorial, so alas, I return to here once more. With gamefonts!

It did work as I expected it to work:
Use RevolutionDCM's GameFont files, which luckily are already expanded a lot to have enough room to accomodate for more religions.
Tell ReligionInfos.xml the index (starting at 0) of the icons within the GameFont files.
And thus, rearrange the religious icons in the GameFont files to order them to your desire:
View attachment 644815
Then (a step I haven't done yet, because I first wanted to test if this would actually work), create new icons and fill in the blanks.

This works, in so far as that the logic I describe above seems to apply:
View attachment 644816

This does not work, in so far as that I now have white circles with black numbers floating around my screen for no discernible reason (see the tech bar, see the great people bar, see the Workshop's tooltip, see the Worker's movement):
View attachment 644819
The only thing I can think of, is that the default 'white circle with black number' includes a special marking, that tells the game 'look, there is an icon here', while me copying icons away replaces their former space with 'nothing', which makes the game interpret things incorrectly. If so - how would I functionally go about rearranging icons and adding new icons? Would I need to copy-paste every icon to the three rows above (with yields, commerce, and war/peace icons), because there the game seemingly handles completely white icons correctly, and so I can use that space to swap around my icons? Or can I just insert this theorised 'special marking' on the now-empty white icons? Or...?
I was browsing through the forums and spotted this post. The issue you have is the indexing of the TGA icons. I extracted the relevant code to use these large gamefont files a long time ago and made a standalone mod here that add a tag to the ReligionInfos and CorporationInfos to allow you to define the TGA index to use so you can pick and choose your images from the file
 
Hi all,

Has someone tried to apply the method provided here to make elements invisible?

https://forums.civfanatics.com/threads/tutorial-modifying-the-visibilty-of-weapons.312613/

In the .kf modifying part (about the end of the tutorial), I try to modify the "Num Controlled Blocks", but once done there s no refresh button as mentionned. Also when I try to paste the NiBoolInterpolator, it appears in the list but it is not aligned with the other elements, which means as far as I know that it is not set as a child of the NiControllerSequence. It drives me crazy :badcomp:. Someone to give me a clue?
 
Hi all,

Has someone tried to apply the method provided here to make elements invisible?

https://forums.civfanatics.com/threads/tutorial-modifying-the-visibilty-of-weapons.312613/

In the .kf modifying part (about the end of the tutorial), I try to modify the "Num Controlled Blocks", but once done there s no refresh button as mentionned. Also when I try to paste the NiBoolInterpolator, it appears in the list but it is not aligned with the other elements, which means as far as I know that it is not set as a child of the NiControllerSequence. It drives me crazy :badcomp:. Someone to give me a clue?
Just a random thought from someone who knows technically nothing about 3D modding: Are you using the same version of NifScope as the writer of that tutorial? Is it possible that some functions are changed since?
 
I had the same thought, but it would be hard for me to believe the lastest version would be a "downgrade" of the one used in this tuto...
 
How to set the entrance music back to Baba Yetu?
Also, I've been trying to create a multi-colored non-decal pole flag by following instructions in this link, but it's above my level so far. Could someone help me with this?
 
It's getting really weird. After I copied AS2D_OPENING_MENU_VANILLA to under MAIN_MENU_BEYOND_SWORD, the very 1st music I heard is this track I don't recognize. Then after some time it switches to these tracks, also strange to me.
Because the modified <Soundtrack> field was having the same value as that under MAIN_MENU_VANILLA, I opened civ4 vanilla, and sure enough, Baba Yetu played. How can they have 2 different behaviors with the same value? But I did notice that the root folder of vanilla 1.7's XML\Art doesn't have a civ4mainmenus file.
Then I tried copying the value under MAIN_MENU_CLASSICAL (AS2D_OPENING_MENU), but it reverts to that awful BtS song.
Disclaimer: I'm having MoreMusic installed. @<Nexus> , do you recognize any of the samples above?
 
Disclaimer: I'm having MoreMusic installed. @<Nexus> , do you recognize any of the samples above?
Yes, you are hearing my new main title music that comes with MoreMusic.
Just delete OpeningMenuCiv4.mp3 from yourmod\Assets\Sounds\Soundtrack and it will load the file with the same name from BtS folder.
 
Is there a way to get the icon for a specific unit from within Python?
I'm trying to display the starting XP values for unit classes in the Domestic Advisor using a specific unit as an icon in the title (so e.g. a UNIT_BRUTE for melee, UNIT_ARCHER for well, archers, etc).
I've seen unichr() being used for other icons, but I've so far found no way to actually reference a specific integer value to a specific graphic icon.
I've also tried to look through 100 icons at a time, but was hoping there would be an easier way than to go through thousands of possible entries.
 
Is there a way to get the icon for a specific unit from within Python?
I'm trying to display the starting XP values for unit classes in the Domestic Advisor using a specific unit as an icon in the title (so e.g. a UNIT_BRUTE for melee, UNIT_ARCHER for well, archers, etc).
I've seen unichr() being used for other icons, but I've so far found no way to actually reference a specific integer value to a specific graphic icon.
I've also tried to look through 100 icons at a time, but was hoping there would be an easier way than to go through thousands of possible entries.

I think you want getButton().
 
Back
Top Bottom