Processes.xml Question

Ateleiotos

Chieftain
Joined
Nov 4, 2010
Messages
5
I'm trying to add an early era process for converting Production into Food and the xml I have isn't working. It's not showing up in the tech tree nor in the city build window. I'm hoping it's something simple in the code that I missed and not some quirk of the game that prevents a new process from being added.

Code:
[SIZE="2"]<GameData>
	<Processes>
		<Row>
			<Type>PROCESS_FOOD</Type>
			<Description>TXT_KEY_PROCESS_FOOD</Description>
			<Help>TXT_KEY_PROCESS_FOOD_HELP</Help>
			<Strategy>TXT_KEY_PROCESS_FOOD_STRATEGY</Strategy>
			<TechPrereq>TECH_POTTERY</TechPrereq>
			<PortaitIndex>7</PortaitIndex>
			<IconAtlas>CITIZEN_ATLAS</IconAtlas>
		</Row>
	</Processes>
	<Process_ProductionYields>
		<Row>
			<ProcessType>PROCESS_FOOD</ProcessType>
			<YieldType>YIELD_FOOD</YieldType>
			<Yield>25</Yield>
		</Row>
	</Process_ProductionYields>
	<Language_en_US>
		<Row Tag="TXT_KEY_PROCESS_FOOD">
			<Text>Food</Text>
		</Row>
		<Row Tag="TXT_KEY_PROCESS_FOOD_STRATEGY">
			<Text>Process Food Strategy</Text>
		</Row>
		<Row Tag="TXT_KEY_PROCESS_FOOD_HELP">
			<Text>Converts [ICON_PRODUCTION] production into food.</Text>
		</Row>
	</Language_en_US>
</GameData>[/SIZE]

Also, I don't know the icon atlases at all and I'm hoping someone can point me to a food icon of the appropriate size for use with this new process.

Thank you!
 
And what do the logfiles say?

Specifically, the Database.log and xml.log files should tell you EXACTLY why your XML is being rejected (if it is). So make sure your logging is turned on, and check those files after your mod loads.
 
Ah, I forgot to mention; neither the database.log file nor the xml.log file show any errors on this file or any particular strings in it. Also, I did make sure I added the UpdateDatabase action for the xml file. The xml.log file did have the following:

Code:
[SIZE="2"][183.597] **** Validating Game Database *****
[184.408] Performing Localization Checks
[184.408] Checking Tag Format...
[184.408] Note: Tags must only use [A-Z_] characters, start with 'TXT_KEY_', and be under 128 characters long.
[184.424] Validating UnitGameplay
[184.424] Number of selection sounds doesn't match number of units.
[184.424] Validating Notifications
[184.424] **** VALIDATION FAILED *****
[184.424] Validation Took 0.839603 seconds
[185.656] **** Validating Prefetch Process *****
[185.656] **** Validation Success *****
[185.656] SetGlobalActionInfo
[185.656] [/SIZE]

However, there's nothing to indicate why the validation failed.

The database.log file had the following errors:

Code:
[SIZE="2"][174.112] constraint failed
[174.112] While executing - 'INSERT INTO ArtDefine_StrategicView(StrategicViewType, TileType, Asset) VALUES(?,?,?)'
[183.628] Validating Foreign Key Constraints...
[183.628] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[183.628] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[183.628] Invalid Reference on ArtDefine_Landmarks.LayoutHandler - "SPECIAL" does not exist in ArtDefine_LandmarkTypes
[184.408] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_PRIVATEER" does not exist in Units
[184.408] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_SPANISH_GALLEON" does not exist in Units
[184.408] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_SPANISH_TREASURE CART" does not exist in Units
[184.408] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_DANISH_LONGBOAT" does not exist in Units
[184.408] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_SAXON_HUSCARL" does not exist in Units
[184.408] Invalid Reference on UnitGameplay2DScripts.UnitType - "UNIT_POLYNESIAN_WAR_CANOE" does not exist in Units
[184.408] Failed Validation.[/SIZE]

But they don't relate to anything in my mod, and other than process.xml my mod loads just fine. Thank you for taking a look!
 
I just pasted your text into my own mod, and it DID give an error in the Database.log. Specifically, you misspelled "PortraitIndex" (you left out the second R).

So maybe your log files aren't fully turned on, maybe you messed up the OnModActivated command somehow, or maybe you opened the log file before it had loaded. Remember, there'll be TWO blocks of error messages in these log files. The first block is for the core game's files, the second block is for your mods' files, so if you opened the log file before it had fully loaded your mods, it wouldn't do the second block.

If you don't think that was the problem, post your .modinfo file. (If that doesn't work, you can just attach the whole thing to a post.)
 
New processes don't work without changes to the interface. You need to change ProductionPopup.xml and ProductionPopup.lua, like it's done here. (But they should be visible in the tech tree even without these changes, they just aren't selectable in cities.)

I think it's a bad design decision to hardcode processes in the interface in a game that it's supposed to be moddable like Civ5, but we have to live with it.
 
New processes don't work without changes to the interface.

Slight correction: they won't work for the PLAYER. The AI isn't limited by the interface, so while I haven't confirmed this, it might still be possible for the AI players to use your new process. Whether they'd know how to do that is a separate issue; since Processes have no Flavor ratings of their own, I haven't been able to tell whether the AI moves down the chain to evaluate the yield in question, or whether the underlying preferences are hard-coded inside the engine. (I was trying to make a Culture-generating Process a long time ago, and ran into this same issue.)

I'm in the middle of rewriting the ProductionPopup code for my own mod, and one of the things I'm trying to do is remove that UI hard-coding. There are quite a few other places where the game hard-codes things (the eras in the tech tree, for instance) that I've been making more flexible as well.
 
@Spatzimaus, thank you! I had looked through the code character by character and still missed that spelling mistake. I thought logging was either on or off, I didn't realize there were levels of logging. How do I make sure logging is fully turned on?

@PawelS, I did run into the issue you described; it was in the tech tree but not in the build screen. Thanks for the link! I'm wondering why my search for "Process" didn't turn up the thread you linked to though. Thanks almost exactly what I was trying to create!

Is it possible to change the xml for a mod given just the .civ5mod file?
 
@Spatzimaus, thank you! I had looked through the code character by character and still missed that spelling mistake. I thought logging was either on or off, I didn't realize there were levels of logging. How do I make sure logging is fully turned on?

In your config.ini file, in your user directory, there are a dozen or so logging flags. The critical ones are EnableTuner and LoggingEnabled, but beyond that there are a bunch of other ones with "Log" in their names; which ones you want to enable are up to you.

Now, I thought the Database.log WAS automatically turned on at the base level, in which case you should have seen that error yourself. So it might not be a function of which logs you enable, and one of the other potential causes I outlined would be at fault. But you might as well turn most of them on regardless; the worst that happens is a couple extra text files are created in your Logs directory and the machine runs a tiny bit slower as you play.
 
Back
Top Bottom