Modders Guide to FfH2

You can turn on a lot of logging in the ini file. That's usually a good place to start.

Crash dump can also help. Too lazy right now to look up the instructions I got for setting that up :p

There's also (with the cheatcode set in the ini file) ctrl + z to reveal everything and checking for anything out of the ordinary. The cause is often a city finishing production and the CtD occuring due to bad graphic references in the XML files.

If you suspect a certain part of the code is causing the problem you can add your own logging there. Don't remember right now what I use to log things, been a few weeks since I last touched FfH.
 
There is no easy way. I would cut the major files back to 1 entry (units, techs, promotions, buildings, unitclasses, buildingclasses, spells, etc), remove all associations to other objects in those single entries and then load and start working through the errors.

Its going to take a little time but at least the system tells you what reference you missed and its all xml work so its fairly simple.

Strangely I cut back spells (and other files) to one entry, but I'm still getting XML errors from the spell file. It is as if the spell file is referencing missing elements from other files, but the tags giving the errors just aren't there. I have no idea where they are coming from.
 
Spells and Events are read at the end of certain cycles in the XML processing. The elements which come after them do not report properly, so always claim that the error comes from the last read file (spells or events). IIRC, spells tends to be Global Defines errors, so check out GlobalDefinesAlt.xml in the Assets/XML (and for when it comes up, Events is typically actually an error in Python somewhere)
 
Has the reason ever been discovered why units other than workers being able to build terrain improvements, or having UNITAI_WORKER, whatever it was, was causing problems for the AI?

I'm having a strange situation right now in Planetfall. The mod has always had a Supply Pod unit which everyone started with and which could be upgraded to various units, among which a former/worker. This never caused problems. However now suddenly with my latest patch in preparation, I'm getting 'Waiting on Civilization' freezes from formers which the previous turn had been upgraded from a Supply Pod. I'm mystified. :confused:
 
Planetfall formers can't build roads at all until somewhere in the mid-game. Yet it hasn't caused problems so far. :confused:

Has it been discovered what lines of code exactly regarding road building are causing the problem?

Edit: I had changed a build order, so that it built both a route and an improvement. Reverting that changed solved the problem. I still kinda wonder as to the cause of the problem though.

Thanks for the hint re the roads. If not for that hint, I'd have spend needless time searching what I did to the SDK which caused this, while the solution was in XML...
 
The checks which a worker performs to see if it can/should build an improvement make a lot of demands that the worker prepare a road before/after doing so, without checking to see if they are ABLE to build a road. Kinda funky oversight, and a bit of a nuisance.
 
Hi, I'm currently trying to make a unique weakened adept to replace the Amurite's initial scout , but I would like it to be unable to leave the player's territory (so it isn't such a huge scouting advantage with floating eye).

I couldn't find tags for that, so do you know how I could code it?
It would also help to have him pop into the territory when there is one, since he appears before you have any city, but otherwise I guess I could create him at city founding or make him a cheap unit available immediately (but it wouldn't feel as natural to me :sad:)
 
Spells and Events are read at the end of certain cycles in the XML processing. The elements which come after them do not report properly, so always claim that the error comes from the last read file (spells or events). IIRC, spells tends to be Global Defines errors, so check out GlobalDefinesAlt.xml in the Assets/XML (and for when it comes up, Events is typically actually an error in Python somewhere)

I trimmed all items in GlobalDefinesAlt.xml that referenced a unit, spell, bonus or any other file I cut back. I'm still getting errors. One error is:

Tag: IMPROVEMENT_WATER_WORKED in Info class was incorrect
Current XML file is: xml\Units/CIV4SpellInfos.xml

That tag isn't in either spellinfos or GlobalDefinesAlt. Nor is it in CIV4ImprovementInfos.xml. Do I need to cut GlobalDefinesAlt.xml back to nothing? Would the mod work then? Or would it create other problems?

I also get errors for land_worked, IMPROVEMENT_CITY_RUINS, CIVILIZATION_BARBARIAN, and several more, including quite few that seem to be gibberish:

Tag: T□5□L in Info class was incorrect
Current XML file is: xml\Units/CIV4SpellInfos.xml
 
That would be a global define that the game needs to have available to them. And an improvement which needs to exist in ImprovementInfos (as well as Land Worked). Both should be defined in the base GlobalDefines.xml from BtS/Civ4 themselves, so the error is that the game is trying to find them and cannot because you removed those improvements.

Same with Barbarian Civilization and most likely the City Ruins. The DLL requires those global defines, and those require the items they point at. So open the GlobalDefines.xml from BtS's Assets/XML folder and make sure anything listed in there exists in your mod folders.
 
Ok, thanks much. I added back in all the stuff needed by globaldefines. Now I can load up the game with zero XML errors. :)

But now I get one python error when I start up a game, and get a CtD after I take my first turn. :(

The error leads me to the ongamestart thing in CvEventManager.py. I assume there are lots of Python things that will cause crashes.. I don't know enough about Python to know what I can safely remove and what I need to remove for a stripped down version of the game to work. Any suggestions?

Edit: Ok, I took a look at it and took out a few things in CvEventManager.py, now the game starts fine with no python errors! :) Strangely however every tile on the map now has a farm on it... haha.
 
I thought there were no source changes in the last patch.
 
Ah, I thought the fact it wouldn't break saved games was an indication there were no dll changes. I thought that would break saved games. My bad.
 
Can someone point me in the right direction? I'm trying to find the list of city names specific to each civilization.
 
If you look in Assets/XML/Civilizations/CIV4CivilizationInfos.xml you will find a list of <CityName>_____</CityName> entries for each Civ. They point you to text keys (I think the format is TXT_KEY_<CivName>_CITY_#) which you will find in Assets/XML/Text/CIV4GameText_FfH2.xml. Each of those will contain the city name.
 
Back
Top Bottom