BONUS_COPPER not found in Civ4EspionageMissionInfo.xml? Huh?

Dave Lawson

Chieftain
Joined
Jan 6, 2008
Messages
57
So, I've gone ahead and removed most of the content of the game. Lots and lots of xml data ripped outta there. A couple of different times, for different reasons, I see exceptions being generated in this file (Civ4EspionageMissionInfo.xml), for things that seemingly have nothing to do with this file.

In one case, after I had removed copper from the game (as well as all dependencies on copper in the xml) I would see this exception thrown at the end of the first turn.

So, I chose to reintroduce all of the bonus resources, and simply remove all of their dependencies on outside objects (techs, improvements, etc.), and that seemed to resolve, or more likely sweep under the carpet, the issue.

Now, I'm in the process of modifying some of the units (warriors, workers, scouts and settlers are all that remain in the game), and at the end of the first turn, an exception is being generated (again they claim it's generated in Civ4EspionageMissionInfo.xml) whereby UNIT_ARCHER can't be found. UNITCOMBAT_ARCHER doesn't exist in any of the xml files, and certainly has nothing at all to do with the indicated file.

Are there hard-coded dependencies that are completely unrepresented in the XML? Does the AI insists on building an archer at the start of the game, regardless of whether or not they exist. Or does the AI decides to go get copper immediately, even though copper doesn't exist. Or is this culprit (Civ4EspionageMissionInfo.xml) simply a scapegoat that comes up all the time when something goes funky?

So many questions, and so little experience. Throw me a bone, please!

After a bit more testing, it seems that the problem comes up only when I have a city.

So I put back all of the UNITCOMBAT_BLAH stuff, and gave it another shot. It seemed to work at first, but by about turn 75 there was another exception, claiming to originate in the same file, to the effect that UNIT_PRIVATEER could not be found. Again, there doesn't exist a reference to UNIT_PRIVATEER in the raw xml files. I'm really starting to suspect that there are hardcoded dependencies on particular units and entities.
 
I don't know if this is on the right track or not, but..

Did you edit only the BtS XML files or also the Warlords and vanilla XML files? BtS uses information from all three, so if you only stripped the one there might still be references to the others. For example, AIs start Monarch and higher difficulties with archers, so if you removed archers but didn't change the handicap infos file, you'll get an error.
 
I've been rather thorough in my searching, and in no xml file on my hard disk do the terms UNITCLASS_ARCHER, UNIT_PRIVATEER, UNIT_SPY, BONUS_COPPER, or BONUS_HORSE appear. No in the basic civ 4 xml or in the beyond the sword xml.

The only work around I've been able to manage is to reintroduce all of the bonuses, as well as the UNITCLASS_ARCHER, UNIT_PRIVATEER, and UNIT_SPY. At that point I can load up and play the game (seemingly) without problem. It's not quite as empty as I had hoped, but it's not far from it.

My suspicion is that it has to do with the advisors trying to suggest what to build, but I can hardly guarantee that. I'm not familiar enough with the dll code as of yet to really have a meaningful opinion on this front.
 
Never, ever, EVER make changes to the actual files. Always copy the files you are changing into Mods/Your_Mod/Assets. Did you do this?
 
I think I may have been over zealous in my statement.
I should have said that they don't exist in any xml files that haven't been superceded by xml files not containing said tags.
I am assuming that in all cases, if I add ABC.xml to my mod, the engine will NOT load the base ABC.xml. I could be wrong though.

My bad on making an obviously silly statement though. Sorry.
 
I am assuming that in all cases, if I add ABC.xml to my mod, the engine will NOT load the base ABC.xml. I could be wrong though.

That's correct.

What files are in your mod? What you may want to do is search for files that aren't in your mod that call BONUS types, UNITCLASS types, and UNIT types...

For instance, the Events files reference bonuses, unitclasses, and units all the time. Are they in your mod?
 
Well, as it stands, there's quite a list of files. It might be easier to explain how I went about it, instead of listing them. My process was rather straightforward.
First I copied the entire BtS assets/xml into my mod folder's assets, and removed all relevant references from those.
Next I searched through the base files in civ4/assets/xml for any files that weren't overridden by bts xmls and contained the suspect tags. I then copied each of those files into my mod, and updated them to respect the new bts xml schemas, while removing the problematic references.
Still, something is refering to UNIT_PRIVATEER, UNITCLASS_ARCHER, etc.

Is there another place these references could exist?
 
I don't think so.

Try stripping the Espionage file of everything (Replace the whole file with something like this)

Code:
<?xml version="1.0"?>
<!-- edited with XMLSPY v2004 rel. 2 U (http://www.xmlspy.com) by Alex Mantzaris (Firaxis Games) -->
<!-- Sid Meier's Civilization 4 -->
<!-- Copyright Firaxis Games 2005 -->
<!-- -->
<!-- EspionageMissionMission Infos -->
<Civ4EspionageMissionInfo xmlns="x-schema:CIV4GameInfoSchema.xml">
	<EspionageMissionInfos/>
</Civ4EspionageMissionInfo>
 
I have. Unfortunately, the schema requires that there be at least one entry in that list. I've not yet been so bold as to modify the underlying schema, as I expect that would have ramifications in the class structures themselves, and I don't want to open that can of worms just yet.

The same error occurs if I have all but one of the espionage missions removed.
 
Then I really have no other advice.

Just add back in whatever is causing the error, but for instance, if it's a unit, set it's build cost to "-1" so it doesn't show up on the build units panel.


Anyway, you can't modify the schema without modifying the DLL.
 
Thanks, that'll do just fine for the time being. Now, hopefully I can drop'em from the pedia, too.
 
My guess is that it's being referenced in the python related to events. Search in the python folder for the troubled strings (BONUS_COPPER, UNITCOMBAT_ARCHER, etc) using notepad++.
 
My guess is that it's being referenced in the python related to events. Search in the python folder for the troubled strings (BONUS_COPPER, UNITCOMBAT_ARCHER, etc) using notepad++.

But why would that have anything to do with the Espionage Mission Infos?

In any event, you are correct. However, I'm not sure what to do about the problem, because they specifically warn you in the RandomEventInterface.py file not to change the names of the functions, as they're "App Entry Points from C++".
 
Espionage is the last XML file which loads, so any bad references after that claim that you are in Espionage when they happen. Typically the bad reference is in your mapscript at this point, sometimes in other python areas.
 
I think I found the culprit:

Code:
if (not gc.getPlayer(pCity.getOwner()).isFeatAccomplished(FeatTypes.FEAT_UNIT_PRIVATEER)):

	if (pUnit.getUnitType() == gc.getInfoTypeForString("UNIT_PRIVATEER")):
		
		gc.getPlayer(pCity.getOwner()).setFeatAccomplished(FeatTypes.FEAT_UNIT_PRIVATEER, True)

CvAdvisorUtils has all of the "Feats" to trigger (FEAT_ARCHER, FEAT_PRIVATEER, FEAT_COPPER_CONNECTED, FEAT_IRON_CONNECTED, etc.), and I don't know where they are listed. The lack of ""s or ''s around them make me suspect they are hardcoded somewhere else, either in python or in C++.
 
Someone involved in FFH dev would know that as they would have had to remove it. My hunch is that it's not, and is just in the python. I'd wager you can remove it without issue. You could just try, and see what happens.
 
Unfortunately, the feats themselves are hardcoded. But, you can remove the code that triggers them from the Event Manager (in onBuildingBuilt, for instance, a line triggers the feat code "CvAdvisorUtils.buildingBuiltFeats" or something like that).

The feats themselves are in CvEnums.h and CvEnumsInterface.cpp. They might be elsewhere as well.
 
Back
Top Bottom