Quick Modding Questions Thread

Is there a way to make the AI expand more? E.g. tweak preferences so they're much more likely to build settlers/workers, use settlers to found new cities, etc.? Preferably a relatively easy way. I have options to stop them crashing their economy (e.g. no unit maintenance) if need be.

I'm asking because I play high-level FFH2, but always find myself leading in score pretty quickly because the AI is atrocious at expanding (no matter which modmod I play). It's quite frustrating.
Probably no easy way. Generally, individual units can be encouraged through iAIWeight in Civ4UnitInfos.xml, but, for settlers, probably also for workers, I don't think this will make much of a difference, if any. I'm guessing that early-game settlers mostly get produced through this function call in the DLL. The main precondition is that at least one worthwhile city site needs to be known to the AI (iAreaBestFoundValue > iMinFoundValue). If that's the case, then the problem is probably that AI code higher up in AI_chooseProduction is keeping the AI cities busy with other tasks – wonders, other buildings, units for defense, exploration or warfare. I haven't played FfH2, but I think there are lairs and spell-casting units. I could see those or other additions in the mod(s) distract the AI from settlers and workers. In the MNAI-U mod, which I assume has the most sophisticated AI for FfH2, I see that a condition !bRoomToGrow has been added, which apparently means that, once the AI has at least 2 cities, it will not consider a settler so long as there are improved tiles to be worked and the happy cap isn't yet reached. That said, a second, lower-priority rule for producing settlers has also been added.

I think you'd have to use Debug mode (Ctrl+Z with the chipotle cheat entered in CivilizationIV.ini) to watch what the AI is doing when it should be producing workers and settlers – and then look into deprioritizing those other tasks. There might be ways to do that indirectly through XML changes, but, more likely, those would have to be DLL changes. It would also be good to verify that the AI succeeds at exploring city sites; that can be checked by hovering over tiles holding down the Alt key. The help text should show a yellow X when a tile is a planned AI city site. (Some mods will also highlight such tiles through colored circles when in Debug mode.)
 
Maaaybe adding a new flavour for Settlers and giving every leader a modifier of 10 or so for that new flavour could help?
 
Probably no easy way. Generally, individual units can be encouraged through iAIWeight in Civ4UnitInfos.xml, but, for settlers, probably also for workers, I don't think this will make much of a difference, if any. I'm guessing that early-game settlers mostly get produced through this function call in the DLL. The main precondition is that at least one worthwhile city site needs to be known to the AI (iAreaBestFoundValue > iMinFoundValue). If that's the case, then the problem is probably that AI code higher up in AI_chooseProduction is keeping the AI cities busy with other tasks – wonders, other buildings, units for defense, exploration or warfare. I haven't played FfH2, but I think there are lairs and spell-casting units. I could see those or other additions in the mod(s) distract the AI from settlers and workers. In the MNAI-U mod, which I assume has the most sophisticated AI for FfH2, I see that a condition !bRoomToGrow has been added, which apparently means that, once the AI has at least 2 cities, it will not consider a settler so long as there are improved tiles to be worked and the happy cap isn't yet reached. That said, a second, lower-priority rule for producing settlers has also been added.
Thanks f1rpo! That's quite disappointing. It also sounds like a really bad addition to the code tbh.
 
I seem to recall there being a mod somewhere that lets you specify civ specific names for the same unit but without outright creating a UU. Does anyone know what I am talking about?
 
I seem to recall there being a mod somewhere that lets you specify civ specific names for the same unit but without outright creating a UU. Does anyone know what I am talking about?
First I thought that it was a BtS feature but no.
I don't know the name of the original modcomp but AND2/CoM has it:
1687464690255.png

I don't know if it helps or not though.
 
It helps in that I now know K-Mod does not include it and where I must look to port it from. So thank you.

Next question. How do I make it so that cottages can't upgrade unless you have a certain tech? Is that even possible or is it more DLL work for my list?
 
Next question. How do I make it so that cottages can't upgrade unless you have a certain tech? Is that even possible or is it more DLL work for my list?
I can say the same as in my previous post.

...and I'm getting more and more amazed how limited BtS is and how little I remember it :eek2:
 
It helps in that I now know K-Mod does not include it and where I must look to port it from. So thank you.

Next question. How do I make it so that cottages can't upgrade unless you have a certain tech? Is that even possible or is it more DLL work for my list?
DLL. But you can make all the Cottages have the same yields and only improve the yields with technologies. E.g. Hamlets get a better yield with Alphabet, and so at that point they become better than Cottages.
 
DLL. But you can make all the Cottages have the same yields and only improve the yields with technologies. E.g. Hamlets get a better yield with Alphabet, and so at that point they become better than Cottages.
Thanks but that's like an ugly hack. I'll just add it to my DLL porting list.
 
Alright, another question. Is there a way to make it so that forts can be built next to one another instead of needing the dumb 1 tile distance?

Also when I add new civicoptions they don't show up in the interface?
 
Is there any dll work required if I want to add new era? Say between Industrial and Modern?

Edit:
I just added a new era there and reassigned some techs but the game was broken: no interface and no arrows for the tech tree.
Any ideas? Suggestions?
 
Last edited:
How do I change the minimum number of tiles between cities? I want to make overlap impossible. Also I want to make it impossible to found cities on top of resources.
 
How do I change the minimum number of tiles between cities? I want to make overlap impossible
I think it's MIN_CITY_RANGE in GlobalDefines.xml.
 
I am unable to find that tag in the file mentioned.

The DLL does contain code to load it though so I assume I just have to manually add it.

Edit: That worked. Thank you. Sadly it does not work quite as well as I expected as it counts the tile numbers diagonally as well thus leading to unfavorable limitations. I shall have to DLL this.
 
Last edited:
How do I change the minimum number of tiles between cities? I want to make overlap impossible. Also I want to make it impossible to found cities on top of resources.
What if a city can never reach enough population to work all its tiles? What if I want to have my cities on a river or on the coast? What about tiny islands close together each containing resources? I even find the original two-tile limit to be too harsh for these considerations.
 
What if a city can never reach enough population to work all its tiles? What if I want to have my cities on a river or on the coast? What about tiny islands close together each containing resources? I even find the original two-tile limit to be too harsh for these considerations.
All those objections are nice and all. But fundamentally I just hate overlap and founding on resources. They make for a messy map overall.

I do however plan to port in the code from RIFE that lets forts spread culture so the tiny island thing at least will be covered by that. And those won't have any limits as I fully intend to let you make walls of forts.

Also, all resources will be revealed at game start since I hate founding a city and finding out hours later that I was one tile away from a better spot.
 
Last edited:
Is there a way to force the camera to always face straight down, no matter the zoom level?
 
I've heard from somewhere (can't remember where), that when you swap between mods that you are supposed to:
"Clear the cache/reset settings" by beginning a quick Play-Now game that you can quit out of once the map loads.
Is this an actual thing? Does doing that do anything? Or can you just freely swap between mods without having to worry about anything?
 
I've heard from somewhere (can't remember where), that when you swap between mods that you are supposed to:
"Clear the cache/reset settings" by beginning a quick Play-Now game that you can quit out of once the map loads.
Is this an actual thing? Does doing that do anything? Or can you just freely swap between mods without having to worry about anything?
I am not sure if it does anything but I kn ow it's lore that you should do it. So I do.
 
Back
Top Bottom