Simple XML Editing Issues Help Thread

Bill Bisco

Callous Calling
Joined
Apr 28, 2007
Messages
590
If you're having troubles editing the XML and getting it to work correctly in your mod. Post a question here. If you can help; post an answer.


Q1: My Code is:
Code:
<GameData>
	<Units>
		<Update>
			<Set Combat="97"/>
			<Where Type="UNIT_WARRIOR"/>
		</Update>	
	</Units>
</GameData>
in an XML file called TestCiv5Units.xml

My Modbuddy Code is:

Code:
<Actions>
    <OnModActivated>
      <UpdateDatabase>TestCiv5Units.xml</UpdateDatabase>
    </OnModActivated>
</Actions>

My Iroquois warrior's Strength is still 6 and not 97. What am I doing wrong?
 
I tried to add a unit here is the code but nothing happens

MooClass.xml

<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 10/1/2010 11:12:54 AM -->
<GameData>
<!-- TODO: Insert table creation example here. -->

<!-- TODO: Insert table data example here.-->

<!-- Enter your Game Data here. -->
<UnitClasses>
<Row>
<ID>0</ID>
<Type>UNITCLASS_MOO</Type>
<Description>Moo</Description>
<DefaultUnit>UNIT_MOO</DefaultUnit>
</Row>
</UnitClasses>
</GameData>

in MooUnit.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- Created by ModBuddy on 10/1/2010 11:05:16 AM -->
<GameData>
<!-- TODO: Insert table creation example here. -->

<!-- TODO: Insert table data example here.-->

<!-- Enter your Game Data here. -->
<Units>
<Row>
<ID>0</ID>
<Class>UNITCLASS_MOO</Class>
<Type>UNIT_MOO</Type>
<Combat>6</Combat>
<Cost>37</Cost>
<Moves>2</Moves>
<CombatClass>UNITCOMBAT_MELEE</CombatClass>
<Domain>DOMAIN_LAND</Domain>
<DefaultUnitAI>UNITAI_ATTACK</DefaultUnitAI>
<Description>Moo Unit</Description>
<Civilopedia>TXT_KEY_CIV5_ANTIQUITY_WARRIOR_TEXT</Civilopedia>
<Strategy>TXT_KEY_UNIT_WARRIOR_STRATEGY</Strategy>
<Help>TXT_KEY_UNIT_HELP_WARRIOR</Help>
<MilitarySupport>true</MilitarySupport>
<MilitaryProduction>true</MilitaryProduction>
<Pillage>true</Pillage>
<ObsoleteTech>TECH_METAL_CASTING</ObsoleteTech>
<GoodyHutUpgradeUnitClass>UNITCLASS_SPEARMAN</GoodyHutUpgradeUnitClass>
<AdvancedStartCost>10</AdvancedStartCost>
<XPValueAttack>3</XPValueAttack>
<XPValueDefense>3</XPValueDefense>
<Conscription>1</Conscription>
<UnitArtInfo>ART_DEF_UNIT__WARRIOR</UnitArtInfo>
<UnitFlagIconOffset>3</UnitFlagIconOffset>
<IconAtlas>UNIT_ATLAS_1</IconAtlas>
<PortraitIndex>3</PortraitIndex>
</Row>
</Units>
<Unit_AITypes>
<Row>
<UnitType>UNIT_MOO</UnitType>
<UnitAIType>UNITAI_ATTACK</UnitAIType>
</Row>
<Row>
<UnitType>UNIT_MOO</UnitType>
<UnitAIType>UNITAI_DEFENSE</UnitAIType>
</Row>
<Row>
<UnitType>UNIT_MOO</UnitType>
<UnitAIType>UNITAI_EXPLORE</UnitAIType>
</Row>
</Unit_AITypes>
</GameData>


I did enable "Reload Unit System" but nothing happens still. Someone please help.
 
My Modbuddy Code is:

Code:
<Actions>
    <OnModActivated>
      <UpdateDatabase>TestCiv5Units.xml</UpdateDatabase>
    </OnModActivated>

My Iroquois warrior's Strength is still 6 and not 97. What am I doing wrong?

Does this section close of with an </Actions>, just to be safe?
 
I tried to add a unit here is the code but nothing happens...

Did you use OnModActivated, like the OP? If not, open your mods properties window. In the Actions tab enter

OnModActivate UpdateDatabase YourFile.xml

for each xml file you have.

In future, when posting code, use them CODE tags, and try to keep your indentation. ;) It makes everything easier to read. :D
 
A1

My Modbuddy Code should have been:

Code:
<Actions>
    <OnModActivated>
      <UpdateDatabase>[B]XML/[/B]TestCiv5Units.xml</UpdateDatabase>
    </OnModActivated>
</Actions>

Hehe, the path name is very sensitive obviously, and the game won't tell you that you're referring to it wrong. ;)
 
Q2

I've tried this code, but it doesn't work:
Code:
<GameData>
	<Units>
		<Update>
			<Where Class="UNITCLASS_WARRIOR"/>
			<Set Combat="97"/>
			<Set Moves="97"/>
		</Update>
	</Units>
</GameData>

However, this code does work:

Code:
<GameData>
	<Units>
		<Update>
			<Where Class="UNITCLASS_WARRIOR"/>
			<Set Combat="97"/>
		</Update>
		<Update>
			<Where Class="UNITCLASS_WARRIOR"/>
			<Set Moves="97"/>
		</Update>
	</Units>
</GameData>

Is there an easy way to streamline the bottom code to take up fewer lines?
 
Q2

I've tried this code, but it doesn't work:

Is there an easy way to streamline the bottom code to take up fewer lines?

Based on what I have seen I'm pretty sure either of these should work:

Code:
<GameData>
	<Units>
		<Update>
			<Where Class="UNITCLASS_WARRIOR"/>
			<Set Combat="97" Moves="97"/>
		</Update>
	</Units>
</GameData>

Code:
<GameData>
	<Units>
		<Update>
			<Where Class="UNITCLASS_WARRIOR"/>
			<Set>
				<Combat>97</Combat>
				<Moves>97</Moves>
			</Set>
		</Update>
	</Units>
</GameData>
 
mjs0 has it correct, however it will change every warrior. If you just want to change the Iroquois you will need to change it to:

Code:
<GameData>
	<Units>
		<Update>
			<Set Combat="97"/>
			<Where Type="UNIT_IROQUOIAN_MOHAWKWARRIOR"/>
		</Update>	
	</Units>
</GameData>
 
Back
Top Bottom