Quick Modding Questions Thread

I'm adding a feature to allow obsolete units to rush construction of their upgrades, using the same xml tags as the Great Engineer. the new code is in CvUnit::canHurry and it works:

Spoiler :
Code:
bool CvUnit::canHurry(const CvPlot* pPlot, bool bTestVisible) const
{
	if (isDelayedDeath())
	{
		return false;
	}

	CvCity* pCity;

	if (getHurryProduction(pPlot) == 0)
	{
		return false;
	}

	pCity = pPlot->getPlotCity();

	if (pCity == NULL)
	{
		return false;
	}

	if (pCity->getProductionTurnsLeft() == 1)
	{
		return false;
	}

	if (!bTestVisible)
	{
		if (getUnitType() == GC.getInfoTypeForString("UNIT_ENGINEER"))
		{
			if (!(pCity->isProductionBuilding()))
			{
				return false;
			}
		}
		[COLOR="Red"]// srpt unit retrain[/COLOR]
		else
		{
			if (!(pCity->isProductionUnit()))
			{
				return false;
			}
			UnitTypes eProductionUnit = pCity->getProductionUnit();
			if (eProductionUnit != NULL)
			{
				bool bUpgrade = canUpgrade(eProductionUnit, true);
				if (!(bUpgrade))
				{
					return false;
				}
			}
		}
		[COLOR="Red"]//srpt end[/COLOR]
	}

	return true;
}

the mission button displays properly and is greyed-out in the proper cases but I cannot get the text tooltip to follow. here is the code from CvDLLWidgetData::parseActionHelp:

Spoiler :
Code:
			else if (GC.getActionInfo(widgetDataStruct.m_iData1).getMissionType() == MISSION_HURRY)
			{
				if (pMissionCity != NULL)
				{
					if (!(pMissionCity->isProductionBuilding()))
					{
						szBuffer.append(NEWLINE);
						szBuffer.append(gDLL->getText("TXT_KEY_ACTION_BUILDING_HURRY"));
					}
					else
					{
						pSelectedUnitNode = gDLL->getInterfaceIFace()->headSelectionListNode();

						while (pSelectedUnitNode != NULL)
						{
							pSelectedUnit = ::getUnit(pSelectedUnitNode->m_data);

							if (pSelectedUnit->canHurry(pMissionPlot, true))
							{
								const wchar* pcKey = NULL;
								if (NO_PROJECT != pMissionCity->getProductionProject())
								{
									pcKey = GC.getProjectInfo(pMissionCity->getProductionProject()).getTextKeyWide();
								}
								else if (NO_BUILDING != pMissionCity->getProductionBuilding())
								{
									pcKey = GC.getBuildingInfo(pMissionCity->getProductionBuilding()).getTextKeyWide();
								}
								else if (NO_UNIT != pMissionCity->getProductionUnit())
								{
									pcKey = GC.getUnitInfo(pMissionCity->getProductionUnit()).getTextKeyWide();
								}
								if (NULL != pcKey && pSelectedUnit->getHurryProduction(pMissionPlot) >= pMissionCity->productionLeft())
								{
									szBuffer.append(NEWLINE);
									szBuffer.append(gDLL->getText("TXT_KEY_ACTION_FINISH_CONSTRUCTION", pcKey));
								}
								else
								{
									szBuffer.append(NEWLINE);
									szBuffer.append(gDLL->getText("TXT_KEY_ACTION_EXTRA_CONSTRUCTION", pSelectedUnit->getHurryProduction(pMissionPlot), pcKey));
								}
								break;
							}

							pSelectedUnitNode = gDLL->getInterfaceIFace()->nextSelectionListNode(pSelectedUnitNode);
						}
					}
				}
			}

my first problem was using GC.getInfoTypeForString("UNIT_ENGINEER"). it compiled but caused an unidentified C++ exception when the unit was selected.

I tried another version using the "if (pSelectedUnit->canHurry(pMissionPlot, true))" statement as the deciding factor:

Spoiler :
Code:
			else if (GC.getActionInfo(widgetDataStruct.m_iData1).getMissionType() == MISSION_HURRY)
			{
				if (pMissionCity != NULL)
				{
					pSelectedUnitNode = gDLL->getInterfaceIFace()->headSelectionListNode();

					while (pSelectedUnitNode != NULL)
					{
						pSelectedUnit = ::getUnit(pSelectedUnitNode->m_data);

						[COLOR="Red"]if (pSelectedUnit->canHurry(pMissionPlot, true))[/COLOR]
						{
							const wchar* pcKey = NULL;
							if (NO_PROJECT != pMissionCity->getProductionProject())
							{
								pcKey = GC.getProjectInfo(pMissionCity->getProductionProject()).getTextKeyWide();
							}
							else if (NO_BUILDING != pMissionCity->getProductionBuilding())
							{
								pcKey = GC.getBuildingInfo(pMissionCity->getProductionBuilding()).getTextKeyWide();
							}
							else if (NO_UNIT != pMissionCity->getProductionUnit())
							{
								pcKey = GC.getUnitInfo(pMissionCity->getProductionUnit()).getTextKeyWide();
							}
							if (NULL != pcKey && pSelectedUnit->getHurryProduction(pMissionPlot) >= pMissionCity->productionLeft())
							{
								szBuffer.append(NEWLINE);
								szBuffer.append(gDLL->getText("TXT_KEY_ACTION_FINISH_CONSTRUCTION", pcKey));
							}
							[COLOR="Red"]else[/COLOR]
							{
								szBuffer.append(NEWLINE);
								szBuffer.append(gDLL->getText("TXT_KEY_ACTION_EXTRA_CONSTRUCTION", pSelectedUnit->getHurryProduction(pMissionPlot), pcKey));
							}
						}
						else
						{
							szBuffer.append(NEWLINE);
							szBuffer.append(gDLL->getText("TXT_KEY_ACTION_BUILDING_HURRY"));
						}
						break;

						pSelectedUnitNode = gDLL->getInterfaceIFace()->nextSelectionListNode(pSelectedUnitNode);
					}
				}
			}

but it seemed to answer that "canHurry" call incorrectly:

Spoiler :

the button says no but the text says yes

can anyone help?
 
What do you mean by "steam version"?

I use to have the boxed version on my pc but my windows 8 upgrade destroyed it, so I bought the Steam Version. You know Steam right? Anyway, I don't see the DLL files anywhere in my Steam version install. I found a link someone posted for the DLL but is there an Official place to download the DLL files?
 
Are you referring to the source CvGameCore C++ files, or perhaps the compiling/'solution' setup (i.e. the crap you have to reference into the SDK before compiling)?


And yes, I use Steam for Civ4 :mischief:, but you might want to be a little more specific/descriptive in your request (a pin-point Google search could get you your answer in about 30 seconds.... no need to wait for us to figure out what you're trying to ask).
 
Are you referring to the source CvGameCore C++ files, or perhaps the compiling/'solution' setup (i.e. the crap you have to reference into the SDK before compiling)?


And yes, I use Steam for Civ4 :mischief:, but you might want to be a little more specific/descriptive in your request (a pin-point Google search could get you your answer in about 30 seconds.... no need to wait for us to figure out what you're trying to ask).

Yes, the source CvGameCore C++ files aka the SDK and dll? Where do you go to download them if you own the Steam version?
 
Just a quick question regarding a custom made unit. If I have a unit with 1.5k Vertices, is that WAY too much for older systems to handle?
 
Hi all,

Does anyone know where the parameters/data for technologies unlocking tile improvements are stored? (i.e. Calendar -> Unlocks plantation).

Interestingly enough, it's not located in either Civ4ImprovementInfo.xml nor Civ4Technologies.xml.... perhaps hardcoded into the DLL?
 
they have a few things like that, it is fun to find them and just order why?!?

My personal favourite is the math used for ranged and air combat. They added a global defines input to 'tweak it' yet the actual dll math you use means that you really only get 1 of two things happen, either the normal amount of damage, or an absolutely massive amount of damage!

We changed that quick for FTTW when we figured out how! :D
 
buildinfos in unti folder I think it is...

it is one of those weird ones that firaxis did.

essentially technology unlocks the ability for your unit to have the build function, rather than unlocking the improvement itself

Many thanks! (Firaxis, WTH is it doing there?! :confused::eek::twitch:)
It's to allow one type of unit to build an improvement while another that normally can build some types of improvements might not be able to. It allows one type of unit that can build an improvement and another type of unit that can build the improvement to be able to build it at differing tech access points. The difference between the tech qualification for an improvement and it's defined builds can make it possible for improvements to upgrade before they can be built.

Case in point: in core bts, towns above hamlet level start upgrading to the next level as soon as the next level is tech unlocked but you can never build the higher levels with a worker.
 
Hi.

I tried to create a feature that automatically appears on all Peaks by
1: Copying forest in featureinfo,
2: changing name to FEATURE_PEAK (Peak, Peak, artdef_forest).
3: Terrainbooleans Terrain Peak only.
4: iAppearance 10000 (100%).
(5: idefense 75, iturndamage 35, imovement 3)

However, while the feature shows up in civilopedia, when I launc the game, nothing is there on peaks. The units I made capable to pass impassable (melee, archer, gun, explorer) could enter on peaks, but travel at the cost of 1 (instead of 3), and take no damage when left there, so the feature just ain't there. Why?
 
Probably because Peak is not really a terrain. There is a thread below started by Herostratus (21 Sept) which might give you some info.

Anyway, here is God-Emperor's conclusion about Peaks...
 
Thanks for answer, nice to know I did not just mess something up. They really, really did not want the peaks easy to use (as the terraininfo of peaks only affects graphics), it seems.
 
Back
Top Bottom