Missionary success chance

civcivv

Warlord
Joined
Dec 1, 2009
Messages
126
Location
London
Hi there,

I read in one of the threads here a while ago that you can change missionary success rates by amending cvUnit.cpp and changing iSpread to 100.

However, I#vev done that and more and I still fail regularly at spreading a religion in my own cities.
My modified script:

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 = 101;

		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, getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), pCity->getX_INLINE(), pCity->getY_INLINE());
			bSuccess = false;
		}

		// Python Event
		CvEventReporter::getInstance().unitSpreadReligionAttempt(this, eReligion, bSuccess);
	}

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

	kill(true);

	return true;
}

Please help?
 
script?
It's not a script....erm...longer explanation:
The file, which you have modified now, belongs to the SDK. The SDK is the source for the CvGameCoreDll.dll, which you can find in the assets folders.
To create a CvGameCoreDll.dll out of these files, you have to compile them.
This needs a not small amount of work, look at this tutorial, but use this makefile.

And make sure, that the latest patches are installed.
 
Thank you for your reply!

I have now gone through the steps with the new makefile and "built the solution" as per the instructions.pdf file.

Now, I have several output files:
-the standard ones in the CvGameCoreDLL folder (though I cannot find a *.rc file there)
-a folder called "Final_Release" with a CvGameCoreDLL.dll and lots of obj files and what not.

How do I use my little mod in the game now? Which files do I need and where do I need to put them?
Essentially I am not looking to run Civ4 in a loadable mod but I just want to put my mod into the base game.

Thank you for any help you can provide!
 
How do I use my little mod in the game now? Which files do I need and where do I need to put them?
Essentially I am not looking to run Civ4 in a loadable mod but I just want to put my mod into the base game.
You can only put it into the base game by overwriting the original DLL... which isn't very good (*never* modify your original files! Because to undo changes or accidents, you need to re-install completely).

Instead, make a little mod:
1) Create in the ...\Mods\... directory a new one with the name of your mod.
2) Create in this directory a file with the same name as the directory and .ini as file extension. The contents should be:
Spoiler :

[CONFIG]

; Read Game options from XML, not .ini
ForceGameOptions = 0

; Modular XML Loading
ModularLoading = 1

; Skip Main menu
SkipMainMenu = 0

; Custom Art from user folder is not loaded
NoCustomArt = 0

; Custom XML and Python from user folder are not loaded
NoCustomAssets = 0

; No Custom Scenario option in main menu
NoCustomScenario = 0

; No team play allowed
NoTeams = 0

; Always start in the standard era
ForceStandardEra = 0

; Scenario file (Single player)
ForceScenario = 0

; This mod is only for single player games
SinglePlayerOnly = 0

; Allow public maps to be used with this mod
AllowPublicMaps = 1

; Mod Image file
ImageFile = 0

; Name of Mod
Name = Name of the Mod

; Description of Mod
Description = Generic Mod

3) Create a directory called "Assets" in your mod-directory.
4) Put the CvGameCoreDLL into the "Assets"-directory.

...and enjoy! :)

Since you want to play every game with that mod, you can modify your game shortcut by adding " mod=\Name of your Mod directory" at the end of the file path (sans quotes). Then, the shortcut will directly start up the mod, instead of the main game.

Cheers, LT.
 
Thank you for the detailed walkthrough!

Two questions on things I did not quite understand (because I'm daft!)
- Put the CvGameCoreDLL folder in the assets folder of the mod folder or the CvGameCoreDLL.dll file there?
- If I did want to put it into the base game (because I like to experiment - of course backing up original contents), which files would I need then and where would I place them?

The reason I ask is because in the actual game folder I cannot find an actual dll file (just the folder). And I'm not sure which files I will need in either case.

Again, thank you!
 
Two questions on things I did not quite understand (because I'm daft!)
- Put the CvGameCoreDLL folder in the assets folder of the mod folder or the CvGameCoreDLL.dll file there?
- If I did want to put it into the base game (because I like to experiment - of course backing up original contents), which files would I need then and where would I place them?
Just the .dll-file, the directory is just the uncompiled source code - it does nothing on its own. (Though it's very, very cool that Firaxis gave it to us)

The structure inside the mods directory is actually sort of a miniature copy of the main game structure. You can find the .dll-file in ...Beyond the Sword\Assets\... (so, if you want to do more in a mod, just copy over the original file, preserving the same directory structure and modify it then). That DLL would then be replaced by your new DLL.

By the way, another reason why putting stuff into separate mods is good is that it allows you to zip it and upload here a lot easier than by hunting down changed files... if you want to share your modding. ;)

Hope that helped - if not, just ask again! :)

Cheers, LT.
 
Top Bottom