adjusting missionary success rates

mgmcomm

Chieftain
Joined
Sep 26, 2007
Messages
7
I am trying to discover how mission sucess rates are determined. It appears to be a degrading success rate depending on the number of existing religions in a certain city. It may be conected to population and other factors but I am as of yet unable to find out where to modify this at all in bts or in warlords.

I did however stumble acorss this in unitinfos.xml but I dont think this takes in account the city size or othr factors and I havent figure out if raising or lowering the number is what needs to be done to achieve 100% sucess rates.

Code:
<ReligionSpreads>
  <ReligionSpread>
    <ReligionType>RELIGION_JUDAISM</ReligionType>
    <iReligionSpread>40</iReligionSpread>
  </ReligionSpread>
</ReligionSpreads>

I want to be able to make the sucess rate more flat. Meaning it has no regard to the number of pre-existing religions but maybe at a 50% flate rate per attempt. I am just unable to discover were this takes place. My guess is in the python but my searches have come up with nothing as I am not really a good python person.
 
I searched for fagents of text in your reply in the contents of all files found under assets for vanilla, warlords, and bts but came up with nothing.
I tried: getSorenRandNum "Spy Interception" getSpyInterceptPercent
I was hoping that text would exist sowhere a give me a hint as to where to find the religon stuff but nothing came up in any of the asset files including all sub dirs.
 
Is this a file that can be included in a mod?
seems to me that a cpp file would be part of the source code for the binary and not used by the script or mod systems.

Do I make a copy of the file under the mod dir?
 
you have to modify the following method to modify missionary succesrate in rival citied:

Code:
bool CvUnit::spread(ReligionTypes eReligion)
{
	CvCity* pCity;
	CvWString szBuffer;
	int iSpreadProb;

	if (!canSpread(plot(), eReligion))
	{
		return false;
	}

	pCity = plot()->getPlotCity();

	if (pCity != NULL)
	{
		iSpreadProb = m_pUnitInfo->getReligionSpreads(eReligion);

		if (pCity->getTeam() != getTeam())
		{
			iSpreadProb /= 2;
		}

		bool bSuccess;

		iSpreadProb += (((GC.getNumReligionInfos() - pCity->getReligionCount()) * (100 - iSpreadProb)) / GC.getNumReligionInfos());

		if (GC.getGameINLINE().getSorenRandNum(100, "Unit Spread Religion") < iSpreadProb)
		{
			pCity->setHasReligion(eReligion, true, true, false);
			bSuccess = true;
		}
		else
		{
			szBuffer = gDLL->getText("TXT_KEY_MISC_RELIGION_FAILED_TO_SPREAD", getNameKey(), GC.getReligionInfo(eReligion).getChar(), pCity->getNameKey());
			gDLL->getInterfaceIFace()->addMessage(getOwnerINLINE(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_NOSPREAD", MESSAGE_TYPE_INFO, m_pUnitInfo->getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE());
			bSuccess = false;
		}

		// Python Event
		gDLL->getEventReporterIFace()->unitSpreadReligionAttempt(this, eReligion, bSuccess);
	}

	if (plot()->isActiveVisible(false))
	{
		NotifyEntity(MISSION_SPREAD);
	}

	kill(true);

	return true;
}

as you can see, you can simple modify the variable into iSpreadProb = 100 to get a 100% succesrate.

however, I think that would be a bit to static.

Therefore I suggest you also modify CvReligionInfo in CvInfo's and add a private m_iRivalSpreadModifier variable (with a default value of 50) and set the variable with XML value in the ::read function and add some public getRivalSpreadModifier function which can be used by the ::spread function in CvUnit.cpp
 
Top Bottom