Quick Modding Questions Thread

A number of questions I have about Civ 4 modding.

1. Is it possible to put a maximum limit on how much experience units can gain from combat? (Such that for example a unit can gain up to 50 points, but no more)

2. Is it possible to make resources in Civ4 quantitative? (like how it is in Civ5). Such that a resource would have 3 or 10 or 100 of it in one tile, and they'd be used per unit or something, as opposed to having 1 resource provide for your entire nation no matter how big you are. (I understand this likely requires SDK modding, and that's fine, just wondering if its possible.)

3. Is it possible to change golden ages so that a GA gives a % boost to gold and hammer production as opposed to adding 1 to existing tiles?

4. Is it possible to add additional "yield types"? so, other than food, gold, and hammers, getting a new type of yield into the game.

Thanks for any feedback.
1) Should be easily doable in the SDK.
2) Is definitely SDK and rather complicated (think about which information you need to keep track of: how much every plot with this bonus provides, current/maximum available resources for every player, consumption for every unit, and keeping track of it all while building/losing/disbanding units and gaining/losing bonus squares).
3) Sure, but it's DLL again. Locate the part where the GA increases tile yield (not sure where that is though), remove it, and add another modifier in CvCity::getBaseYieldModifier() like:
Code:
if (GET_PLAYER(getOwnerINLINE()).isGoldenAge())
        if (eIndex == (YieldTypes)1 || eIndex == (YieldTypes)2) //hammers and commerce
                iModifier += 10 // for a 10% increase
4) There was a project to implement this, scroll up a little.
 
I'd like to introduce a rule that you need to have Hinduism as your state religion to found Buddhism if you discover its tech (Priesthood, in this case, because it's for RFC). Seems I don't understand the CvTeam::setHasTech() method, though, because all the checks I've added had no effect.

Can someone point me to the right point in this method where I have to stop the process of religion founding if it's Buddhism and the founder doesn't have Hinduism as state religion?
 
Right. Thanks :)
 
Spoiler :
Hi

I'm playing RevDCM and I want to make a small change to the ai to address something I see as a weakness in the ai's play. The situation is where the Ethiopians say, have just captured a couple of cities off the French and have made them a vassal. In this situation a human player may well just liberate the captured cities back to the French rather than try and deal with the inevitable revolution problems. This then frees your army to go off and attack someone else. However the computer always stubbornly tries to hold onto them, often resulting in a revolution and a renewed war against someone he has already beaten.

So I want the ai to do a common sense check once it's made someone a vassal, that basically asks 'have I captured any cities'? If so, am I better off liberating those cities to my vassal? So the check could be for example if any of the cities have >75% nationality of the vassal, and are much further away than the average of ai's main cities. If the answer is yes to both, then the Ethiopians would just liberate the cities straight away, rather than get into an endless cycle of revolutions and war.

I think this would improve the ai's standard of play. Would such a check be easy to insert? Can anyone give me any pointers as to what code I would need to insert and where? I presume it would slot somewhere in CvPlayerAI?

For context, after reading some of excellent guides on this website, I can just about create a new dll, but I'm struggling with writing code and working out how to fix the above problem.

Thanks in advance for any advice.

gorilla,

I have investigated your question further. Keep in mind I am looking at the original code, so things might be a little different for the RevDCM code.

First, a reminder that you have to be careful giving cities to a vassal because if they become to big then they don't have to be your vassal anymore. Consider the conditions described in this thread: http://www.civfanatics.com/civ4/strategy/vassals.php

Second, one place your "common sense" check could go is in the function "setVassal" which is in CvTeam. If you could find where in the code the AI decides to capitulate or to accept a capitulation that might be a better place, but I couldn't find it so this is an alternative. The setVassal function has the parameter "TeamTypes eIndex," and this is the team that is getting/subjecting the vassal.

Basically, here in this function you can write the code to make the decision for the AI. It could go something like this:
  • A "for loop" that loops through each player in the team
  • If the player is not human (!isHuman()) then...
  • A "for loop" that loops through each of that player's cities
  • If the city meets the conditions you specified: "if any of the cities have >75% nationality of the vassal, and are much further away than the average of ai's main cities"
  • Then "liberate" that city (call the liberate function in CvCity)

This seems like it would work for what you want to do, but I make no guarantees. Good luck from here!:crazyeye:
 
Basically, here in this function you can write the code to make the decision for the AI. It could go something like this:
  • A "for loop" that loops through each player in the team
  • If the player is not human (!isHuman()) then...
  • A "for loop" that loops through each of that player's cities
  • If the city meets the conditions you specified: "if any of the cities have >75% nationality of the vassal, and are much further away than the average of ai's main cities"
  • Then "liberate" that city (call the liberate function in CvCity)

I think I'm making progress on the loops and logic test, but I'm a little confused with how I "call the liberate" function for any city passes those tests. :confused:
 
If you can't find it, you are looking in the wrong place. It is in the Units folder in the XML folder in the Assets folder in the Beyond the Sword folder (assuming you are using the BtS expansion). All of that is, of course, down in the folders where the game was installed, which is not in the My Games folder (probably in Program Files, or some approximation of that, unless you changed the location when installing it).
 
Does anyone know what could prevent units with flank attacks from actually causing flanking damage? I'm not talking about lost battles or siege units in cities here.

I ask because I've been informed that the Keshiks in my mod don't cause flanking damage against catapults and trebuchets, although their unit card explicitly shows that they do.
 
No it wasn't, but even after I've increased it to 6 and iCollateralDamageLimits to 100 (it's supposed to have the same stats as knights except for +1 move and +1 first strike) it doesn't work. Is there any other entry associated with flanking I've missed?
 
You'll need to do some python scripting for that.
 
What about iCombatLimit?
Was 100 too. I've now simply copied everything from the Knight entry and added all UU bonuses again; oddly enough, it worked afterwards. I'd rather know what caused this but at least now the problem's gone.

Thanks, though :)
 
I got a weird thing. I made my first mod folder, and shortcut path doesn't work right.
My shortcut looks like this: "Bts.exe" "mod=Mymod" (bts.exe is an abbreviation obviously)
When I run, the first later of "mymod" gets dropped and game starts to look for "ymod", which it doesn't find...
What I did, I placed extra letter in front of folder name like this "AMyMod", then when I run it, "A" gets dropped and game properly goes to "Mymod" folder...

And I know its not suppose to work like this... Any ideas?
 
It's supposed to look like this: "<Game Location>\Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword\Civ4BeyondSword.exe" mod=\MyMod"

So you're supposed to include the backslash there. Surprising that it works with any letter in that position, actually.
 
Back
Top Bottom