• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Quick Modding Questions Thread

For what I know, bAllowsNukes is for all players. But someone handling c++ might give you a more reliable answer.
I personally chose to make it the easy way turning Manhattan into a national wonder (military flavor set to 20 to ensure the warmongers build it) and make it required to build the weapons in unitinfo (it s been said somewhere here that AI doesn t like/understand well prereq building for unit production, but it seemed to work for me).
The better way is probably dll modification... :dunno:
 
What can I do to turn off the "Marching Feet" sound effect that plays when enemies approach your borders? This plays basically every turn in the early game when barbs are around.
 

Attachments

  • Untitled.png
    Untitled.png
    4.3 MB · Views: 48
How does setting up a DLL compiler work if using a mod's source files? I've messed around a little bit with the base BTS dll before and haven't had any trouble with the compiler thanks to Leoreth's guide. Is there a guide out there covering what to do if I'm working with a mod with it's own dll and no project file included?
 
Thanks Ifgr. I'm not sure what my exact issue was, I was having trouble reproducing the same error twice but after adding the missing extra project files and fixing an issue with the makefile directory targeting I've got DLL that succesfully builds and a game that starts afterwards. I'm working with your MNAI code pulled from here and I'm getting loads of assert errors when I try to load a map. The errors seem to be to do with the various civs and features added in ExtraModMod (ie. no xml for the mechanos, or deep ocean). Is this expected? The file I've downloaded is called "more-naval-ai-master". The map load fine if I ignore all errors.
 
Some mapscripts are compatible with multiple mods and try adding features from other mods (in this case RifE/AoE, not Extramodmod). The popups shouldn't be an issue, it's just the script checking whether these features are available.
If you have more questions related to MNAI, better take it to the thread, though. :)
 
  • Like
Reactions: Set
So, I was looking at the EraInfos.xml and noticed that it has an "iResearchPercent" tag just like the GameSpeedInfos.xml, and that the number varies a bit based on era by default. The modding wiki's description is a bit vague, does someone know EXACTLY what this does? Does this apply individually to anyone in that era, altering that player's research speed accordingly, or does it apply to everyone once the first player reaches that era? Or it is something weird like an overwrite to the game speed one when it is the starting era or something? I just want to be sure, because my first thought is that if it works how I assume it does then it could be a convenient way to slow research back down a bit for the later eras where I usually start flying through the tech tree, even after making a slower custom game speed (which makes the early game portion perfect), without having to go through and individually increase the cost of the later techs. Interestingly, the game's default seems to be to drop this number by 10 percent for each era, which I assume would mean that researching techs gets cheaper for each era?

TLDR if I set the EraInfos.xml iResearchPercent to 150 for the industrial era listing, for example, does that mean that while I am in industrial era all research will cost half again as much as default?
 
Last edited:
So, I'm new to modding, but have some programming experience. Is it possible to add lua libraries to a mod? I'm interested in creating an interface for training ML agents to replace the AI in the game, so I need to be able to communicate the game state to an external program. this would be pretty easy with lua-http for example, but I suspect it won't be that simple with Civ's Lua implementation? A simpler option would be to keep writing to and reading the log file, but that's bottleneck waiting to happen.
 
@<Nexus>: It seems that the default is hardcoded in the EXE to be the 3rd enumerator (i.e. corresponding to the integer 2) in GlobeLayerUnitOptionTypes. I've worked around this as follows (there might be a simpler solution, but that's what I came up with at the time):
in CvEnums.h
Spoiler :
Code:
enum GlobeLayerUnitOptionTypes
{
	SHOW_ALL_MILITARY,
	SHOW_TEAM_MILITARY,
	/*  f1rpo: The third position is the default, which, apparently, cannot
		be changed properly with the SDK. Put a dummy option in that position,
		have it behave like SHOW_ENEMIES and hide it from the player
		(through CvMainInterface.py). */
	GLOBE_LAYER_UNIT_DUMMY,
	SHOW_ENEMIES_IN_TERRITORY,
	SHOW_ENEMIES,
	SHOW_PLAYER_DOMESTICS,

#ifdef _USRDLL
	NUM_UNIT_OPTION_TYPES
#endif
};
in CvPlayer.cpp
Spoiler :
Code:
void CvPlayer::getUnitLayerColors(GlobeLayerUnitOptionTypes eOption, std::vector<NiColorA>& aColors, std::vector<CvPlotIndicatorData>& aIndicators) const
{
	// <f1rpo>
	if (eOption == GLOBE_LAYER_UNIT_DUMMY)
		eOption = SHOW_ENEMIES; // </f1rpo>
in CvMainInterface.py, method updateGlobeviewButtons
Spoiler :
Code:
			# Set up options pane
			if bHasOptions:
				kLayer = kGLM.getLayer(iCurrentLayerID)

				iCurY = iY
				iNumOptions = kLayer.getNumOptions()
				iCurOption = kLayer.getCurrentOption()
				iMaxTextWidth = -1
				# <f1rpo> (A little more robust than testing for a specific iCurrentLayerID)
				szLayerName = kGLM.getLayer(iCurrentLayerID).getName()[:3]
				bUnitLayer = (szLayerName == "UNI") # </f1rpo>
				for iTmp in range(iNumOptions):
					iOption = iTmp # iNumOptions - iTmp - 1
					# <f1rpo> Skip dummy option (see CvEnums.h)
					if bUnitLayer and iOption == 2:
						continue # </f1rpo>
					szName = "GlobeLayerOption" + str(iOption)
					szCaption = kLayer.getOptionName(iOption)
					if (iOption == iCurOption
							# f1rpo: Highlight "All Enemies" option when the default (2) is selected.
							# This is the case when none of the options has been clicked yet.
							or (bUnitLayer and iCurOption == 2 and iOption == 4)):
						szBuffer = "  <color=0,255,0>%s</color>  " % (szCaption)
					else:
						szBuffer = "  %s  " % (szCaption)
					iTextWidth = CyInterface().determineWidth( szBuffer )
(Personally, I've set the default to SHOW_ALL_MILITARY, but the snippets above should set it to SHOW_ENEMIES.)
 
I've newer modded techs before so I am not quite sure how AND and OR conditions work. Like I know how AND works. You have to have ALL of the AND condition techs. But what about OR?

If I have 5 OR tech requirements than do I just need one of those before I can research a tech? What if I have 2 AND requirement and 3 OR requirements? Does that mean I just need all the ANDs and 1 of the OR's. That is how I think it works. But it's been too long since I played a game of CIV due to modding that I forgot. :)
 
That is exactly how it should work. :)
 
I thought so. I just needed to make sure.
 
If I create a very basic mod, that doesn't really change the Civ 4 BtS gameplay, how can I remove some of the standard civs and leaders without getting error messages?

Basically, I've just added a custom civ that's a kind of "merger" of three standard civs, and now I want to remove those original three civs. But when I try that, I get error messages, sometimes a whole lot of them.
 
If I create a very basic mod, that doesn't really change the Civ 4 BtS gameplay, how can I remove some of the standard civs and leaders without getting error messages?

Basically, I've just added a custom civ that's a kind of "merger" of three standard civs, and now I want to remove those original three civs. But when I try that, I get error messages, sometimes a whole lot of them.
This is too vague. Which error messages do you get? Bring us screenshots.
Some random events (involving python) are specific to civs, this may be one reason. Did you delete those events? Did you delete their unique units/building? And so on...
Considering this is a personal mod you won t share, the easiest way would be not to remove those civs and not to play with random civs.
 
  • Like
Reactions: R82
If I create a very basic mod, that doesn't really change the Civ 4 BtS gameplay, how can I remove some of the standard civs and leaders without getting error messages?

Basically, I've just added a custom civ that's a kind of "merger" of three standard civs, and now I want to remove those original three civs. But when I try that, I get error messages, sometimes a whole lot of them.
You basically need to track down each XML error and remove the reference to the civ. For example, I believe there are a couple events in Civ4EventInfos.xml that are civ specific, including one for America. That event has a reference to the CIVILIZATION_AMERICA XML entry which you may have deleted. The game looks for an XML entry and then throws an error when it can't find it. Civ4LeaderheadInfos.XML and Civ4ArtDefinesCivilizations may be another place with references to civilizations. Sometimes (not always, seems to depend on the kind and magnitude of the error), when the XML throws an error, it will be unable to read the entire affected file. This throws off a chain reaction of errors, ie. Because the XML in LeaderheadInfos is looking for CIVILIZATION_AMERICA and can't find it, then the game fails to load LeaderheadInfos, then any references to Leaderheads elsewhere in the XML also fail, potentially setting off more chain reactions. Look through the first few errors and track down the file and change the XML reference accordingly. A
 
You basically need to track down each XML error and remove the reference to the civ. For example, I believe there are a couple events in Civ4EventInfos.xml that are civ specific, including one for America. That event has a reference to the CIVILIZATION_AMERICA XML entry which you may have deleted. The game looks for an XML entry and then throws an error when it can't find it. Civ4LeaderheadInfos.XML and Civ4ArtDefinesCivilizations may be another place with references to civilizations. Sometimes (not always, seems to depend on the kind and magnitude of the error), when the XML throws an error, it will be unable to read the entire affected file. This throws off a chain reaction of errors, ie. Because the XML in LeaderheadInfos is looking for CIVILIZATION_AMERICA and can't find it, then the game fails to load LeaderheadInfos, then any references to Leaderheads elsewhere in the XML also fail, potentially setting off more chain reactions. Look through the first few errors and track down the file and change the XML reference accordingly. A
Thank you, I think that worked. I didn't remove America. The three civs I removed after merging some of their aspects into one are the Inca, Mali, and Sumeria. Turns out all the reported errors were in the assets/xml/GameInfo/Civ4Diplomacyinfos.xml file. Now that I've worked a bit on that file, everything seems to work well. Though I guess I'll probably have to play a full game in the mod to be sure.
 
Back
Top Bottom