• Civilization 7 has been announced. For more info please check the forum here .

vanilla 2 warlords xml converter (van2war2.pl)

primordial stew

Emperor
Joined
Sep 1, 2005
Messages
1,219
Location
a puddle
After much pain, a complete re-write (thus the second 2), and much agony, here is van2war2.pl. :D

WHAT: a perl script which converts vanilla civ4 xml into warlords xml. It will create the directory tree (eg xml/units, xml/art, etc..) and put the processed files in there. Note that not all files are processed! See the directions below.

All new tags get 0 for binary or integer types, and NONE for others. To see what was added, check out the debug.log.

There is no known dependency on the version of Warlords. Whatever schema files are found in the install are used.

HOW:
0. backup your mod!

1. install perl if necessary (any of these will work, take your pick!)
http://www.cpan.org/ports/
http://win32.perl.org/wiki/index.php?title=Strawberry_Perl
http://www.activestate.com/Products/ActivePerl/

2. rename your mod's xml dir (eg xml.orig)
The program will create a new tree named "xml.orig.converted" (following the eg above).

3. download van2war2.pl + edit it (any text editor will do)
http://forums.civfanatics.com/uploads/61935/van2war2.zip
set: $civ4XmlDir to be the path to your warlords xml directory
set: $modDir to point at your mod's xml dir

4. run it.
Depending on which perl is installed, double-clicking on the program may work, or open a dos/cmd window, cd to where van2war2.pl is and run "perl van2war2.pl".

5. re-name $convertedDir unless it already has the correct name (eg assets/xml/xml.orig.converted to assest/xml/xml)

6. copy over missing files.
xml/text <-- directory + files in it
xml/GlobalDefinesAlt.xml <-- file
xml/Audio <-- directory + files in it
I think this is all...

7. check assets/xml.orig/debug.log. There shouldn't be any errors near the end. The program stops on errors. For example using spaces instead of tabs will cause an error.

8. at this point the program is done. Almost certainly there is more work required to get your mod working in Warlords (eg dll, python, graphics), but that is beyond the scope of this utility. It should save you the mundane work of adding the new tags to all of your data, that is all.


ANNOYANCES: things that could get fixed, but probably won't:
1. all comments get stripped out
2. xml must be tab spaced (ie human readable) for the parser to work. While it is valid to use spaces instead of tabs (or no spacing at all..), and newlines are not necessary from Warlords point of view, this program won't work without them!
3. I had hoped the program could also port from warlords back to vanilla, but I'm thinking no one will do this anyway.
 
Grabbing these out of the debug.log, here are the new tags from civIV 1.61 to warlords 2.08. The exact order of the new tags is beyond the scope of this post :p So if someone wanted to do this manually :crazyeye: , here they are. Now, just insert them with valid values in the correct order foreach instance in each of those files.

Note to modders, if Beyond The Swords adds any new xml tags, the script should still work since it reads the schema files.

Spoiler :
buildings/CIV4BuildingClassInfos.xml bMonument
buildings/CIV4BuildingInfos.xml HappinessTraits
buildings/CIV4BuildingInfos.xml bBorderObstacle
buildings/CIV4BuildingInfos.xml iBombardDefense
buildings/CIV4BuildingInfos.xml iDomesticGreatGeneralRateModifier
buildings/CIV4BuildingInfos.xml iGreatGeneralRateModifier
buildings/CIV4BuildingInfos.xml iHurryAngerModifier
civilizations/CIV4LeaderHeadInfos.xml VassalRefuseAttitudeThreshold
civilizations/CIV4LeaderHeadInfos.xml iVassalPowerModifier
civilizations/CIV4TraitInfos.xml iDomesticGreatGeneralRateModifier
civilizations/CIV4TraitInfos.xml iGreatGeneralRateModifier
civilizations/CIV4TraitInfos.xml iHappiness
civilizations/CIV4TraitInfos.xml iLevelExperienceModifier
gameinfo/CIV4CivicInfos.xml iDomesticGreatGeneralRateModifier
gameinfo/CIV4CivicInfos.xml iExpInBorderModifier
gameinfo/CIV4CivicInfos.xml iGreatGeneralRateModifier
gameinfo/CIV4EraInfos.xml bFirstSoundtrackFirst
technologies/CIV4TechInfos.xml bVassalTrading
terrain/CIV4BonusInfos.xml iAIObjective
terrain/CIV4ImprovementInfos.xml bActsAsCity
units/CIV4PromotionInfos.xml PromotionPrereq
units/CIV4PromotionInfos.xml bLeader
units/CIV4PromotionInfos.xml iCollateralDamageProtection
units/CIV4PromotionInfos.xml iExperiencePercent
units/CIV4PromotionInfos.xml iHillsAttack
units/CIV4PromotionInfos.xml iKamikazePercent
units/CIV4PromotionInfos.xml iPillageChange
units/CIV4PromotionInfos.xml iRevoltProtection
units/CIV4PromotionInfos.xml iUpgradeDiscount
units/CIV4UnitInfos.xml LeaderPromotion
units/CIV4UnitInfos.xml UnitClassDefenders
units/CIV4UnitInfos.xml UnitClassTargets
units/CIV4UnitInfos.xml UnitCombatCollateralImmunes
units/CIV4UnitInfos.xml UnitCombatDefenders
units/CIV4UnitInfos.xml UnitCombatTargets
units/CIV4UnitInfos.xml iHillsAttack
units/CIV4UnitInfos.xml iLeaderExperience
 
Top Bottom