[TUTORIAL] Modular XML Modding With A New Dawn

The Artwork

Setting up Artwork for the Building.


Opening our Civ4ArtDefines_Building, we are confronted with the old palace entry. These entries deserve a short explanation

<Type> - The Name of the Art Entry. This should match the one in your Civ4BuildingInfos

<LSystem> - The Size of the building in the city. Since we have no graphic, pick the smallest size, 1x1. There are other options, like 2x2, 2x3, 3x3, etc... and pre-defined specially named ones, like PALACE.

<bAnimated> - If the building has animations.

<fScale> - The scale of the building that appears in the city. Set to 0 for no art.

<fInterfaceScale> - The scale of the building in the Civilopedia. Set to 0 for no art.

<NIF> - The path to the .nif file that contains your artwork. If there is no art, set it to a special value,
"Art/Empty.nif"

<KFM/> - Used for special animations. Generally, leave it alone.

<Button> - The path to the button. In this case, it should be "Modules/OurFolderName/OurFolder/OurButton.dds".

Note: The button name should not have commas in it. The entries that do have commas are referencing a large file, called an Atlas, which is one large file of buttons. Also, make sure there is no whitespace in the path to the button. Whitespace will cause pink icons to appear.

If you have a building graphic to go with your building:

If you found a building graphic for your building, copy it to your Working folder. If you wish to seperate it from the XML, you can create an Art folder inside your working folder and move it there. This is not necessary, however.

Inside the graphic files for the building should be a SOME_FILE_NAME.nif. The NIF extension is key here.

Use the relative path to your art nif, so the path should look like this:

"Modules/Town_Well/Art/Town_Well.nif"

The actual path may vary, but it should start with the Modules, and End with the NIF. Put this value inside of the NIF text spot, where the Palace entry currently is.

The fScale and fInterfaceScale control how big the building shows up in game, and the LSystem controls what space is uses. This is all subjective. I would try a 2x2 Lsystem value first, and 1.0 in each of the fScale and fInterfaceScale.

Notice one thing here. fScale has a f in front of the name, so it is a floating point data type. This means it can hold fractional values.

To get these values right usually takes a few adjustments, loading the game up, looking in the civilopedia and worldbuilder until you are satisfied.

If you have no artwork for your building:

If you have no artwork, then the file is rather easy to set up, we 0 most of the entries, set the Lsystem to a 1x1 for an empty building, set the nif to "Art/Empty.nif" and change the Art Name to the same as the one in the Building Infos.


Creating a Button

Creating a button is easier than you think.

First, find an image that you think is suitable. Square images work best, otherwise we will need to crop or resize them. I will be using this one:



You can use the image editor of your choice, but the MS Paint that comes with Windows7 is actually really good.

Resize the picture until you get it to a 64x64 image. Then, paste this image frame overtop of it, it's the standard Civ4 border icon.



At this point, you should have an icon that looks like this:



Civ4 reads icons that are in a special format, DDS. There is a great free image converter, I highly recommend, DXTBMP.

Once you have it installed, open your icon with it.

once you have your icon loaded, you should be at this screen:
Spoiler :


Now, select the box in the upper right corner, indicated here:
Spoiler :


Ignore the warning pop-up. Now you will need to select an "Alpha" channel for the button. Basically, the alpha channel is what makes the button look like a button. Without it, your button will look very odd. The default alpha channel to use is this one.


Select it. It should appear in the alpha box. Now, select file->save as->DDS Texture.
A context menu will appear. Save the button as a DDS DXT3. Any other setting will cause your button to appear improperly in Civ.

All that is left is to update the button path with our new button. Once that is done, save the Art defines.

Here's the completed Art Defines to Reference, the button name and path may differ:

Spoiler :
Code:
<?xml version="1.0"?>
<!-- edited with XMLSPY v2004 rel. 2 U (http://www.xmlspy.com) by Firaxis Games (Firaxis Games) -->
<!-- Sid Meier's Civilization 4 -->
<!-- Copyright Firaxis Games 2005 -->
<!-- -->
<!-- Building art path information -->
<Civ4ArtDefines xmlns="x-schema:CIV4ArtDefinesSchema.xml">
	<BuildingArtInfos>
		<BuildingArtInfo>
			<Type>ART_DEF_BUILDING_TOWN_WELL</Type>
			<LSystem>LSYSTEM_1x1</LSystem>
			<bAnimated>0</bAnimated>
			<fScale>0</fScale>
			<fInterfaceScale>0</fInterfaceScale>
			<NIF>Art/Empty.nif</NIF>
			<KFM/>
			<Button>Modules/Town_Well/Town_Well.dds</Button>
		</BuildingArtInfo>
	</BuildingArtInfos>
</Civ4ArtDefines>
 
I revised it for you Hydro. Unfortuantly, using NIF is a painful and general process, hard to explain.
 
You have two errors with your Art Defines.

Your Copy:
Code:
<?xml version="1.0"?>
<!-- edited with XMLSPY v2004 rel. 2 U (http://www.xmlspy.com) by Firaxis Games (Firaxis Games) -->
<!-- Sid Meier's Civilization 4 -->
<!-- Copyright Firaxis Games 2005 -->
<!-- -->
<!-- Building art path information -->
[COLOR="Red"]<Civ4BuildingClassInfos xmlns="x-schema:Water_CIV4BuildingsSchema.xml">[/COLOR]
	<BuildingArtInfos>
		<BuildingArtInfo>
			<Type>ART_DEF_BUILDING_TOWN_WELL</Type>
			<LSystem>LSYSTEM_1x1</LSystem>
			<bAnimated>0</bAnimated>
			<fScale>0</fScale>
			<fInterfaceScale>0</fInterfaceScale>
			<NIF>Art[COLOR="red"]/Structures/Buildings/Palace/[/COLOR]empty.nif</NIF>
			<KFM/>
			<Button>Modules/Hydro/Water/art/townwell.dds</Button>
		</BuildingArtInfo>
	</BuildingArtInfos>
</Civ4ArtDefines>

Correct:
Code:
<?xml version="1.0"?>
<!-- edited with XMLSPY v2004 rel. 2 U (http://www.xmlspy.com) by Firaxis Games (Firaxis Games) -->
<!-- Sid Meier's Civilization 4 -->
<!-- Copyright Firaxis Games 2005 -->
<!-- -->
<!-- Building art path information -->
<Civ4ArtDefines xmlns="x-schema:Water_CIV4ArtDefinesSchema.xml">
	<BuildingArtInfos>
		<BuildingArtInfo>
			<Type>ART_DEF_BUILDING_TOWN_WELL</Type>
			<LSystem>LSYSTEM_1x1</LSystem>
			<bAnimated>0</bAnimated>
			<fScale>0</fScale>
			<fInterfaceScale>0</fInterfaceScale>
			<NIF>Art/empty.nif</NIF>
			<KFM/>
			<Button>Modules/Hydro/Water/art/townwell.dds</Button>
		</BuildingArtInfo>
	</BuildingArtInfos>
</Civ4ArtDefines>

I put the wrong lines in red. Compare them against the correct copy, below yours.
 
Oops! I may have the same problem with another file when updating the documents with
<Civ4BuildingClassInfos xmlns="x-schema:Water_CIV4BuildingsSchema.xml">.

I fixed it on my computer.

However should both Water_CIV4BuildingClassInfos and Water_CIV4BuildingInfos have <Civ4BuildingClassInfos xmlns="x-schema:Water_CIV4BuildingsSchema.xml">?
 
I updated the above post, the 1st error was bigger than I originally thought.

Also, look back in your Civ4BuildingInfos, there is an error with the technologies:

Code:
			<TechTypes>
			<PrereqTech>TECH_POTTERY</PrereqTech>
			[COLOR="Red"]</TechTypes/>[/COLOR]

That last forward slash is wrong, it should look like this:
Code:
			<TechTypes>
			<PrereqTech>TECH_POTTERY</PrereqTech>
			</TechTypes>

Also, another bug. You aren't using the new schema I gave your for buildings. You can't use new tags I created without an updated Schema. You can rename the Example_Civ4BuildingInfosSchema to Water_Civ4BuildingInfosSchema if you want, but you need to use the updated one.

One more bug:
Code:
				<ReplaceBuilding>
					<BuildingClassType>BUILDINGCLASS_BUILDINGCLASS_CANNERY</BuildingClassType>
					<bReplace>1</bReplace>
				</ReplaceBuilding>

See if you spot this one yourself

Spoiler :
Hint: Check the name of the Cannery again.
 
However should both Water_CIV4BuildingClassInfos and Water_CIV4BuildingInfos have <Civ4BuildingClassInfos xmlns="x-schema:Water_CIV4BuildingsSchema.xml">?

No. One is a Civ4BuildingInfos, and one is Civ4BuildingClassInfos. Check the RoM XML files if you are unsure. ;)
 
Great. Since you knew how to do the text already, you should be good to go. Test it out! ;)
 
Ack! Hold on ...

Also, another bug. You aren't using the new schema I gave your for buildings. You can't use new tags I created without an updated Schema. You can rename the Example_Civ4BuildingInfosSchema to Water_Civ4BuildingInfosSchema if you want, but you need to use the updated one.

What where huh?

Tangent
When i read the word "Schema" I imagine Shawn Connery trying to say the word "cinema".
 
You still haven't updated the schema! Go back and re-read that section.
 
Yeah, you forgot to update the name in the Civ4CivicInfos for the schema. If you change the name of a schema file, you need to reflect the file name change in the XML files. See here:

<Civ4CivicInfos xmlns="x-schema:CIV4GameInfoSchema.xml">

Should be

<Civ4CivicInfos xmlns="x-schema:Water_CIV4GameInfoSchema.xml">
 
Well I just changed those back without the water_

Anywho so now I have no loading errors but in civlopedia I see that it replaces the palace instead of being replaced by the cannery. In otherwords it should not be replacing anything. But should be replaced by other things like the artesian well and the cannery. What did i do wrong here?
 
Top Bottom