Quick Modding Questions Thread

They playtested them. But I'd suggest looking at the costs of all the techs in an era before you add in a tech. Find the previous total cost. Let's say it was 1000 (Normal Speed). If you add in a tech with a cost of 100, modify erainfos.xml for that era to get it back to 1000. In the example I gave, it would be 91% tech cost for that era.
 
On the other hand, if the tech results in an increase in commerce or directly to research or even gold (possibly allowing the research slider to be bumped up a notch) then there is the opposite problem - everything after that will be proportionately cheaper to research.

Such increases can come from a new building that is available with the new tech that gives or modifies commerce or research or gold, a new civic that it enables, or increases in plot/improvement yields, extra trade routes, or other similar things including indirectly via additional happiness from something so that cities can grow larger. Even something that increases production will tend to have a small indirect increase to the research rate since it will take less time to build buildings that increase commerce/research/gold getting their bonuses a turn or two sooner and making it more cost effective to build them in lower output cities.

Decreasing the tech costs for the entire era to keep them constant is likely to also speed up the tech rate more than the proportionate amount (i.e. setting it to 91% as in JB's example will probably result in slightly faster teching rather than maintaining the same rate even though he rounded that figure up slightly, although the difference could be just a few turns) since you'll get the techs that allow you to build buildings (or bump up output in other ways) sooner and therefore the tech rate will go up sooner so you can get through the era's techs even sooner that the cost decrease might suggest. Such an adjustment also probably makes beelining even more effective, especially if you target a tech that is just into the next era that enables a major commerce or research increasing effect (like Education, for example) since while you are beelining you are probably ignoring that additional tech and the ones you have to get are cheaper than they were. Because of this, a direct adjustment that keeps the total cost for all techs in an era the same is probably excessive in a lot of cases.

So what is the correct adjustment?

Beats me. It depends on what the tech does for the player. If it has a "medium sized" effect on commerce and such then it may be OK to not adjust anything else - researching the tech will slow down the arrival of later techs for a while, but that medium sized increase will allow you to gradually catch up to where you would have been without the new tech. If it has no direct effect and minimal indirect effect then you might want to make some downwards adjustments in the costs of other techs in the general vicinity or to the entire era to even things out. If it has a large effect on one or more of those things then you might actually want to leave the current era's tech alone and increase the costs of techs that are past it in the tech tree. Where the various thresholds for these options are is generally something that must be determined via playtesting.

It's not just techs that need this consideration. If you add any buildings or other such things (as per the list a few paragraphs back) to existing techs, you also need to consider what effect they will have on the rate at which later techs are acquired.

For an example of all this, Final Frontier Plus adds one tech that is somewhat early in the tech tree and 3 that are at the end. That early tech enables two new buildings, one that results in faster population growth and one that results in more population being able to be productive on some planets (if you have sufficient happiness) and a tiny direct increase in research, and a world wonder that allows an additional trade route and directly adds a couple gold per turn. There are also a bunch of new wonders scattered around the tech tree, including the shrines for the various values (which act like shrines for religions in BtS), and a few UBs that can also result in a slight increase to the tech rate as can the new buildings related to planet based resources (and those resources can also allow faster growth or higher happy cap). WIth the changes to the early to mid game, all of the early techs were increased slightly in cost (the techs in the first column were increase by about 7%; the unadjusted cost of each went from 70 to 75). On top of this, because of the new buildings and more easily available resources the later early game techs have their costs set slightly more expensive than that. The mid game techs are all at least somewhat more expensive, increasingly so as the game progresses, heading up towards 50% as you approach the late game techs. In the mid to late mid-game you are likely to start to build various national and/or world wonders that significantly increase your tech rate (equivalents to Oxford University and Wall St., as well as the Forbidden Palace and Versailles and some others) as well as more civs getting UBs that are slightly better than their regular version, changes to some buildings (including one which can result in a lot more trade routes), and some tweaked civics are available in mid game that allow an extra point of happiness. Things only get "worse" as you get into the late game techs due to some more new buildings/wonders and another tweaked civic or two. Because of all this, the late game techs are significantly more expensive than their regular FF counterparts, by at least 50% on up to 80%, and the 3 new late game techs are quite expensive with the most expensive costing double what the most expensive tech in regular FF cost (8000 vs. 4000 as per the iCost in CIV4TechInfos). Adjusting the techs to their current costs took something like 3 iterations to get them to where they are now, which might still not be exactly right but they are at least "pretty good" and quite playable.
 
I think this might do it:
Spoiler :
Code:
long CvPlayer::getRealPopulation() const
{
    CvCity* pLoopCity;
    __int64 iTotalPopulation = 0;
    int iLoop = 0;

    for (pLoopCity = firstCity(&iLoop); pLoopCity != NULL; pLoopCity = nextCity(&iLoop))
    {
        iTotalPopulation += pLoopCity->getRealPopulation();
    }

[COLOR="Red"]
    iTotalPopulation = iTotalPopulation * (1 + getTotalLand() / std::max(1, GC.getMapINLINE().getLandPlots()) * 200 / getNumCities())
[/COLOR]

    if (iTotalPopulation > MAX_INT)
    {
        iTotalPopulation = MAX_INT;
    }

    return ((long)(iTotalPopulation));
}

After adding ";" to the end of the line I successfully compiled it but got an error while checking in-game effects. Error: http://img299.imageshack.us/img299/9162/civ4screenshot0006u.jpg I'm modding RFCMarathon which have modified interface a bit. Lines 1037-42 in CvInfoScreen.py:
Spoiler :
Code:
				iValue = pCurrPlayer.getRealPopulation()
				if iPlayerLoop == self.iActivePlayer:
					iPopulation = iValue
				else:
					iPopulationGameAverage += iValue
				aiGroupPopulation.append((iValue, iPlayerLoop))
 
After adding ";" to the end of the line I successfully compiled it but got an error while checking in-game effects. Error: http://img299.imageshack.us/img299/9162/civ4screenshot0006u.jpg I'm modding RFCMarathon which have modified interface a bit. Lines 1037-42 in CvInfoScreen.py:
Spoiler :
Code:
				iValue = pCurrPlayer.getRealPopulation()
				if iPlayerLoop == self.iActivePlayer:
					iPopulation = iValue
				else:
					iPopulationGameAverage += iValue
				aiGroupPopulation.append((iValue, iPlayerLoop))

Uhm, did you perhaps check this when you didn't have any cities? That's only thing that comes in my mind. The game tries to divide with 0. If you could test it by replacing the:
Code:
    iTotalPopulation = iTotalPopulation * (1 + getTotalLand() / std::max(1, GC.getMapINLINE().getLandPlots()) * 200 / [B]getNumCities())[/B];
with
Code:
    iTotalPopulation = iTotalPopulation * (1 + getTotalLand() / std::max(1, GC.getMapINLINE().getLandPlots()) * 200 / [B]std::max(1, getNumCities()))[/B];
 
Is it possible to mod the game so that you can only achieve victory through conquest while still able to build Space Ship or the U.N.?
 
How do you get a desktop launcher to load a mod? I know a bunch of mods do that, but I just recently installed windows7 and I don't have any examples on my comp. I know I have to do something in the location, but beyond that I don't recall.
 
Because I enjoy having a launcher with its own icon?
 
If you have one, copy one of your existing shortcuts to a mod (drag it to a new location using the right mouse button instead of the left and select Copy Here from the menu that pops up when you release the button; if you are a lefty then it is not really the right button - it is the button on the other side of the mouse than the one you normally use for most stuff; if you are on a Mac, I have no idea if this is the right advice).
If you don't have one, then do the right-button-drag on the BtS executable, Civ4BeyondSword.exe, from wherever it was installed to your desktop. Or you could install a mod that uses and installer and has an option to add a shortcut (and then copy that one for the others that don't do this).

Right click on the new shortcut and select Properties.
On the Shortcut tab (which seems to be the default tab, so it's probably already selected) in the Target field there should be a part after the executable that says something like mod=SomeMod if you copied an existing shortcut, otherwise you'll have to add it. Change that to specify the name of the mod (the name of the folder it is in, exactly) like mod=OtherMod. There may be double quotes around the whole thing or just the mod name. There might be a leading backslash on the beginning of the mod name. Just keep those things as they are and if the shortcut doesn't work, try adding quotes or adding/removing the backslash (shouldn't be necessary if you copied an existing shortcut: if the one you copied works, the new one should too).

You can change the icon to any icon you want it to be by clicking on the Change Icon... button. If the mod came with an icon, it will be in the mod's folder so navigate there and look.

Then just change the name of the shortcut (General tab, the box at the top).

Click on it and play.
 
I have a question concerning the limited units(buildings)/per resource introduced in ciV -
is there any way to mod something like this into civ IV?
 
It is possible.
It can be done either by python, that's the worse solution because you can't teach the AI about it, but it's also the easier solution.
The better and more difficult solution would be to program it into the CvGameCoreDll (-> C++ coding), and i think there are already some modpacks which have done that (but not sure).
 
Hi!

New here (coming from Apolyton).

Recently I've been trying to do some modification to Rhye's and Fall mod (specificially modmod RFC Marathon, but it doesn't matter for this issue).
I tried adding extra techs for some of the starting civs (Egypt, China, Babylon, India) by going into RiseAndFall.py, finding the tech assigning function (where techs for later born civs are assigned) and adding appropriate statements.

Now, I am 100% sure the syntax were correct and the variables were correct as I copied the block from different civ and changed civname, civ team name and the starting condition.
I also happen to have good programming background, so I kind of know what I am doing programming-wise.

However, things did not go well at all - even after adding just one such copied+modified block (for Egypt), the game says "You have been defeated" on starting.
I read that "You have been defeated" means for some reason game didn't get to unit creation, I had no units, thus I lost.

From that I deduce that:
1. The error is likely not in the block I added as such
2. It is likely that there is some other code I have interferred with this way, which causes problems

I also tried to add the techs through XML <FreeTech> statements, but it didn't work (though there was no bug, they were just ignored).

So my question is - if any of you have any RFC modding experience - what should I look for in the RiseAndFall.py file or perhaps other files to know where the problem comes from?

Also, is there any kind of debug to see at which command the game "gave up" ?
 
So my question is - if any of you have any RFC modding experience - what should I look for in the RiseAndFall.py file or perhaps other files to know where the problem comes from?

Also, is there any kind of debug to see at which command the game "gave up" ?
I have experience from editing RFC Python and there is most likely an exception thrown when the Egyptians are initializing. You enable Python exceptions in the Civ4.ini file (whatever its actually called) in your My Games folder. The Python Error Log(s) is found in the Logs folder.

RiseAndFall.py is the only place you can affect the starting Techs. Well, they are not really "starting techs" as such, but the Python script is assigning techs on spawn.

Are you sure that adding Techs is the only modding you've done on RFC?

edit: Are you new to Python? Note that indentation actually matters. And you can't mix and match whitespace as you please. The RFC modules pretty much all use 8 blank spaces per level - adhere to that.
 
Baldyr, thanks for that, I tried it and I managed to resolve the bug (it was indeed due to indentation).
However, I have not been able to assign any extra techs to the civs.
They still start with their 2 basic techs.
I searched the python assets folder for the mod and also for BtS and didn't see a good mention where the Babylonian techs get overrided.

My idea is that since babs start on turn 1, their techs are reassigned to their "normal" techs according to XML.
There again, I have edited their techs out of mod XML, but they are still in the BtS XML, so I presume that in some way they are still retrieved from BtS XML and set.

Is there a way to workaround this override?
Maybe you know where it's coming from?

Thanks!

Here's excerpt from my code, which is basically a copy of Greece tech set up with civ name changed:
Code:
                if (iCiv == iBabylonia):
                        teamBabylonia.setHasTech(con.iMining, True, iCiv, False, False)
                        teamBabylonia.setHasTech(con.iBronzeWorking, True, iCiv, False, False)
                        #teamBabylonia.setHasTech(con.iMetalCasting, True, iCiv, False, False)
                        teamBabylonia.setHasTech(con.iMysticism, True, iCiv, False, False)
                        teamBabylonia.setHasTech(con.iPolytheism, True, iCiv, False, False)
                        teamBabylonia.setHasTech(con.iFishing, True, iCiv, False, False)
                        teamBabylonia.setHasTech(con.iSailing, True, iCiv, False, False)
                        teamBabylonia.setHasTech(con.iTheWheel, True, iCiv, False, False)
                        teamBabylonia.setHasTech(con.iPottery, True, iCiv, False, False)
                        teamBabylonia.setHasTech(con.iWriting, True, iCiv, False, False)
                        #teamBabylonia.setHasTech(con.iAlphabet, True, iCiv, False, False)
                        #teamBabylonia.setHasTech(con.iLiterature, True, iCiv, False, False)
                        teamBabylonia.setHasTech(con.iHunting, True, iCiv, False, False)
                if (iCiv == iGreece):
 
The problem with using the assignTechs() method for granting Techs for the four pre-existing Civs is that that code is only run when (later) Civs spawn. The answer then is to either create your own method (like assignStartingTechs() or something) or to add your code to some other method (like create4000BCstartingUnits() - just because the name says the method creates units doesn't mean that you can't use it for whatever you need - like adding select Techs). The main thing is that the code is run on initialization - not when Civs spawn.

I think you need to forget about the XML for any of this. I believe that Rhye has overridden it in the SDK. You can manually delete Techs with Python though - same as granting them. (Instead of True you supply a False value).

If you don't wanna do any of this Python modding you could always use PyScenario instead. I actually made it specially for this sole purpose. The equivalent script would look something like:
Spoiler :
Code:
Trigger("Babylonian Starting Techs").player(iBabylonia).startup(False).discover(iMining,iBronzeWorking,iMetalCasting,iMysticism,iPolytheism,iFishing,iSailing,iTheWheel,iPottery,iWriting,iAlphabet,iLiterature,iHunting)
Yes, its only one single line of code! :eek2: And no indentation to worry about either.

With that said, I suggest you take this issue either to the programming forum or the PyScenario beta testing thread, depending on whether or not you plan on doing any more Python. This thread is hardly the place to get into these issues in any great detail... (There is also the RFC mod-mod forum.) Pick your venue and see you there! :king:
 
Is there a simple way to make Forest Preserves give one Health like they give 1 Happiness?
 
The best way would be via SDK modifications by "cloning" the iHappiness tag in to make an iHealth tag for CIV4ImprovementInfos.xml.

Other than that, it should possible to do using Python but that could be harder than it first appears. There is an onImprovementBuilt where you could add a point of health to all nearby cities, and an onImprovementDestroyed where you could remove it. You'd also need to add checks in onCityBuilt and onCityAcquiredAndKept. That would probably cover it, except for one thing: what if a plot changes owner due to culture amounts? If you don't mind the improvement adding health to cities owned by a player that doesn't own the improvement then it doesn't matter, if you don't want that then it is more complicated because there is no event handler that is called when a plot (or improvement) changes owner.

So, depending on what you consider to be "simple", the answer is probably "no".
 
Thanks!

Another question. I want a building that is only supplied when a Wonder is built. What is the proper way to prevent the building from being built. I set Cost to 0 and PrereqTech to NONE - it seems to be fine but when I hover over the building in the city view it shows 1 hammer for some reason.
 
Back
Top Bottom