What would cause...

Again thank you all gentlemen, I have no idea what was causing the CTD's, but last night I decided on a whim to restart that part of the code from square one (read: the first post). Anyway, it works perfectly now with only a minor graphical quibble (after the unit "dies" it becomes just a flag with 0.0/X strength until the beginning of the next turn). If you're interested this is the code as it stands now.

::updateCombat (like above this is only one of the two basically identical entries)
Spoiler :
Code:
			bool bSurvivor = false;
			if (getSurvivorChance() > 0)
			{
				if (GC.getGameINLINE().getSorenRandNum(100, "Too Badass Check") <= getSurvivorChance())
				{
					bSurvivor = true;
					setSurvivor(true);
					jumpToNearestValidPlot();
				}
			}

			if ((!bSurvivor) && (isOneUp()))
			{
				setCanRespawn(true);
			}

::kill
Spoiler :
Code:
	m_bDeathDelay = true;
	if (isCanRespawn())
	{
		CvCity* pCapitalCity = GET_PLAYER(getOwnerINLINE()).getCapitalCity();
		setXY(pCapitalCity->getX_INLINE(), pCapitalCity->getY_INLINE(), false, false, false);
		changeDamage(-getDamage());
		changeOneUpCount(-1);
		CvWString szBuffer = gDLL->getText("TXT_KEY_MISC_BATTLEFIELD_EVAC", getNameKey());
		gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_POSITIVE_DINK", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), getX_INLINE(), getY_INLINE());
		m_bDeathDelay = false;
		return;
	}

	if (isSurvivor())
	{
		changeDamage(-getDamage());
		setDamage(GC.getMAX_HIT_POINTS() -(getSurvivorChance() / 1000));
		CvWString szBuffer = gDLL->getText("TXT_KEY_MISC_YOUR_UNIT_IS_HARDCORE", getNameKey());
		gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_POSITIVE_DINK", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), getX_INLINE(), getY_INLINE());
		m_bDeathDelay = false;
		return;
	}

and finally in ::doTurn
Spoiler :
Code:
	if (isCanRespawn())
	{
		setCanRespawn(false);
	}

	if (isSurvivor())
	{
		setSurvivor(false);
	}

While I have your attention, I would like to ask you how I would go about fixing a notification that informs me that 3498738957 [NUM:Units:Unit] have been healed. This is the code I'm referring to.

This is in ::updateCombat and is similar to the code above in that it is one of two basically identical sections.
Spoiler :
Code:
			int iUnitsHealed = 0;
			if (pDefender->getVictoryAdjacentHeal() > 0)
			{
				if (GC.getGameINLINE().getSorenRandNum(100, "Field Hospital Die Roll") <= pDefender->getVictoryAdjacentHeal())
				{
					int iI;
					for (iI = 0; iI < NUM_DIRECTION_TYPES; iI++)
					{
						CvPlot* pLoopPlot = plotDirection(pPlot->getX_INLINE(), pPlot->getY_INLINE(), ((DirectionTypes)iI));
						if (pLoopPlot != NULL)
						{
							if (pLoopPlot->area() == pPlot->area())
							{
								CLLNode<IDInfo>* pUnitNode = pLoopPlot->headUnitNode();

								while (pUnitNode != NULL)
								{
									CvUnit* pLoopUnit = ::getUnit(pUnitNode->m_data);
									pUnitNode = pLoopPlot->nextUnitNode(pUnitNode);

									if (pLoopUnit->getTeam() == getTeam())
									{
										iUnitsHealed++;
										pLoopUnit->doHeal();
									}
								}
							}
						}
					}
				}
			}

			bool bDefenderHealed = false;
			if (pDefender->getVictoryStackHeal() > 0)
			{
				if (GC.getGameINLINE().getSorenRandNum(100, "Field Surgeon Die Roll") <= pDefender->getVictoryStackHeal())
				{
					bDefenderHealed = true;
					CLLNode<IDInfo>* pUnitNode = pPlot->headUnitNode();

					while (pUnitNode != NULL)
					{
						CvUnit* pLoopUnit = ::getUnit(pUnitNode->m_data);
						pUnitNode = pPlot->nextUnitNode(pUnitNode);

						if (pLoopUnit->getTeam() == getTeam())
						{
							iUnitsHealed++;
							pLoopUnit->doHeal();
						}
					}
				}
			}

			if (!bDefenderHealed)
			{
				if (pDefender->getVictoryHeal() > 0)
				{
					if (GC.getGameINLINE().getSorenRandNum(100, "Field Medic Die Roll") <= pDefender->getVictoryHeal())
					{
						pDefender->doHeal();
					}
				}
			}

			if (iUnitsHealed > 1)
			{
				CvWString szBuffer = gDLL->getText("TXT_KEY_MISC_ENEMY_FIELD_MEDIC_DEFENDERS", GET_PLAYER(pDefender->getOwnerINLINE()).getCivilizationAdjective());
				gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_COMBAT", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pDefender->getX_INLINE(), pDefender->getY_INLINE());

				szBuffer = gDLL->getText("TXT_KEY_MISC_FIELD_MEDIC_DEFENDERS", getNameKey(), iUnitsHealed);
				gDLL->getInterfaceIFace()->addMessage(pDefender->getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_POSITIVE_DINK", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pDefender->getX_INLINE(), pDefender->getY_INLINE());
			}

Thank you for your help as well as your time and consideration in reading this.
 
You are using the same XML text entry, but the first time you call it you only pass the civilization's adjective and the second time you pass a name key and number of units.
 
They're different, I've bolded the difference

Spoiler :
Code:
if (iUnitsHealed > 1)
			{
				CvWString szBuffer = gDLL->getText("TXT_KEY_MISC_[B]ENEMY[/B]_FIELD_MEDIC_DEFENDERS", GET_PLAYER(pDefender->getOwnerINLINE()).getCivilizationAdjective());
				gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_COMBAT", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pDefender->getX_INLINE(), pDefender->getY_INLINE());

				szBuffer = gDLL->getText("TXT_KEY_MISC_FIELD_MEDIC_DEFENDERS", getNameKey(), iUnitsHealed);
				gDLL->getInterfaceIFace()->addMessage(pDefender->getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_POSITIVE_DINK", MESSAGE_TYPE_INFO, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pDefender->getX_INLINE(), pDefender->getY_INLINE());
			}

If I mapped it like in ::collateralCombat, do you think that would help?
 
Wow, I compared them a couple times and never saw ENEMY. :confused:

I need to see TXT_KEY_MISC_FIELD_MEDIC_DEFENDERS to tell what's going wrong. My guess is that you have the 1 and 2 swapped. Also, "[NUM:Units:Unit]" should have a 2 after NUM IIRC. With getText() you must put the index of the parameters in the text string.
 
Here are all four entries which are related to the VictoryHealChances

Spoiler :
Code:
  <TEXT>
    <Tag>TXT_KEY_MISC_FIELD_MEDIC_ATTACKERS</Tag>
    <English>General, our Field Medics ( %s1_UnitName ) have seen to our wounded and ensured that the attack can be pressed! ( %d1_Num [NUM:Unit:Units] healed )</English>
    <French>General, our Field Medics ( %s1_UnitName ) have seen to our wounded and ensured that the attack can be pressed! ( %d1_Num [NUM:Unit:Units] healed )</French>
    <German>General, our Field Medics ( %s1_UnitName ) have seen to our wounded and ensured that the attack can be pressed! ( %d1_Num [NUM:Unit:Units] healed )</German>
    <Italian>General, our Field Medics ( %s1_UnitName ) have seen to our wounded and ensured that the attack can be pressed! ( %d1_Num [NUM:Unit:Units] healed )</Italian>
    <Spanish>General, our Field Medics ( %s1_UnitName ) have seen to our wounded and ensured that the attack can be pressed! ( %d1_Num [NUM:Unit:Units] healed )</Spanish>
  </TEXT>
  <TEXT>
    <Tag>TXT_KEY_MISC_FIELD_MEDIC_DEFENDERS</Tag>
    <English>General, our Field Medics ( %s1_UnitName ) have seen to our wounded ( %d1_Num [NUM:Unit:Units] healed ), the enemy troops haven't a chance at victory!</English>
    <French>General, our Field Medics ( %s1_UnitName ) have seen to our wounded ( %d1_Num [NUM:Unit:Units] healed ), the enemy troops haven't a chance at victory!</French>
    <German>General, our Field Medics ( %s1_UnitName ) have seen to our wounded ( %d1_Num [NUM:Unit:Units] healed ), the enemy troops haven't a chance at victory!</German>
    <Italian>General, our Field Medics ( %s1_UnitName ) have seen to our wounded ( %d1_Num [NUM:Unit:Units] healed ), the enemy troops haven't a chance at victory!</Italian>
    <Spanish>General, our Field Medics ( %s1_UnitName ) have seen to our wounded ( %d1_Num [NUM:Unit:Units] healed ), the enemy troops haven't a chance at victory!</Spanish>
  </TEXT>
  <TEXT>
    <Tag>TXT_KEY_MISC_ENEMY_FIELD_MEDIC_ATTACKERS</Tag>
    <English>General, %s1_CivAdj Field Medics have seen to their wounded!  We are preparing for the next wave of attacks!</English>
    <French>General, %s1_CivAdj Field Medics have seen to their wounded!  We are preparing for the next wave of attacks!</French>
    <German>General, %s1_CivAdj Field Medics have seen to their wounded!  We are preparing for the next wave of attacks!</German>
    <Italian>General, %s1_CivAdj Field Medics have seen to their wounded!  We are preparing for the next wave of attacks!</Italian>
    <Spanish>General, %s1_CivAdj Field Medics have seen to their wounded!  We are preparing for the next wave of attacks!</Spanish>
  </TEXT>
  <TEXT>
    <Tag>TXT_KEY_MISC_ENEMY_FIELD_MEDIC_DEFENDERS</Tag>
    <English>General, %s1_CivAdj Field Medics have seen to their wounded!  We hope to have taken their position by nightfall.</English>
    <French>General, %s1_CivAdj Field Medics have seen to their wounded!  We hope to have taken their position by nightfall.</French>
    <German>General, %s1_CivAdj Field Medics have seen to their wounded!  We hope to have taken their position by nightfall.</German>
    <Italian>General, %s1_CivAdj Field Medics have seen to their wounded!  We hope to have taken their position by nightfall.</Italian>
    <Spanish>General, %s1_CivAdj Field Medics have seen to their wounded!  We hope to have taken their position by nightfall.</Spanish>
  </TEXT>

I tried to set it up so that if you weren't the player with the VictoryHealChance promotion you didn't know exactly how successful it was, just that it had occured.
 
Change the first two <TEXT> entries like this:

Code:
%d[B][COLOR="Red"]2[/COLOR][/B]_Num [NUM[B][COLOR="Red"]2[/COLOR][/B]:Unit:Units]
 
Top Bottom