Modmodding Q&A Thread

With this statement you have disabled resource requirements for all mystery civ units and all non-melee units.
 
I didn't see what the mystery civ is, but I am assuming it will be Venice! :king:
 
Great and I will be complicit.
 
Sounds like I really couldn't do logic. Thanks for bearing with me, it works now. There were other mistakes, though — if anyone else is attempting something like this, it should be
Code:
if (getOwner() != MYSTERYCIV || GC.getUnitInfo(eUnit).getUnitCombatType() == 4)
i.e. use "getUnitCombatType" and 4 represents melee (1 is archery, 2 and 3 are heavy and light cavalry, not sure about the others).
 
That still though will exempt all units that belong to mystery civ and all non-melee units from resource requirements.

What you want is
Code:
if (!(getOwner() == MYSTERYCIV && GC.getUnitInfo(eUnit).getUnitCombatType == 4))
 
The weird thing is, my code actually worked in practice, but after reading yours I couldn't understand why anymore. It's an unsettling feeling and it drove me crazy for a little while... I replaced it with your code and it still works and it makes more sense, so thanks once again.
 
If you have only played mystery civ then you would see no difference, it would only affect other civs in an unintended way.
 
If Steb's new civilization turns out to be Manchuria, that's going to be kind of awkward!
 
No it's not!
(I guess this mystery thing is starting to get old... Fortunately the new civ is almost ready!)
 
Is it okay to edit the python and dll files using notepad?
 
Is it okay to edit the python and dll files using notepad?
Python and XML files are best edited with Notepad++, which is a better version of the simplistic notepad.

DLL file changes will not do anything until you compile the DLL. Because of this, you'll need to set up Visual Studio if you wish to properly edit them. Leoreth has a thread about that, though I can't remember where.
 
I definitely recommend against using plain Notepad, it has issues with file encoding and handling large files, not to mention lacks tons of conveniences like syntax highlighting etc.

My guide on setting up Visual Studio to compile the DLL is here. It is for the base game, but you can still follow it and simply skip step 3. In that step, you get the BtS source code, Makefile and a prepared VS solution file, but all of these things are already included in the mod's CvGameCoreDLL folder.
 
I definitely recommend against using plain Notepad, it has issues with file encoding and handling large files, not to mention lacks tons of conveniences like syntax highlighting etc.
Plus it has Regular Expressions and the Python Script Plugin (downloaded separately), which are amazing for modifying large amounts of repetitive data.
 
Trying to add a new civilization to the CMC mod at the moment. When I try to load the mod with the changes I made it is saying "failed initializing python." Is there any tool I can use to get more information about why it cant initialize the python?
 
You should get more error messages as you click through, or if logging is enabled the whole error trace in PythonErr.log.
 
Two questions related to Teotihuacan:

1. I gave them a custom Teotl Pagan UHV goal, like the Maya. However, I don't know where to reference the XML text tag for it, and it currently displays the default Aztec one. I couldn't find where the Maya Teotl goal XML tag is referenced. How did you do it?

2. The Pyramid of the Sun is supposed to reduce the number of required Great People for Golden Ages by 1. It doesn't work, although I think it used to before I merged the recent develop updates into the mod (I'm not sure I trust my memory anymore...). Do you think the following code in CvPlayer.cpp should do what I want?
Code:
int CvPlayer::unitsRequiredForGoldenAge() const
{
    // Pyramid of the Sun: requires 1 less GP for a golden age
    if (isHasBuildingEffect((BuildingTypes)PYRAMID_OF_THE_SUN))
    {
        return (GC.getDefineINT("BASE_GOLDEN_AGE_UNITS") + (getNumUnitGoldenAges() * GC.getDefineINT("GOLDEN_AGE_UNITS_MULTIPLIER")) - 1);
    }
    return (GC.getDefineINT("BASE_GOLDEN_AGE_UNITS") + (getNumUnitGoldenAges() * GC.getDefineINT("GOLDEN_AGE_UNITS_MULTIPLIER")));
}
 
Two questions related to Teotihuacan:

1. I gave them a custom Teotl Pagan UHV goal, like the Maya. However, I don't know where to reference the XML text tag for it, and it currently displays the default Aztec one. I couldn't find where the Maya Teotl goal XML tag is referenced. How did you do it?

2. The Pyramid of the Sun is supposed to reduce the number of required Great People for Golden Ages by 1. It doesn't work, although I think it used to before I merged the recent develop updates into the mod (I'm not sure I trust my memory anymore...). Do you think the following code in CvPlayer.cpp should do what I want?
Code:
int CvPlayer::unitsRequiredForGoldenAge() const
{
    // Pyramid of the Sun: requires 1 less GP for a golden age
    if (isHasBuildingEffect((BuildingTypes)PYRAMID_OF_THE_SUN))
    {
        return (GC.getDefineINT("BASE_GOLDEN_AGE_UNITS") + (getNumUnitGoldenAges() * GC.getDefineINT("GOLDEN_AGE_UNITS_MULTIPLIER")) - 1);
    }
    return (GC.getDefineINT("BASE_GOLDEN_AGE_UNITS") + (getNumUnitGoldenAges() * GC.getDefineINT("GOLDEN_AGE_UNITS_MULTIPLIER")));
}

1. In victory.py @getPaganGoalHelp(). Search for "teotl".
2. I suppose that works. You should test it to be sure though.
 
1. In victory.py @getPaganGoalHelp(). Search for "teotl".
Thanks, but this is not what I'm looking for. I should clarify. There are two parts in the victory display: stating the goal, and then displaying the player's progress. I took care of the second part, so it currently says something like:
Sacrifice ten slaves
Culture produced: 0/200
i.e. the second line is correct but not the first. For the Maya it says
Acquire 50 food from combat
Food acquired: 0/50

2. I suppose that works. You should test it to be sure though.
Yeah, it's probably some sort of off-by-one error in the wonder enumeration... I thought it unlikely because I fixed one such error that made the conquerors spread space elevators to the New World instead of the plague :D

EDIT: So I tracked the bug and the intended effect was instead associated with the Temple of Kukulkan, which was right before the Pyramid of the Sun in CvRhyes and Consts.py. I tried moving the Pyramid of the Sun to the end of the list in both files, and now the effect is associated with the CN tower. I'm confused because I'm pretty sure I updated the building constants correctly, but let's make sure: I added a normal building (Teotihuacan special building) and a wonder (and therefore a new building class). Thus I should have incremented BEGIN_WONDERS by 1, NUM_BUILDINGS_PLAGUE by 2, and NUM_BUILDINGTYPES_PLAGUE by 1, correct? Is there any other place besides CvRhyes and Consts.py that are sensitive to the ordering of buildings or building classes?
 
Last edited:
Thanks, but this is not what I'm looking for. I should clarify. There are two parts in the victory display: stating the goal, and then displaying the player's progress. I took care of the second part, so it currently says something like:

i.e. the second line is correct but not the first. For the Maya it says

VictoryScreen.py
line 1603-1605 if unmodded.

Code:
                            if iVictoryType == iVictoryPaganism and i == 1:
                                sGoalText += "_" + str(gc.getCivilizationInfo(gc.getPlayer(self.iActivePlayer).getCivilizationType()).getPaganReligionName(0).upper())
                                if self.iActivePlayer == iMaya and not gc.getPlayer(self.iActivePlayer).isReborn(): sGoalText += "_MAYA"

Yeah, it's probably some sort of off-by-one error in the wonder enumeration... I thought it unlikely because I fixed one such error that made the conquerors spread space elevators to the New World instead of the plague :D

EDIT: So I tracked the bug and the intended effect was instead associated with the Temple of Kukulkan, which was right before the Pyramid of the Sun in CvRhyes and Consts.py. I tried moving the Pyramid of the Sun to the end of the list in both files, and now the effect is associated with the CN tower. I'm confused because I'm pretty sure I updated the building constants correctly, but let's make sure: I added a normal building (Teotihuacan special building) and a wonder (and therefore a new building class). Thus I should have incremented BEGIN_WONDERS by 1, NUM_BUILDINGS_PLAGUE by 2, and NUM_BUILDINGTYPES_PLAGUE by 1, correct? Is there any other place besides CvRhyes and Consts.py that are sensitive to the ordering of buildings or building classes?

That is correct. IIRC that's all concerning buildings or buiding classes.
 
Back
Top Bottom