xml modding questions

maurcus

Warlord
Joined
May 24, 2012
Messages
245
I'm not sure if this is the right place to put it but i need some help with xml creating i need to know how to creat new xml without all of the errors. help
 
Moderator Action: Moved to the main forum.
Because the tutorials subforum is only for tutorials, not for questions ;).


@ problem: You do not really "create" XML files. You copy the one which is needed and make your changes in there.
 
i was meaning new lists inside of the documents.
 
Step 1: Read a tutorial. This one is particularly good. Come back when you've done that.
 
for creating knew units it will come up with an error stating:error in row 1334 column 13
 
Well, then, could you look at the row 1334, and perhaps copypaste it and the lines around it here?

I think it is a problem with unit classes, since that is one of the first errors I fell over back when I started modding.
 
for creating knew units it will come up with an error stating:error in row 1334 column 13
your having a problem adding a new unit and we're keen to help
but what we need is a clear description of which files you are editing, what those edits were, when the error occurs and in which file.
The more information you give us the better able we are to help.
 
the file is unit infos, the error is unit infos, the changes i created a new unit a cavalry replacement. and i haven't actually modified it yet i just copy and pasted a separate unit info onto it and then tried to modify it. any info would be nice. also does anyone know a good xml creating tool as opposed to a modding tool which i already have?
 
XML modifications is as simple as opening up the existing XML file using notepad or notepad+ and simply modify the values...
Of course, you copy the relevant XML files into the mod folder first rather than modify the original in the default BTS folder.

There is no need of any modding tool
 
if i want to create a new unit it is more than just modifying the values correct? i would have to create new lines of code right?
 
Just copy whole chunk of any unit from <UnitInfo> to </UnitInfo> and paste it in the same file.
Then just edit the name, strength, class etc to what you want.
Still simple copy, paste and edit.
Nothing you cannot do with simple notepad.

Of course, if you are creating a totally new unit, it is not just the UnitInfo file that you have to edit.
You will have to edit ArtDefineUnit, UnitClassInfo, Text file as well.
Just follow the tutorial
 
Creating really new "code lines" (not really the correct term) is a tad more complicated than just putting a new line in the XML. For now, the answer is just that it doesn't work in this way, and that you shouldn't try ;).

For your error: Probably an error while C&Ping, missed maybe a < or >.
If you give us your file and the line in which the error is...
 
the file is unit infos, the error is unit infos, the changes i created a new unit a cavalry replacement. and i haven't actually modified it yet i just copy and pasted a separate unit info onto it and then tried to modify it. any info would be nice. also does anyone know a good xml creating tool as opposed to a modding tool which i already have?
If you don't have notepad++, I would recommend it for XML, you can download it Here

Secondly (its worth saying again even if someone already has or you know it already) don't alter the actual game files, rather create a mod and copy the XML file to the mod before modifying it. So for unit infos copy it to: Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword\Mods\"your mod name"\Assets\XML\Units.

to add a cavalry replacement copy and paste the default cavalry entry and edit the <Type> entry you can see how in the example below of the Russian Cossack. The Cossack gets +50% vs mounted units (Highlighted in red), you will also need to alter the text files and the Art Define tag.
If during the edits the syntax of the file is altered in anyway, so that does not match the UnitSchema.xml you will get an error, when the game loads.
Spoiler :
Code:
		<UnitInfo>
			<Class>UNITCLASS_CAVALRY</Class>
			<Type>[COLOR="Red"]UNIT_RUSSIA_COSSACK[/COLOR]</Type>
			<UniqueNames/>
			<Special>NONE</Special>
			<Capture>NONE</Capture>
			<Combat>UNITCOMBAT_MOUNTED</Combat>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_ATTACK</DefaultUnitAI>
			<Invisible>NONE</Invisible>
			<SeeInvisible>NONE</SeeInvisible>
			<Description>[COLOR="Red"]TXT_KEY_UNIT_RUSSIA_COSSACK[/COLOR]</Description>
			<Civilopedia>[COLOR="red"]TXT_KEY_UNIT_RUSSIA_COSSACK_PEDIA[/COLOR]</Civilopedia>
			<Strategy>[COLOR="red"]TXT_KEY_UNIT_RUSSIA_COSSACK_STRATEGY[/COLOR]</Strategy>
			<Advisor>ADVISOR_MILITARY</Advisor>
			<bAnimal>0</bAnimal>
			<bFood>0</bFood>
			<bNoBadGoodies>0</bNoBadGoodies>
			<bOnlyDefensive>0</bOnlyDefensive>
			<bNoCapture>0</bNoCapture>
			<bQuickCombat>0</bQuickCombat>
			<bRivalTerritory>0</bRivalTerritory>
			<bMilitaryHappiness>1</bMilitaryHappiness>
			<bMilitarySupport>1</bMilitarySupport>
			<bMilitaryProduction>1</bMilitaryProduction>
			<bPillage>1</bPillage>
			<bSpy>0</bSpy>
			<bSabotage>0</bSabotage>
			<bDestroy>0</bDestroy>
			<bStealPlans>0</bStealPlans>
			<bInvestigate>0</bInvestigate>
			<bCounterSpy>0</bCounterSpy>
			<bFound>0</bFound>
			<bGoldenAge>0</bGoldenAge>
			<bInvisible>0</bInvisible>
			<bFirstStrikeImmune>0</bFirstStrikeImmune>
			<bNoDefensiveBonus>1</bNoDefensiveBonus>
			<bIgnoreBuildingDefense>1</bIgnoreBuildingDefense>
			<bCanMoveImpassable>0</bCanMoveImpassable>
			<bCanMoveAllTerrain>0</bCanMoveAllTerrain>
			<bFlatMovementCost>0</bFlatMovementCost>
			<bIgnoreTerrainCost>0</bIgnoreTerrainCost>
			<bNukeImmune>0</bNukeImmune>
			<bPrereqBonuses>0</bPrereqBonuses>
			<bPrereqReligion>0</bPrereqReligion>
			<bMechanized>0</bMechanized>
			<bSuicide>0</bSuicide>
			<bHiddenNationality>0</bHiddenNationality>
			<bAlwaysHostile>0</bAlwaysHostile>
			<UnitClassUpgrades>
				<UnitClassUpgrade>
					<UnitClassUpgradeType>UNITCLASS_GUNSHIP</UnitClassUpgradeType>
					<bUnitClassUpgrade>1</bUnitClassUpgrade>
				</UnitClassUpgrade>
			</UnitClassUpgrades>
			<UnitClassTargets/>
			<UnitCombatTargets/>
			<UnitClassDefenders/>
			<UnitCombatDefenders/>
			<FlankingStrikes>
				<FlankingStrike>
					<FlankingStrikeUnitClass>UNITCLASS_CATAPULT</FlankingStrikeUnitClass>
					<iFlankingStrength>100</iFlankingStrength>
				</FlankingStrike>
				<FlankingStrike>
					<FlankingStrikeUnitClass>UNITCLASS_TREBUCHET</FlankingStrikeUnitClass>
					<iFlankingStrength>100</iFlankingStrength>
				</FlankingStrike>
				<FlankingStrike>
					<FlankingStrikeUnitClass>UNITCLASS_CANNON</FlankingStrikeUnitClass>
					<iFlankingStrength>100</iFlankingStrength>
				</FlankingStrike>
			</FlankingStrikes>
			<UnitAIs>
				<UnitAI>
					<UnitAIType>UNITAI_ATTACK</UnitAIType>
					<bUnitAI>1</bUnitAI>
				</UnitAI>
				<UnitAI>
					<UnitAIType>UNITAI_PILLAGE</UnitAIType>
					<bUnitAI>1</bUnitAI>
				</UnitAI>
			</UnitAIs>
			<NotUnitAIs/>
			<Builds/>
			<ReligionSpreads/>
			<CorporationSpreads/>
			<GreatPeoples/>
			<Buildings/>
			<ForceBuildings/>
			<HolyCity>NONE</HolyCity>
			<ReligionType>NONE</ReligionType>
			<StateReligion>NONE</StateReligion>
			<PrereqReligion>NONE</PrereqReligion>
			<PrereqCorporation>NONE</PrereqCorporation>
			<PrereqBuilding>NONE</PrereqBuilding>
			<PrereqTech>TECH_MILITARY_TRADITION</PrereqTech>
			<TechTypes>
				<PrereqTech>TECH_RIFLING</PrereqTech>
				<PrereqTech>TECH_HORSEBACK_RIDING</PrereqTech>
				<PrereqTech>NONE</PrereqTech>
			</TechTypes>
			<BonusType>BONUS_HORSE</BonusType>
			<PrereqBonuses/>
			<ProductionTraits/>
			<Flavors/>
			<iAIWeight>0</iAIWeight>
			<iCost>120</iCost>
			<iHurryCostModifier>0</iHurryCostModifier>
			<iAdvancedStartCost>100</iAdvancedStartCost>
			<iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
			<iMinAreaSize>-1</iMinAreaSize>
			<iMoves>2</iMoves>
			<bNoRevealMap>0</bNoRevealMap>
			<iAirRange>0</iAirRange>
			<iAirUnitCap>0</iAirUnitCap>
			<iDropRange>0</iDropRange>
			<iNukeRange>-1</iNukeRange>
			<iWorkRate>0</iWorkRate>
			<iBaseDiscover>0</iBaseDiscover>
			<iDiscoverMultiplier>0</iDiscoverMultiplier>
			<iBaseHurry>0</iBaseHurry>
			<iHurryMultiplier>0</iHurryMultiplier>
			<iBaseTrade>0</iBaseTrade>
			<iTradeMultiplier>0</iTradeMultiplier>
			<iGreatWorkCulture>0</iGreatWorkCulture>
			<iEspionagePoints>0</iEspionagePoints>
			<TerrainImpassables/>
			<FeatureImpassables/>
			<TerrainPassableTechs/>
			<FeaturePassableTechs/>
			<iCombat>15</iCombat>
			<iCombatLimit>100</iCombatLimit>
			<iAirCombat>0</iAirCombat>
			<iAirCombatLimit>0</iAirCombatLimit>
			<iXPValueAttack>4</iXPValueAttack>
			<iXPValueDefense>2</iXPValueDefense>
			<iFirstStrikes>0</iFirstStrikes>
			<iChanceFirstStrikes>0</iChanceFirstStrikes>
			<iInterceptionProbability>0</iInterceptionProbability>
			<iEvasionProbability>0</iEvasionProbability>
			<iWithdrawalProb>30</iWithdrawalProb>
			<iCollateralDamage>0</iCollateralDamage>
			<iCollateralDamageLimit>100</iCollateralDamageLimit>
			<iCollateralDamageMaxUnits>7</iCollateralDamageMaxUnits>
			<iCityAttack>0</iCityAttack>
			<iCityDefense>0</iCityDefense>
			<iAnimalCombat>0</iAnimalCombat>
			<iHillsAttack>0</iHillsAttack>
			<iHillsDefense>0</iHillsDefense>
			<TerrainNatives/>
			<FeatureNatives/>
			<TerrainAttacks/>
			<TerrainDefenses/>
			<FeatureAttacks/>
			<FeatureDefenses/>
			<UnitClassAttackMods>
				<UnitClassAttackMod>
					<UnitClassType>UNITCLASS_CANNON</UnitClassType>
					<iUnitClassMod>50</iUnitClassMod>
				</UnitClassAttackMod>
			</UnitClassAttackMods>
			<UnitClassDefenseMods/>
			[COLOR="red"]<UnitCombatMods>
				<UnitCombatMod>
					<UnitCombatType>UNITCOMBAT_MOUNTED</UnitCombatType>
					<iUnitCombatMod>50</iUnitCombatMod>
				</UnitCombatMod>
			</UnitCombatMods>[/COLOR]
			<UnitCombatCollateralImmunes/>
			<DomainMods/>
			<BonusProductionModifiers/>
			<iBombRate>0</iBombRate>
			<iBombardRate>0</iBombardRate>
			<SpecialCargo>NONE</SpecialCargo>
			<DomainCargo>NONE</DomainCargo>
			<iCargo>0</iCargo>
			<iConscription>0</iConscription>
			<iCultureGarrison>8</iCultureGarrison>
			<iExtraCost>0</iExtraCost>
			<iAsset>3</iAsset>
			<iPower>15</iPower>
			<UnitMeshGroups>
				<iGroupSize>3</iGroupSize>
				<fMaxSpeed>1.75</fMaxSpeed>
				<fPadTime>1</fPadTime>
				<iMeleeWaveSize>3</iMeleeWaveSize>
				<iRangedWaveSize>3</iRangedWaveSize>
				<UnitMeshGroup>
					<iRequired>3</iRequired>
					<EarlyArtDefineTag>[COLOR="red"]ART_DEF_UNIT_RUSSIA_COSSACK[/COLOR]</EarlyArtDefineTag>
				</UnitMeshGroup>
			</UnitMeshGroups>
			<FormationType>FORMATION_TYPE_DEFAULT</FormationType>
			<HotKey/>
			<bAltDown>0</bAltDown>
			<bShiftDown>0</bShiftDown>
			<bCtrlDown>0</bCtrlDown>
			<iHotKeyPriority>0</iHotKeyPriority>
			<FreePromotions/>
			<LeaderPromotion>NONE</LeaderPromotion>
			<iLeaderExperience>0</iLeaderExperience>
		</UnitInfo>
to add a completely new unit you will need to create a new unitclass in UnitClassInfos.xml.
 
alright but can i just use the default notepad that comes with the computer?
 
ok i got the unit to be created but now the game doesnt recognize any of the units.
 
You know... it helps to provide more details for people to understand what is wrong to help...

1) Upload the problematic file
2) Provide screenshot
3) Explain in details exactly what is wrong
 
ok when ever i try to load the game it will say cannot find xml file for (enter unit name i.e. swordsman) for every unit i will try to upload the file.
 
Top Bottom