Quick assistance request... How to track down coded functions?

Chronis

Warlord
Joined
Feb 3, 2011
Messages
102
Hello, I am trying to add two changes in my MOD that will require python and/or
dll changes. My experience with both of these is limited, but with the various tutorials available I think I can muddle my way through.

My question is how do I track down the code that controls these functions.
The changes I wish to MOD are:

1) Increase the negative consequences for razing cities

When playing with revDCM, Revolutions have made capturing and holding enemy cities very challenging (as it should be). However, raising enemy cities is almost consequence free. This distorts gameplay such that the optimal strategy is to always raise a captured city rather then try to hold it.

I would like to modify the code that controls when and how free units spawn following the razing of a city. I believe there is already code somewhere that causes free defenders to spawn on city razing late in the game but I do not know where it is.


2) Magic disappearing reappearing culture.

Currently, when you destroy the last city of an enemy empire all of their culture magically disappears. When playing with the RevDCM mod due to the importance of culture on revolutions this makes complete and total destruction of an enemy empire the only optimal way to play. Making a defeated state a vassal is not a competitive strategy nor is capturing part of an enemy empire and then making peace.

I would like to make enemy culture not vanish on defeat of an enemy civilization. This would make conquering an enemy civ harder, allow for alternative strategies like vassal states, and eliminate the problem of magically reappearing culture.

How do I track down the code that instructs the game to remove enemy culture once that civilization is eliminated?

Any assistance would be greatly appreciated.
 
For your first point number 1, the partisans are generated by a non-random "random" event.

The event trigger is triggered via code in CvEventManager.py in the onCityRazed function. It is triggered only for cities with a population > 1 that is not a barbarian city if it was not their last city.

The event trigger is EVENTTRIGGER_PARTISANS in CIV4EventTriggerInfos.xml.
It is set up to never trigger normally, by setting its iWeight to -2.
This event trigger specifies "<Civic>CIVIC_EMANCIPATION</Civic>" so a civ should only get the partisans if it is running Emancipation. You can change the conditions using the usual event trigger XML tags or by adding a Python function specification to the PythonCanDo tag.

The two choices a player gets when the event is triggered are EVENT_PARTISANS_1 and EVENT_PARTISANS_2.

Each of the two events has Python functions associated with them:
applyPartisans1
canApplyPartisans1
getHelpPartisans1
and
applyPartisans2
canApplyPartisans2
getHelpPartisans2

The Python code for these is in CvRandomEventInterface.py.

Also in CvRandomEventInterface.py is a function called getNumPartisanUnits which, not too surprisingly, is used to determine how many units to spawn. It spawns that number calculated for partisan event 1, or half that many for partisan event 2.

So...

To get it to spawn units from the start and escalate as time passes you could, for example, remove the civic requirement from the trigger. Then adjust the number of units calculated in getNumPartisanUnits by adding in the current era number to the culture level based calculation that it now uses, or add a couple if the civ is running the emancipation civic (to relate it back to the original requirement).

Well, I am assuming that it is not changed from BtS in RevDCM already. All the above stuff is how it works in regular BtS.
 
For your first point number 1, the partisans are generated by a non-random "random" event.

Thank you for your quick, detailed and very helpful reply. That is exactly what I needed to get started on modification #1.
 
Back
Top Bottom