Quick Modding Questions Thread

I've added 4 religions to my mod for a total of 11 and everything is working fine except that all the religions not yet founded are founded on turn 6 of every game by civs that don't have the techs for them. the mod is xml and graphics only so far. can anyone suggest why this might be happening? would a debug dll tell me what was happening?
 
I moved them to random later techs to make sure no one was researching them. The techs are Scientific Method, Military Science and Future Tech. As I said, all the unfounded religions found on turn 6 of every game, founded by 3 different civs. Also I'm not totally sure but I think they are always founded by weak, 1-city civs. This is a scenario where some civs start with a few cities and some with just one. No one starts with any settlers so the 1-city civs stay that way for a while.
 
I'm thinking that there is some line of code in the Event Manager module prohibiting religion founding before the sixth turn. But it might have been something entirely different I'm recollecting... :p (Like something to do with victory, or something.)
 
BTW, I figured out Sephi's advice on my own, but thanks.
 
I'm thinking that there is some line of code in the Event Manager module prohibiting religion founding before the sixth turn. But it might have been something entirely different I'm recollecting... :p (Like something to do with victory, or something.)

From the C++ code of CvGame::doHolyCity():

Code:
	if (getElapsedGameTurns() < 5 && !isOption(GAMEOPTION_ADVANCED_START))
	{
		return;
	}

Very much hard-coded in the DLL.
 
@ asaf: so that explains why its happening on turn 6, but not why its happening, correct? would a debug dll show the founding? (also thank you so much for your dll compiling tutorial, I was completely frustrated til then & have had no problems since)

@the_j: I took away everyone's starting techs and made the founding techs of the founded religions to "NONE" and still all 3 unfounded religions found on turn 6.
 
Well, since the religions have no pre-req techs, there's nothing to prevent them from appearing, so when the first check is done on turn 6 they get founded.

(And you're very much welcome. I'm glad it was useful).
 
the religions that are being founded on turn 6 do have tech requirements. the ones I changed to NONE are the ones already founded at the start of the scenario.
 
Well, if no team has any of these techs then it shouldn't happen.
I suggest you try debugging this to see what's happening there. Place a breakpoint in CvGame::doHolyCity() after the turn counter condition.
 
the religions that are being founded on turn 6 do have tech requirements. the ones I changed to NONE are the ones already founded at the start of the scenario.

I'd say that still could be the source of the problems.
Due to the "free religion" option in BtS, there can be quite some strange phenomenons when religions are founded in an unusual way, so i suggest just putting something into the tech prereqs (future tech, whatever) just to get rid of that possible cause.
If it does not change anything...well...then nothing is lost.
 
I'd say that still could be the source of the problems.
Due to the "free religion" option in BtS, there can be quite some strange phenomenons when religions are founded in an unusual way, so i suggest just putting something into the tech prereqs (future tech, whatever) just to get rid of that possible cause.
If it does not change anything...well...then nothing is lost.

I tried that future tech trick as well because that's what the Charlemagne scenerio does, but religions were still being founded in the same manner.
 
well I got the debugger running (thanks once again to asaf's tutorial) but my poor excuse for a computer freezes at the breakpoint. (yes I know I need a new computer and I will get one soon I promise) I tried it with civ in fullscreen and windowed. I'm wondering if I put the breakpoint in exactly the right spot, since I don't know much about C++. Here is the relevant area (in CvGame):

Code:
void CvGame::doHolyCity()
{
	PlayerTypes eBestPlayer;
	TeamTypes eBestTeam;
	long lResult;
	int iValue;
	int iBestValue;
	int iI, iJ, iK;

	lResult = 0;
	gDLL->getPythonIFace()->callFunction(PYGameModule, "doHolyCity", NULL, &lResult);
	if (lResult == 1)
	{
		return;
	}

	if (getElapsedGameTurns() < 5 && !isOption(GAMEOPTION_ADVANCED_START))
	{
		return;
	}

	int iRandOffset = getSorenRandNum(GC.getNumReligionInfos(), "Holy City religion offset");
	for (int iLoop = 0; iLoop < GC.getNumReligionInfos(); ++iLoop)
	{
		iI = ((iLoop + iRandOffset) % GC.getNumReligionInfos());

		if (!isReligionSlotTaken((ReligionTypes)iI))
		{
			iBestValue = MAX_INT;
			eBestTeam = NO_TEAM;

			for (iJ = 0; iJ < MAX_TEAMS; iJ++)
			{
				if (GET_TEAM((TeamTypes)iJ).isAlive())
				{
					if (GET_TEAM((TeamTypes)iJ).isHasTech((TechTypes)(GC.getReligionInfo((ReligionTypes)iI).getTechPrereq())))
					{
						if (GET_TEAM((TeamTypes)iJ).getNumCities() > 0)

I was putting the breakpoint on the line beginning with "int" after the elapsed turns and advanced start line. If there is a better place please let me know.



In the meantime I am trying various tests. So far if all the religions are unfounded at the start and no one starts with any techs nothing is founded on turn 6. I will continue to try other variables. I'm attaching the mod (without most of the unit art so its smaller, red blobs will be everywhere). If anyone could find it in their heart to degug it for six turns with a breakpoint at one of those lines I'd be forever in their debt. The mod uses an unaltered dll and the only python so far is a scrolling religion screen. Yes I tested it without the extra python and the bug still occurs.
 

Attachments

I'm having a problem that Civ4 claims is in XML, but isn't.

Assert Failed

File: CvGlobals.cpp
Line: 3493
Expression: strcmp(szType, "NONE")==0 || strcmp(szType, "")==0
Message: info type TERRAIN_GRASS not found, Current XML file is: xml\GameInfo/CIV4ForceControlInfos.xml

----------------------------------------------------------

CvGlobals.cpp 3493 is CvGlobals::GetInfoTypeForString(const char* szType, bool hideAssert) const. How helpful. Anyway, I looked at the XML file, it's really short, so here it is:

Code:
<?xml version="1.0"?>
<!-- edited with XMLSPY v2004 rel. 2 U (http://www.xmlspy.com) by Firaxis Games (Firaxis Games) -->
<!-- Sid Meier's Civilization 4 -->
<!-- Copyright Firaxis Games 2005 -->
<!-- -->
<!-- ForceControlInfos - This structure describes the name for each multiplayer option. -->
<Civ4ForceControlInfos xmlns="x-schema:CIV4GameInfoSchema.xml">
	<ForceControlInfos>
		<ForceControlInfo>
			<Type>FORCECONTROL_SPEED</Type>
			<Description>TXT_KEY_FORCE_CONTROL_SPEED</Description>
			<Help>TXT_KEY_FORCE_CONTROL_SPEED_HELP</Help>
			<bDefault>0</bDefault>
		</ForceControlInfo>
		<ForceControlInfo>
			<Type>FORCECONTROL_HANDICAP</Type>
			<Description>TXT_KEY_FORCE_CONTROL_HANDICAP</Description>
			<Help>TXT_KEY_FORCE_CONTROL_HANDICAP_HELP</Help>
			<bDefault>0</bDefault>
		</ForceControlInfo>
		<ForceControlInfo>
			<Type>FORCECONTROL_OPTIONS</Type>
			<Description>TXT_KEY_FORCE_CONTROL_OPTIONS</Description>
			<Help>TXT_KEY_FORCE_CONTROL_OPTIONS_HELP</Help>
			<bDefault>0</bDefault>
		</ForceControlInfo>
		<ForceControlInfo>
			<Type>FORCECONTROL_VICTORIES</Type>
			<Description>TXT_KEY_FORCE_CONTROL_VICTORIES</Description>
			<Help>TXT_KEY_FORCE_CONTROL_VICTORIES_HELP</Help>
			<bDefault>0</bDefault>
		</ForceControlInfo>
		<ForceControlInfo>
			<Type>FORCECONTROL_MAX_TURNS</Type>
			<Description>TXT_KEY_FORCE_CONTROL_MAX_TURNS</Description>
			<Help>TXT_KEY_FORCE_CONTROL_MAX_TURNS_HELP</Help>
			<bDefault>0</bDefault>
		</ForceControlInfo>
		<ForceControlInfo>
			<Type>FORCECONTROL_MAX_CITY_ELIMINATION</Type>
			<Description>TXT_KEY_FORCE_CONTROL_MAX_CITY_ELIMINATION</Description>
			<Help>TXT_KEY_FORCE_CONTROL_MAX_CITY_ELIMINATION_HELP</Help>
			<bDefault>0</bDefault>
		</ForceControlInfo>
		<ForceControlInfo>
			<Type>FORCECONTROL_ADVANCED_START</Type>
			<Description>TXT_KEY_FORCE_ADVANCED_START</Description>
			<Help>TXT_KEY_FORCE_ADVANCED_START</Help>
			<bDefault>0</bDefault>
		</ForceControlInfo>
	</ForceControlInfos>
</Civ4ForceControlInfos>

No mention of TERRAIN_GRASS, or anything else non-text. I tried debugging, setting a breaktrap at getInfoTypeForString, triggering only when szType == "TERRAIN_GRASS". It didn't break. Anyone have any advice?
 
Back
Top Bottom