Changing unique units. (need help)

Nilmerf

Warlord
Joined
Oct 2, 2006
Messages
181
Basically, I'm trying to change the Carthaginian unique unit from the Numidian Cavalry to the Carthaginian War Elephant found in Jecrell's mod for vanilla Civ.

http://forums.civfanatics.com/showthread.php?t=139107

I've added all of the graphics to my personal mod folder, and tried to edit the XML files accordingly, but always come up with errors when loading the mod. The errors seem to occur in the Civ4Units.xml file and the Civ4ArtDefines_Unit.xml file. Any advice or even outright creation of an XML file for me would be great!

Thanks.
 

asioasioasio

Fallout Scrubber
Joined
Mar 4, 2006
Messages
3,058
Location
Poland, EU
and what error do you get?
 

Nilmerf

Warlord
Joined
Oct 2, 2006
Messages
181
Failed loading XML file XML\Units/CIV4UnitInfos.xml. [.FXml.cpp:133] Error parsing XML File -
File: XML\Units/CIV4UnitInfos.xml
Reason: Element content is invalid according to the DTD/Schema.
Expecting: {x-schema:CIV4UnitSchema.xml}UnitClassTargets.

Line: 15467,13
Source: <UnitAIs>

Then it goes on to list all of the unique units, saying they're unable to load. In game all civs appear to have no unique unit.
 

asioasioasio

Fallout Scrubber
Joined
Mar 4, 2006
Messages
3,058
Location
Poland, EU
It coulf be two problems (maybe it's other one but i know only this two situation when this error comes):

1. You've deleted to much - deleting one line will cause DTD/Schema (shortly DTD is made for keeping xml out of errors) to get error. - So you propably could delete somethin in line 15467 on nearby (if you don't see the number of lines - download something better than notepad - i use freeware pspad it gives the numbers of line)

2. You didn't closse one tag - all the tags should be this way <unitclass></unitclass> - then the tag is closed, or eventually <unitclass/> - this means that tag is empty.
And also search in 15647 line and nearby units' xml lines - and once again i recommend you pspad - it shows the tree of xml (you may choose show me tree from menu) and you can see when the code is getting broken.
 

Nilmerf

Warlord
Joined
Oct 2, 2006
Messages
181
<UnitAIs>
<UnitAI>
<UnitAIType>UNITAI_ATTACK</UnitAIType>
<bUnitAI>1</bUnitAI>
</UnitAI>
<UnitAI>
<UnitAIType>UNITAI_COUNTER</UnitAIType>
<bUnitAI>1</bUnitAI>
</UnitAI>
</UnitAIs>

That is lines 15467-15476.
 

asioasioasio

Fallout Scrubber
Joined
Mar 4, 2006
Messages
3,058
Location
Poland, EU
hmm talking about nearby i thought about failled and neighbour unit - but's ok i suppose what that could be - (probably it's the third situation - i didn't know about it) you use carthaginian war elephants from vanila civ4 and try to paste it to warlords code

check if you have typed all the data marked bold (i used ordinary war elephants from the game so you could paste only marked bold tags to your carthaginian war elephant code)

<UnitInfo>
<Class>UNITCLASS_WAR_ELEPHANT</Class>
<Type>UNIT_WAR_ELEPHANT</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>TXT_KEY_UNIT_WAR_ELEPHANT</Description>
<Civilopedia>TXT_KEY_UNIT_WAR_ELEPHANT_PEDIA</Civilopedia>
<Strategy>TXT_KEY_UNIT_WAR_ELEPHANT_STRATEGY</Strategy>
<Advisor>ADVISOR_MILITARY</Advisor>
<bAnimal>0</bAnimal>
<bFood>0</bFood>
<bNoBadGoodies>0</bNoBadGoodies>
<bOnlyDefensive>0</bOnlyDefensive>
<bNoCapture>0</bNoCapture>
<bRivalTerritory>0</bRivalTerritory>
<bMilitaryHappiness>1</bMilitaryHappiness>
<bMilitarySupport>1</bMilitarySupport>
<bMilitaryProduction>1</bMilitaryProduction>
<bPillage>1</bPillage>
<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>0</bIgnoreBuildingDefense>
<bCanMoveImpassable>0</bCanMoveImpassable>
<bFlatMovementCost>0</bFlatMovementCost>
<bIgnoreTerrainCost>0</bIgnoreTerrainCost>
<bNukeImmune>0</bNukeImmune>
<bPrereqBonuses>0</bPrereqBonuses>
<bPrereqReligion>0</bPrereqReligion>
<bMechanized>0</bMechanized>
<UnitClassUpgrades>
<UnitClassUpgrade>
<UnitClassUpgradeType>UNITCLASS_CAVALRY</UnitClassUpgradeType>
<bUnitClassUpgrade>1</bUnitClassUpgrade>
</UnitClassUpgrade>
</UnitClassUpgrades>
<UnitClassTargets/>
<UnitCombatTargets/>
<UnitClassDefenders/>
<UnitCombatDefenders/>

<UnitAIs>
<UnitAI>
<UnitAIType>UNITAI_ATTACK</UnitAIType>
<bUnitAI>1</bUnitAI>
</UnitAI>
<UnitAI>
<UnitAIType>UNITAI_COUNTER</UnitAIType>
<bUnitAI>1</bUnitAI>
</UnitAI>
</UnitAIs>
<NotUnitAIs/>
<Builds/>
<ReligionSpreads/>
<GreatPeoples/>
<Buildings/>
<ForceBuildings/>
<HolyCity>NONE</HolyCity>
<ReligionType>NONE</ReligionType>
<StateReligion>NONE</StateReligion>
<PrereqReligion>NONE</PrereqReligion>
<PrereqBuilding>NONE</PrereqBuilding>
<PrereqTech>TECH_CONSTRUCTION</PrereqTech>
<TechTypes/>
<BonusType>BONUS_IVORY</BonusType>
<PrereqBonuses/>
<ProductionTraits/>
<Flavors/>
<iAIWeight>0</iAIWeight>
<iCost>60</iCost>
<iHurryCostModifier>0</iHurryCostModifier>
<iMinAreaSize>-1</iMinAreaSize>
<iMoves>1</iMoves>
<iAirRange>0</iAirRange>
<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>
<TerrainImpassables/>
<FeatureImpassables/>
<iCombat>8</iCombat>
<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>0</iWithdrawalProb>
<iCollateralDamage>0</iCollateralDamage>
<iCollateralDamageLimit>0</iCollateralDamageLimit>
<iCollateralDamageMaxUnits>0</iCollateralDamageMaxUnits>
<iCityAttack>0</iCityAttack>
<iCityDefense>0</iCityDefense>
<iAnimalCombat>0</iAnimalCombat>
<iHillsAttack>0</iHillsAttack>
<iHillsDefense>0</iHillsDefense>
<TerrainNatives/>
<FeatureNatives/>
<TerrainDefenses/>
<FeatureDefenses/>
<UnitClassAttackMods/>
<UnitClassDefenseMods/>
<UnitCombatMods>
<UnitCombatMod>
<UnitCombatType>UNITCOMBAT_MOUNTED</UnitCombatType>
<iUnitCombatMod>50</iUnitCombatMod>
</UnitCombatMod>
</UnitCombatMods>
<UnitCombatCollateralImmunes/>
<DomainMods/>
<BonusProductionModifiers/>
<iBombRate>0</iBombRate>
<iBombardRate>0</iBombardRate>
<SpecialCargo>NONE</SpecialCargo>
<DomainCargo>NONE</DomainCargo>
<iCargo>0</iCargo>
<iConscription>0</iConscription>
<iCultureGarrison>5</iCultureGarrison>
<iExtraCost>0</iExtraCost>
<iAsset>2</iAsset>
<iPower>4</iPower>
<UnitMeshGroups>
<iGroupSize>2</iGroupSize>
<fMaxSpeed>1.75</fMaxSpeed>
<iMeleeWaveSize>2</iMeleeWaveSize>
<iRangedWaveSize>2</iRangedWaveSize>
<UnitMeshGroup>
<iRequired>2</iRequired>
<EarlyArtDefineTag>ART_DEF_UNIT_WAR_ELEPHANT</EarlyArtDefineTag>
</UnitMeshGroup>
</UnitMeshGroups>
<Button>,Art/Interface/Buttons/Units/WarElephant.dds,Art/Interface/Buttons/Unit_Resource_Atlas.dds,7,2</Button>
<HotKey/>
<bAltDown>0</bAltDown>
<bShiftDown>0</bShiftDown>
<bCtrlDown>0</bCtrlDown>
<iHotKeyPriority>0</iHotKeyPriority>
<FreePromotions/>
<LeaderPromotion>NONE</LeaderPromotion>
<iLeaderExperience>0</iLeaderExperience>

</UnitInfo>
 

Nilmerf

Warlord
Joined
Oct 2, 2006
Messages
181
I applied the changes, tested it out in game and it works great.. thanks a lot! Makes sense that Warlords needs extra code.
 

asioasioasio

Fallout Scrubber
Joined
Mar 4, 2006
Messages
3,058
Location
Poland, EU
hehe np :). It's good that it works now :)
 
Top Bottom