Quick Modding Questions Thread

I'm guessing you need to look in \Assets\XML\Civilizations\Civ4LeaderHeadInfos.xml
 
All right, I feel stupid having to ask this, but I just can't figure this out. How do I alter a mapscript to generate more resources/bonuses on the map? I don't want to do anything fancy, just make more of every resource.

The easiest thing would be to create a mod, put the Assets\XML\Terrain\BonusInfo.xml in there (in the right folder, for sure), and adjust the values for the resource distribution in there. Most of the mapscripts should then pick up these values when you load that mod.
 
I guess it depends on the map script. Somewhere there is obviously some code generating resources, so it should be as simple as changing some value, somewhere.

I'm yet to take a closer look at any map script myself, so I wouldn't where exactly to look. What map script are you looking to edit?

I've been trying to use the Planet Generator script. Apparently, it used to have an option that increased resources, but it's disabled and doesn't do anything.
 
It looks like the Planet Generator script now only uses the default resource distribution, so the settings in the BonusInfo.xml file should be used.
 
It looks like the Planet Generator script now only uses the default resource distribution, so the settings in the BonusInfo.xml file should be used.

Okay, so how do the settings in the BonusInfo.xml file work, and which ones do I use to generate more resources?
 
Okay, so how do the settings in the BonusInfo.xml file work, and which ones do I use to generate more resources?
I wouldn't know, as I never took a closer look at it. You might wanna give the documentation in the Modiki a try before asking any more questions... Just a kind suggestion.
 
I remember reading on these forums about a mod component that added a few different kinds of roads, from cart tracks to freeways, and now I can't find it. anyone know where it is? yes I've searched using a few terms.
 
"Rise of Mankind" and "Rise of Mankind - New Dawn" has that I believe
 
I'm getting messages like this running the debug version of my dll:

Assert Failed

File: CvPlayer.cpp
Line: 5605
Expression: GC.getCivilizationInfo(getCivilizationType()).getCivilizationBuildings(eBuildingClass) == eBuilding
Message:

----------------------------------------------------------



it doesn't crash the game, but can anyone tell me what it means?

and I don't know why when I paste the error message that extra space in one of the words pops up, its not in the original
 
It means somebody is doing something with a building that is not their civ's version of the building.

The getCivilizationBuildings(eBuildingClass) returns the building type that the player builds for that building class. This is how UBs are done.

The assert is checking to make sure that the building type in question is the one that the civilization builds for the specified building class. The assert is failing because it doesn't match.
 
ok got that one. what about this:

Assert Failed

File: CvTeam.cpp
Line: 5124
Expression: eIndex < GC.getNumTechInfos()
Message: eIndex is expected to be within maximum bounds (invalid Index)

----------------------------------------------------------
 
You are passing the function a number that is supposed to be the index of a tech, but it is a larger number than than the highest index number for the techs you have in the mod.

The techs are numbered from 0 to N-1 for the N techs in the mod, in the order they appear in the CIV4TechInfos.xml file. You are therefore using a number that is N or higher, which is incorrect (example: if you loop over the techs using an index that goes from from 0 to N instead of 0 to N-1 you'd get this when it hits N).
 
its passing integers 0 to 55 and then starting again in the debugger, which seems to be what it should be doing, there are 56 techs in the mod.
edit: found the mistake
 
You can only change the spawn rates of all barbarians, but not only for a few units.
If you want to get rid of barb galleys, you can just forbid the barbarians to build them (see in Assets\XML\Civilizations\CivilizationInfos.xml, the barbarian civ has set lots of units to NONE, so they can't build them. Just add the galley too).
 
Actually, I think they can be adjusted independently in BtS. There is an "iUnownedWaterTilesPerBarbarianUnit" setting for each difficulty level in CIV4HandicapInfo.xml. I would expect this to affect the barbarian ship spawning only. So if you increase this number for the various difficulty levels, you ought to decrease the number of barbarian water units.
 
I've written some code for my DLL which I know is very inefficient... but what I'd like to know is whether or not it actually matters that it is inefficient. ie. I want to know how much time is being spent running my code.

I notice that "PROFILE_FUNC()" appears in some places of the code. So presumably there is some kind of profiling functionality built in. Does anyone know how to use the profiling stuff in the dll? In particular, where does it put its data?
 
At least some of these profiles appear in init.log, but many of them don't, although there's no difference in the creating code.
I thought that the number of displayed functions is limited, so I changed the code such that only one (pathAdd) function is profiled, but then no profiled function appeared there.

Maybe it only works if it takes too long? I have no idea.

In any case, unless your code takes a really long time or runs at least hundreds of times each turn, I think you're safe.
 
My guess is that init.log only displays functions that are run during the initialization of the game. But I don't know. In any case, my code probably is run around about a hundred times each turn... but I don't know how long it takes. It probably isn't a big deal, so I think I'll just leave it alone for now.

In case you're interested, the code I'm talking about is for calculating the unhappiness caused by global warming in my mod. As part of the calculation, it checks every tiles on the map to see who owns it and whether it is a forest, etc; and it checks every building in every city to see if it is creating pollution... It would do all this every time the game needs to know how much unhappiness a particular city has. There's no doubt it would be much faster if I cached the values; but then I'd have to think of every single thing that could possibly change those values, otherwise it would introduce bugs. So I figure I should only bother trying to speed it up if it is actually having a noticeable effect on the game speed.
 
Back
Top Bottom