need code help with overrides

mrmcduff

Chieftain
Joined
Oct 11, 2010
Messages
8
Hello all - I need a little help with the override system. It's a different issue that was being addressed in my last thread.

I have the following in a Civ_Buff.xml file, which I have properly added to the XML.

Code:
<GameData>
	<Civilization_BuildingClassOverrides>
                <!-- First, try out overriding a building class. -->
		<Row>
			<CivilizationType>CIVILIZATION_AMERICA</CivilizationType>
			<BuildingClassType>BUILDINGCLASS_LIBRARY</BuildingClassType>
			<BuildingType>BUILDING_PAPER_MAKER</BuildingType>
		</Row>
	</Civilization_BuildingClassOverrides>

        <!-- Now try overriding a unit class. -->
	<Civilization_UnitClassOverrides>
		<Row>
			<CivilizationType>CIVILIZATION_AMERICA</CivilizationType>
			<UnitClass>UNITCLASS_CROSSBOWMAN</UnitClass>
			<UnitType>UNIT_CHINESE_CHUKONU</UnitType>
		</Row>
	</Civilization_UnitClassOverrides>
        
        <!-- Now let's give away a free unit. -->
	<Civilization_FreeUnits>
		<Row>
			<CivilizationType>CIVILIZATION_AMERICA</CivilizationType>
			<UnitClassType>UNITCLASS_SCOUT</UnitClassType>
			<Count>1</Count>
			<UnitAIType>UNITAI_EXPLORE</UnitAIType>
		</Row>
	</Civilization_FreeUnits>
  </GameData>

None of these things seem to work. I was able to add traits to leaders and edit the yield values of different buildings, but I can't seem to add overrides. The code looks the same to me as similar tables in the Civ5 Civilizations XML file.

Can anyone pinpoint the issue? One of my goals is to widely vary all the civs by having almost entirely unique buildings, but there's no way that'll work if I can't do overrides.

Thanks!
 
Your code works fine. It just doesn't update the loading screen for the civ. Try starting an advanced era game. You should get papermakers instead of libraries.
 
Yep. Shouldn't be anything wrong with that code.

Keep in mind that on the civ selection screen, there's only room to display 2 UU's or UB's (or any combination thereof).

If you start a new game and check out the tech tree, you can see whether the changes have taken effect (unless you put a LOT of units or buildings in 1 tech, in which case you run into the above issue again).
 
I'm afraid it doesn't work; I played a whole game through. No papermakers, no scout to start, no chukonu. Other parts of the mod did work, though, so I don't think it's something wrong with loading.
 
I'm having the same problem though I'm adding new buildings instead of just referencing an existing one. Mod loads fine and no debug errors but the new buildings just aren't there. :sad:

I've spent about three hours now just going over the code just to make sure I didn't miss a reference somewhere or something stupid. Very frustrating.
 
I used the code you wrote word for word and tested it out, and it worked fine. Try starting a new solution. It's possible the old one is corrupted.
 
I've got the correct OnModActivated action set to UpdateDatabase, and i've checked the spelling of my file names, etc, a dozen or so times. I'll see if adding this in a similar mod with a different name will fix the issue.
 
I just tried again: created a completely new solution, copied over the code, rebuilt, loaded the new mod. I didn't play through the whole thing, but I could tell it didn't work because there was no free Scout on startup.

Is there an easy way to just not apply a single file that I must be hitting? The only thing I can think of is that I could have not properly done the OnModActivated UpdateDatabase action, but that doesn't appear to be the problem. Does the ordering of the OnModActivated calls matter? I didn't really pay attention to which file was on top of the list for the actions.
 
I'm running into the same thing. I gave up on my own code for the moment and I'm just copying the code from the tutorial to try and add a palisade tot he game. Not working either. Took screen shots of each page anyone see what I'm doing wrong?

EDIT: Nevermind i got the palisades to work by Building testingmyskills instead of building the solution. unfortunatly that didn't fix my own code so i'm still stuck unable to add a third Unique to a civ.
 

Attachments

  • modinfo.jpg
    modinfo.jpg
    255.7 KB · Views: 87
  • modactions.jpg
    modactions.jpg
    266.6 KB · Views: 111
  • firsrxml.jpg
    firsrxml.jpg
    277.6 KB · Views: 76
  • secondxml.jpg
    secondxml.jpg
    232.8 KB · Views: 101
  • thirdxml.jpg
    thirdxml.jpg
    263.9 KB · Views: 91
Woot, found the error in my own code and now it works. 8 civilization that didn't have one now have a Unique building. Moving on the the other 11 that need units now, thankfully it's just coding and I've already decided what to do with them.

Hope you have the same luck mrmcduff!
 
i'm afraid luck just isn't with me. i'm not sure what the problem is, and the fix is similarly evading me.
 
Code:
<GameData>
	[B][I]<Civilizations>[/I][/B]
			<Civilization_BuildingClassOverrides>
				<!-- First, try out overriding a building class. -->
				<Row>
					<CivilizationType>CIVILIZATION_AMERICA</CivilizationType>
					<BuildingClassType>BUILDINGCLASS_LIBRARY</BuildingClassType>
					<BuildingType>BUILDING_PAPER_MAKER</BuildingType>
				</Row>
			</Civilization_BuildingClassOverrides>

			<!-- Now try overriding a unit class. -->
			<Civilization_UnitClassOverrides>
				<Row>
					<CivilizationType>CIVILIZATION_AMERICA</CivilizationType>
					<UnitClass>UNITCLASS_CROSSBOWMAN</UnitClass>
					<UnitType>UNIT_CHINESE_CHUKONU</UnitType>
				</Row>
			</Civilization_UnitClassOverrides>

			<!-- Now let's give away a free unit. -->
			<Civilization_FreeUnits>
				<Row>
					<CivilizationType>CIVILIZATION_AMERICA</CivilizationType>
					<UnitClassType>UNITCLASS_SCOUT</UnitClassType>
					<Count>1</Count>
					<UnitAIType>UNITAI_EXPLORE</UnitAIType>
				</Row>
			</Civilization_FreeUnits>
	[B][I]</Civilizations>[/I][/B]
</GameData>
You forgot to write <Civilizations> in that code
 
Code:
<GameData>
	[B][I]<Civilizations>[/I][/B]
			<Civilization_BuildingClassOverrides>
				<!-- First, try out overriding a building class. -->
				<Row>
					<CivilizationType>CIVILIZATION_AMERICA</CivilizationType>
					<BuildingClassType>BUILDINGCLASS_LIBRARY</BuildingClassType>
					<BuildingType>BUILDING_PAPER_MAKER</BuildingType>
				</Row>
			</Civilization_BuildingClassOverrides>

			<!-- Now try overriding a unit class. -->
			<Civilization_UnitClassOverrides>
				<Row>
					<CivilizationType>CIVILIZATION_AMERICA</CivilizationType>
					<UnitClass>UNITCLASS_CROSSBOWMAN</UnitClass>
					<UnitType>UNIT_CHINESE_CHUKONU</UnitType>
				</Row>
			</Civilization_UnitClassOverrides>

			<!-- Now let's give away a free unit. -->
			<Civilization_FreeUnits>
				<Row>
					<CivilizationType>CIVILIZATION_AMERICA</CivilizationType>
					<UnitClassType>UNITCLASS_SCOUT</UnitClassType>
					<Count>1</Count>
					<UnitAIType>UNITAI_EXPLORE</UnitAIType>
				</Row>
			</Civilization_FreeUnits>
	[B][I]</Civilizations>[/I][/B]
</GameData>
You forgot to write <Civilizations> in that code
Um, no. The structure is, in fact, <GameData><tablename>...row/update/delete</tablename>...</GameData>
 
I was under the impression that the <Civilizations> tag was specifically not supposed to be in there. I can give it a try, I suppose, but I don't have high hopes at this point.
 
Yeah his code is fine (it looks exactly like the 19 i just published), it has to be either in the way he's building or in the command line he's giving. It may seem silly but I did it so I'm sure others have, make sure in the command line pointing to the file that you are using / and not \. Also when you go to build make sure you build just the project and not the whole solution, I don't know why yet but when doing the whole solution it doesn't always apply the changes.

Another thing you want to do is edit your config.ini so you can actually see your error logs(in particular the database one) untill i edited my config all it gave was an old generic error log so i thought my XML was silently dieing.

The file is Documents\My Games\sid meier's Civilization 5\config.ini the setting you want to look for is something like LoggingEnabled or enablelogging I'm not at home so I can't check. But once you change that you can actually see the errors your files might generate. If there is no error and the change did take place then the file wasn't sen to the database.
 
Back
Top Bottom