Quick Modding Questions Thread

Isn't question one answered by question three?

No. I don't know how to do it yet, but I am going to need to.

This would, if correctly, lead to +20% culture in the capital, and -10% culture in all cities. A similar thing can be done with (Capital)YieldModifiers.

Uh... that doesn't work for me. Any of it. It will simply not allow me to apply a culture malus to all cities. There's no error message, it just has no effect.

EDIT: I am now working with Legends of Revolution instead of K-mod. I sometimes get this message upon starting a game: warning !! default player starting implementations must have been run

Really, I have no idea what to make of it. I've played the mod before, so I'm fairly confident it's due to my tampering. But I haven't changed anything outside of XML... what in the seven hells does this mean?
 
Hello, and question of the day is: BARBARIANS!

When games in early stages - they are everywhere (understandably) and pretty dangerous - many times barbs had axes way before me and had to reserve to archers to keep them off.
But as game progresses, the barb progression seem to halt quickly - all other nations run around with riflemen, yet barbs STILL popping out with badly obsolete units.

On seas, we are up ironclads, and barbs still coming with a trireme?

I thought that their tech progress is based on average tech of the world nations? But they seem so behind!

I do understand, that as land gets settled, they loose places to spawn, but seas pretty much always covered in fog - plenty of places to spawn barbarian pirates, and a lot of them.
So looking for the ways to:
improve barb tech
heavily increase spawn rate of seas
What would be your suggestions?
thank you!
 
Looks like barbarians are created with CvGame::createBarbarianUnits(), which is called once each turn. It calls the python callback createBarbarianUnits.

It looks like it goes through the standard tests with checking which units it can have based on civ xml, canTrain, have the required bonuses and techs and all that. This makes me wonder: how do they have the right bonuses when creating a unit on a hidden plot without having cities :confused:
It is clearly modable in both dll and python and it would appear that it to some degree can also be modded using xml only. The question is precisely how to control it and that would require a closer inspection of the dll function, or write a replacement in python. It's possible somebody already did that and there is a python callback somewhere, which does precisely what you are asking for.
 
If you look in CIV4CivilizationInfos.xml, you can see that the barbarians have a lot of 'unique units'; all modern units are replaced with 'none'. If you remove those, barbarians will have access to the original units. You may wish to keep Settlers, Missionaries, Executives, Spies, Great People, Scouts, and Explorers disabled though - but then, perhaps not; entirely up to you. :)
 
You should also have a look at CIV4HandicapInfo.xml.

In particular, values like:
Code:
	<iUnownedTilesPerGameAnimal>
	<iUnownedTilesPerBarbarianUnit>
	<iUnownedWaterTilesPerBarbarianUnit>
	<iUnownedTilesPerBarbarianCity>
	<iBarbarianCreationTurnsElapsed>
	<iBarbarianCityCreationTurnsElapsed>
	<iBarbarianCityCreationProb>

Quite a lot to play with. The Modiki is your guide. :spear:
 
1. How can I have a production boost for certain unit classes? For instance, suppose I wanted stable to give +50% to mounted units. This apparently can't be done in BuildingInfos, even though experience can be given by class.

2. How do I assign effects to unhappy population? For instance, if I wanted to give each unhappy citizen a production point, or unhealthiness, based on whether a building is built or a civic is active.

3. How do I stop the culture of dead civs from disappearing? I know FFH2 does this, and perhaps some other mods, but I haven't encountered a guide for it anywhere.

4. How do I stop the AP from giving its religion's buildings +2 hammers?

EDIT: Deleted question, but someone already answered. I asked how to implement BetterAI in another mod.
 
1) Only by Domain it seems (DomainProductionModifiers)

2) Python I would say

3) This thread. Requires compiling a DLL.

4) is this BtS? :mischief: Oh yeah :D CIV4VoteSourceInfos.xml!

5) Merging the two, including Python + source files of DLL => need to compile a DLL. Let's say it's complicate but there are tutorials.
 
1) Only by Domain it seems (DomainProductionModifiers)

This is hard to accept in an open source TBS game. Isn't there something I can do beyond XML?
 
Do you know what open source means? The source is right there for you to edit, it's not Firaxis fault that you can't compile a DLL.
 
The source is right there for you to edit, it's not Firaxis fault that you can't compile a DLL.

I'm not 'blaming Firaxis.' I was responding to the claim that it could only be done by Domain.
 
1. How can I have a production boost for certain unit classes? For instance, suppose I wanted stable to give +50% to mounted units. This apparently can't be done in BuildingInfos, even though experience can be given by class.
I think it can only be done in the DLL. Inside CvCity.cpp
PHP:
int CvCity::getProductionNeeded(UnitTypes eUnit) const
{
	return GET_PLAYER(getOwnerINLINE()).getProductionNeeded(eUnit);
}
Expand that function to add the new modifier. It will change the number of production required for the unit in question rather than modifying how quickly the production is produced. This approach is easier to implement and I think it's less prone to bugs.

Next is getting the modifier from the buildings as well as add the ability to write the modifier in xml. Also this function is likely called frequently, which mean CvCity should likely cache the modifier for performance reasons. Adding the modifier to the GUI and possibly some code in CvCityAI would be good too, though not absolutely needed.

A good idea, but I don't think it is a task I would recommend as the first dll modding task, or first C++ coding task for that matter.
 
I'm not 'blaming Firaxis.' I was responding to the claim that it could only be done by Domain.
Then what did you mean to imply by something being "hard to accept". Obviously you can do it by editing the DLL.
 
Then what did you mean to imply by something being "hard to accept". Obviously you can do it by editing the DLL.

I'm not completely sure what the DLL even is (recall that I struggle with XML).
 
Inside vanilla there is a directory called CvGameCoreDLL. Inside it is C++ code, which can be compiled into CvGameCoreDLL.dll (usually referred to as the dll). Like all other files, if a mod is missing this file, it will use the one provided with vanilla. The content of the DLL is all the game logics, like unit movement, city production and AI actions. It's also the code, which handles a lot of non-gamplay code, like loading xml files, savegame read/write and network communication.

In other words xml is where you set individual buildings, units and stuff while the dll is the place to tell the computer what to do with the data from the xml files to turn it into a game. The Civ4 engine is one of the best (if not the best) game to mod when it comes to what you can do as a modder since the dll allows more or less everything and being C++ the performance is great. The price to pay for this is that modding the dll is so complex that most modders don't have the skills to do so.

Making stables produce mounted units faster is possible to add to the game, but it will have to be added to the dll. This mean it is impossible to do unless you have some basic C++ skills.
 
Or you modify the xml of a mod that already has the features you want already implemented.
You will have to use a modded dll to get the feature in question. However it goes without saying that it doesn't matter who wrote the code and yeah you can take a dll provided with another mod. However the next question would be: which mod has the feature in question?
 
1) Sid Meier's Civilization 4\Assets\Art\Movies\Era (that's Vanilla)

2) CvEraMovieScreen.py in Sid Meier's Civilization 4\Assets\Python\Screens (and that's Vanilla too!)
 
Back
Top Bottom