Some SDK Difficulties

Voyhkah

Undead
Joined
Apr 25, 2009
Messages
1,444
Location
Earth
I've been trying some SDK modding for my upcoming mod, and I'm having trouble with a modcomp I'm working on.
Here are some of the errors:

Failed Loading XML file xml\Civilizations/CIV4TraitInfos.xml.
LoadXML call failed for Civilizations/CIV4TraitInfos.xml.
Allocating zero or less memory in
CvXMLLoadUtility::SetVariableListTagPair
Current XML file is: xml\GameInfo/CIV4CivicOptionInfos.xml
I didn't even touch CIV4CivicOptionInfos.xml.
Something I missed.
Assert Failed

File: CvGlobals.cpp
Line: 3493
Expression: strcmp(sz Type, "NONE")==0||strcmp(sz Type, "")==0
Message: info type TRAIT_SPIRITUAL not found, Current XML file is: xml\Buildings/CIV4SpecialBuildingInfos.xml
Why SpecialBuildingInfos? And why is CvGlobals giving me an error? I didn't even touch it!
TRAIT_SPIRITUAL in Info class was incorrect
Current XML file is: xml\Buildings/CIV4SpecialBuildingInfos.xml
There are more siblings than memory allocated for them in
CvXMLLoadUtility::SetVariableListTagPair
Current XML file is: xml\Buildings/CIV4BuildingInfos.xml
Tag: TRAIT_PROTECTIVE in Info class was incorrect
Current XML file is: xml\Buildings/CIV4BuidingInfos.xml
There are more siblings than memory allocated for them in
CvXMLLoadUtility::SetVariableListTagPair
Current XML file is: xml\Buildings/CIV4BuildingInfos.xml
And so on for every trait mentioned in BuildingInfos.
Failed Loading XML file xml\Civilizations/CIV4LeaderHeadInfos.xml.
LoadXML call failed for Civilizations/CIV4LeaderHeadInfos.xml
Do I need to say more?

Thanks for helping!
 
I'm guessing that you've changed Civ4TraitInfos.xml?
All the errors are related to this, since they cannot find some (or all) traits.
 
I'm guessing that you've changed Civ4TraitInfos.xml?
All the errors are related to this, since they cannot find some (or all) traits.

I figured that much out, but why might there be an error in TraitInfos?
 
I figured that much out, but why might there be an error in TraitInfos?

Did you make any changes to this file?
If you did - post it so we could take a look.
If not - maybe it's deleted for some reason?
 
Yes, I did.

Code:
<TraitInfo>
			<Type>TRAIT_COLONIZATIONAL</Type>
			<Description>TXT_KEY_TRAIT_COLONIZATIONAL_LONG</Description>
			<ShortDescription>TXT_KEY_TRAIT_COLONIZATIONAL_SHORT</ShortDescription>
			<iHealth>0</iHealth>
			<iHappiness>0</iHappiness>
			<iMaxAnarchy>-1</iMaxAnarchy>
			<iUpkeepModifier>0</iUpkeepModifier>
			<iLevelExperienceModifier>0</iLevelExperienceModifier>
			<iGreatPeopleRateModifier>0</iGreatPeopleRateModifier>
			<iGreatGeneralRateModifier>100</iGreatGeneralRateModifier>
			<iDomesticGreatGeneralRateModifier>0</iDomesticGreatGeneralRateModifier>
			<iMaxGlobalBuildingProductionModifier>0</iMaxGlobalBuildingProductionModifier>
			<iMaxTeamBuildingProductionModifier>0</iMaxTeamBuildingProductionModifier>
			<iMaxPlayerBuildingProductionModifier>0</iMaxPlayerBuildingProductionModifier>
			<ExtraYieldThresholds/>
			<TradeYieldModifiers/>
			<CommerceChanges/>
			<CommerceModifiers/>
			<FreePromotions/>
			<FreePromotionUnitCombats/>
			<bNoColPenalty>1</bNoColPenalty>
		</TraitInfo>

And I appropriately changed the Schema:
Code:
<ElementType name="TraitInfo" content="eltOnly">
		<element type="Type"/>
		<element type="Description"/>
		<element type="ShortDescription"/>
		<element type="iHealth"/>
		<element type="iHappiness"/>
		<element type="iMaxAnarchy"/>
		<element type="iUpkeepModifier"/>
		<element type="iLevelExperienceModifier"/>
		<element type="iGreatPeopleRateModifier"/>
		<element type="iGreatGeneralRateModifier"/>
		<element type="iDomesticGreatGeneralRateModifier"/>
		<element type="iMaxGlobalBuildingProductionModifier"/>
		<element type="iMaxTeamBuildingProductionModifier"/>
		<element type="iMaxPlayerBuildingProductionModifier"/>
		<element type="ExtraYieldThresholds"/>
		<element type="TradeYieldModifiers"/>
		<element type="CommerceChanges"/>
		<element type="CommerceModifiers"/>
		<element type="FreePromotions"/>
		<element type="FreePromotionUnitCombats"/>
<!--Voyhkah's Tag: -->
		<element type="bNoColPenalty" content="textOnly" dt:type="boolean" minOccurs="0" />
<!-- -->
	</ElementType>
 
In the schema you need to make 2 changes: Define your new tag and define where it's added.
You've mixed the two together.

You need to have this:
Code:
<ElementType name="bNoColPenalty" content="eltOnly" dt:type="boolean" />

Before this:
Code:
<ElementType name="TraitInfo" content="eltOnly">

And you should change what you added to this:
Code:
<element type="bNoColPenalty" minOccurs="0" />
 
I changed it to this:

Code:
<!-- Voyhkah's Changes-->
	<ElementType name="bNoColPenalty" content="eltOnly" dt:type="boolean" />
<!-- / -->
	<ElementType name="TraitInfo" content="eltOnly">
		<element type="Type"/>
		<element type="Description"/>
		<element type="ShortDescription"/>
		<element type="iHealth"/>
		<element type="iHappiness"/>
		<element type="iMaxAnarchy"/>
		<element type="iUpkeepModifier"/>
		<element type="iLevelExperienceModifier"/>
		<element type="iGreatPeopleRateModifier"/>
		<element type="iGreatGeneralRateModifier"/>
		<element type="iDomesticGreatGeneralRateModifier"/>
		<element type="iMaxGlobalBuildingProductionModifier"/>
		<element type="iMaxTeamBuildingProductionModifier"/>
		<element type="iMaxPlayerBuildingProductionModifier"/>
		<element type="ExtraYieldThresholds"/>
		<element type="TradeYieldModifiers"/>
		<element type="CommerceChanges"/>
		<element type="CommerceModifiers"/>
		<element type="FreePromotions"/>
		<element type="FreePromotionUnitCombats"/>
<!--Voyhkah's Tag: -->
		<element type="bNoColPenalty" minOccurs="0" />
<!-- -->

But the error still comes up! :mad:
 
Is the tag order in Civ4TraitInfos equivelant to the order in the schema?
 
Maybe remove your comments from the XML files? I heard that they sometimes cause trouble.

EDIT: Yeah, what deanej said :p
 
Still doesn't work :(
 
Here you go!
 
My mistake. It should have been 'textOnly' in the content field, and not 'eltOnly'. like this:

Code:
<!-- Voyhkah's Changes-->
	<ElementType name="bNoColPenalty" content="[B]textOnly[/B]" dt:type="boolean" />
<!-- / -->
	<ElementType name="TraitInfo" content="eltOnly">
		<element type="Type"/>
		<element type="Description"/>
		<element type="ShortDescription"/>
		<element type="iHealth"/>
		<element type="iHappiness"/>
		<element type="iMaxAnarchy"/>
		<element type="iUpkeepModifier"/>
		<element type="iLevelExperienceModifier"/>
		<element type="iGreatPeopleRateModifier"/>
		<element type="iGreatGeneralRateModifier"/>
		<element type="iDomesticGreatGeneralRateModifier"/>
		<element type="iMaxGlobalBuildingProductionModifier"/>
		<element type="iMaxTeamBuildingProductionModifier"/>
		<element type="iMaxPlayerBuildingProductionModifier"/>
		<element type="ExtraYieldThresholds"/>
		<element type="TradeYieldModifiers"/>
		<element type="CommerceChanges"/>
		<element type="CommerceModifiers"/>
		<element type="FreePromotions"/>
		<element type="FreePromotionUnitCombats"/>
<!--Voyhkah's Tag: -->
		<element type="bNoColPenalty" minOccurs="0" />
<!-- -->
 
Now I get:
Faited Loading XML file xm;\Civilizations/CIV4LeaderHeadInfos.xml.
[.\FXml.cpp:133]Error parsing XML File-
File:
xml\Civilizations/CIV4LeaderHeadInfos.xml
Reason: Element content is invalid accouding to the DTD/Schema.
Expecting:
{x-schema:CIV4CivilizationsSchema.xml}iRefuseToTalkWarThreshold.

Line 19,22
Source:
<iEspionageWeight>0</iEspionageWeight>

I didn't even TOUCH LeaderHeadInfos!
 
I don't know where you got the schema you sent me, but it has some differences to the original BTS one. One of which is that in the original BTS file there is:

Code:
<element type="iEspionageWeight"/>

defined in the schema for leader heads.
For some reason it does not exist in your schema. I'm guessing that the mod you're basing your mod on removed that, but you'll need to take that mod's leader heads XML file to comply.

BTW, it'll really help you to try and understand these error messages yourself.
In this case, it is expecting 'iRefuseToTalkWar', because that's the next element defined in the schema, but instead it gets 'iEspionageWeight' which is not.
 
Weird... I'm not basing this mod on anything... I must have deleted it accidentally :blush:

I copy-pasted the original BtS Schema file into my mod, made the appropriate changes, and it worked! Now I have another question: Does the game validate the file CvGameCoreDLL as it loads the mod or during play?
 
I'm not sure what you mean by "validates"...
If you mean it in the XML sense, then it's not getting validated at all, since there's no 'schema' of any sort for that.

The DLL file is just more binary code - an addition to the binary code already in the exe.
It is loaded right after you run the game, and the exe calls different entry points in it whenever it needs.
What kind of validation did you have in mind?
 
I meant, if there's an error in code that's only called when something happens, does the game tell me about the error when it loads or when the code with the error is called?
 
Back
Top Bottom