View Full Version : How Do I Hook Up Unit Art?


OzzyKP
Nov 25, 2007, 12:37 AM
Browsing through the download section there are some AMAZING units available, but none of them have the corresponding XML. I'm trying to figure it out on my own, but every unit seems to do things differently.

For example, I want to add this amazing Sioux Cuirassier unit (http://forums.civfanatics.com/downloads.php?do=file&id=7460). I unzip it and I find 14 files (none of which are XML of course). There are two NIFs, one TGA, and 11 DDS'.

So which files do I link to from which spot in CIV4ArtDefines_Unit.xml?

Here is the standard BTS Cuirassier entry:

<UnitArtInfo>
<Type>ART_DEF_UNIT_CUIRASSIER</Type>
<Button>,Art/Interface/Buttons/Units/ICBM.dds,Art/Interface/Buttons/Beyond_the_Sword_Atlas.dds,3,11</Button>
<fScale>0.42</fScale>
<fInterfaceScale>1.0</fInterfaceScale>
<bActAsLand>0</bActAsLand>
<bActAsAir>0</bActAsAir>
<NIF>Art/Units/Cuirassier/Cuirassier.nif</NIF>
<KFM>Art/Units/Cuirassier/Cuirassier.kfm</KFM>
<SHADERNIF>Art/Units/Cuirassier/Cuirassier_FX.nif</SHADERNIF>
<ShadowDef>
<ShadowNIF>Art/Units/01_UnitShadows/HorseShadow.nif</ShadowNIF>
<ShadowAttachNode>HorseBip Spine1</ShadowAttachNode>
<fShadowScale>1.0</fShadowScale>
</ShadowDef>
<fBattleDistance>0.35</fBattleDistance>
<fRangedDeathTime>0.31</fRangedDeathTime>
<bActAsRanged>0</bActAsRanged>
<TrainSound>AS2D_UNIT_BUILD_UNIQUE_UNIT</TrainSound>
<AudioRunSounds>
<AudioRunTypeLoop/>
<AudioRunTypeEnd/>
</AudioRunSounds>
</UnitArtInfo>

Which goes where, and why?

I tried putting Sioux_Cuirassier.nif in the <nif> field, and tried BoundShape.nif in the <SHADERNIF> field and the unit doesn't show up in the civilopedia (and I assume in the game as well). I try putting that BoundShape.nif file in <ShadowNIF> and I get the default BTS Cuirassier. I try just leaving out the boundshape file altogether and I again get the default unit.

Another example, a Siege Gun (http://forums.civfanatics.com/downloads.php?do=file&id=2512). For this unit there are 13 files, again none of them XML. But we have only one NIF this time, one KFM, nine KFs, and two DDS'.

For the Texas Ranger there are two NIFs, and three DDS'. For this Canadian cannon there are 14 DDS', 23 KF's, 2 KFMs, 7 NIFs, and one BMP.

Every unit designer has their own way of doing things it seems and it takes me at least half an hour of trial and error to hook up each unit. :wallbash:

Any tips?

CXDamian
Nov 25, 2007, 12:57 AM
Theres a good guide by Rabbit, White: Adding newly created unit to Civ4 in 6 "easy" steps

There's some differences in BtS, however(namely formations and unitartdefines): Modders Guide to BtS (http://forums.civfanatics.com/showthread.php?t=229557)

OzzyKP
Nov 25, 2007, 08:11 AM
Awesome, thank you.

This was the part I needed to hear:
Change both <NIF> and <SHADERNIF> so that they point to the location of the new unit’s NIF files. If the unit (as it comes in the zip) has an _fx version of the file then the SHADERNIF tag should point to that. If not then the SHADERNIF tag should point to the same file as the NIF tag.

OzzyKP
Nov 25, 2007, 10:18 AM
Ok, another question. I downloaded this brown cavalry unit (http://forums.civfanatics.com/downloads.php?do=file&id=1493), and the file contains just one DDS file. What do I do with that?


Also, these Canadian units. (http://forums.civfanatics.com/downloads.php?do=file&id=7250).. for the Grenadier and Rifleman, they have an fx.nif file, a bound shape, and several freeze files, but no regular NIF. I've tried using the FX for both the <NIF> and <SHADERNIF>, that doesn't work. Just using it for <SHADERNIF> doesn't work. Hooking up one of the freeze files doesn't work. Grrr.

GeoModder
Nov 25, 2007, 02:42 PM
First of all, never mind the boundshape .nif. It is a link to the nifviewer which enables you to open the unit in the nifviewer without the need to drop all those files in the viewer's folder. Think of it as a shortcut.

If you have only a .dds file, you only need to create in your mod the same folder structure like with the original unit (in this case the cavalry). drop the .dds file in it and you'll see ingame that all cavalry units will look brown. The use of a similar folder structure in a mod automatically overrides the civ folderstructure.
If you have a _fx file, but no "normal" .nif, you need to copy the art stats in artdefines_unit of the unit closest resembling those canadian units, and in this copy only change the <shadernif> path to the folder you dropped those canadian units in.

That's all to it.


In general, .dds files are attached to the .nif file by the artists and these give the units its outlook. Remove those .dds files from the folder and the .nif file will look completely pink when you open it in the nifviewer.

OzzyKP
Nov 25, 2007, 04:29 PM
Awesome, thanks! :goodjob:

marx&engles
Nov 25, 2007, 10:00 PM
I also got interested in adding new units recently. One thing that you might want to look into is Varietas Delectat, which make the units more ethnically diverse.

Also, look up modular units, and modular xml loading. These come complete with all the xml files and are easy to use.