View Full Version : Civ4UNITCLASSINFOS problem


jbryant
Mar 04, 2009, 08:57 PM
I keep getting this goofy problem saying that my beginning and ending tags don't match. It's not only causing an error with the unit I'm trying to add, but it's screwing up the whole file! Please help! I have attached screenshots of the error and the XML file below.

phungus420
Mar 04, 2009, 09:09 PM
That's odd. The error message says the endtag <UnitClassInfos/> doesn't match. That would lead one to believe that you deleted, or changed the start tag.

The top of the file should go:
<Civ4UnitClassInfos>
<UnitClassInfos>
<UnitClassInfo>
...
That's what that error usually means at least, the begin and end tag aren't matching. Of course, the whole file should be messed up if that were the case, I suspect there might be something else wrong.

jbryant
Mar 04, 2009, 09:13 PM
Yeah I didn't touch that, so I'm not sure of the deal.

Tholish
Mar 04, 2009, 09:18 PM
<UnitClassGreatSpy> needs this at the end
</UnitClassGreatSpy>

phungus420
Mar 04, 2009, 09:20 PM
Nice catch Tholish. I wonder why the error message is spitting out line 827, in my experience that message has almost always given me the right line #.

mechaerik
Mar 04, 2009, 09:23 PM
I see the error: you didn't close the tag for the great spy. You must have accidently deleted it.

EDIT: Tholish beat me to it; stupid laggy internet.

EDIT2: Although Tholish is right in the location, it should be like this:
</UnitClassInfo>

Also, the error is almost always given where the error ends, and it can be damn hard to track down sometimes.

jbryant
Mar 04, 2009, 09:31 PM
You guys are great, thank you very much. While I've got you guys around let me ask you this: what exactly is the unit class? It doesn't really seem to be a "class" in the normal sense of the word.

phungus420
Mar 04, 2009, 09:35 PM
UnitClass is a unit type, such as Axemen, Swordsman, or Rifleman. It's used to define Unique Units, and special combat bonuses (such as Grenadiers attack bonus to Rifleman, these apply to all Units of the Unitclass--Combat modifiers are more usually used by the UnitCombat types though). For instance Unit_RomanPretorian replaces the Unit_Swordsman, and they are both UnitClass_Swordsman. Check out Civ4UnitInfos.xml to see how this works, you will also see this referenced in Civ4CivilizationsInfos, same thing with BuildingClass_NameofBuildingclass and Building_NameofBuilding.

Shiggs713
Mar 04, 2009, 11:44 PM
so yea in programing terms it is kinda a class still, though not exactly

think of the XML stuff as constants, its just data

Shiggs713
Mar 05, 2009, 02:47 AM
to expand on that, truly something like UnitClass_Swordsman is not a class. It is an instance of Class Unit. Every instance of Class Unit (aka each unit in the game) has methods and properties, that are likely all controlled by 1 giant subroutine. (just laugh quietly if I'm wrong, I haven't actually looked at it) Some of these properties would include stuff like <Description> which are of type String. Others like <bNoCapture> are Boolean, and others yet are Integers like <iCost>. It gets the input (aka constants in this case (the data normally doesn't ever change)) from the XML's

Nearly all of them validate input (hence the XML errors if they're messed up on initialization), some don't, like the EventTriggers and Events, hence you can mess those up all to hell and you won't know until the beginning of turn 1 after you've launched a game, and others yet that are optional like UnitArtStyleType in the civilizations xml

to make the game touted as "most moddable game" they had to do it this way. Nearly all the variables if not all are declared in the XML, as opposed to doing hard coding with "magic numbers". that way people like me and you can go in, change a few XML values, copy paste and go on our merry way.

They could have easily did something along the lines of (in a simplified VB representation)

unit.unitclass_swordsman.unit_swordsman.istrength = 6

but deep inside of a dll it would be quite hard for average people to mod it

jbryant
Mar 05, 2009, 10:20 AM
Wow, thanks for the explanation! I think Civ III was way easier to mod, but everyone is playing IV now, so if I'm going to make something, I better make it IV. To keep the questions going, nif and kfm files. I have input them before and gotten my units in the game, but what exactly are they? If a unit I download comes with more than one of these, which one am I supposed to use in the XML files?

Edgecrusher
Mar 05, 2009, 10:33 AM
Nif = 3d model
kfm = animatiom
dds = "skin" of model

easiest thing to do is to try them out. Different Nif files will be different models.

jbryant
Mar 05, 2009, 10:54 AM
Ok cuz a few of my guys on the civlopedia screen are these crazy monsters with arms on their heads. It's pretty disturbing.

Edgecrusher
Mar 05, 2009, 11:37 AM
They are either designed by the artist to be that way, or something must be up with the Nif file,

Not sure what the animation does to it in the civopedia screen.

Tholish
Mar 05, 2009, 01:41 PM
Use all of them. Some units consist of just a single nif, others will have two files with the same name...one of those is the nif and the other the kfm. The kfm usually doesn't have the model, when you look at it in nifscope, though it may since if they files are together in the same folder. Then there are a bunch of files with names like freeze and fx. You need those too because they do piaces of the animation. Also you need the dds. If its in the file for the unit its part of the unit and you need it. In referring to the unit in UnitArtInfos you only use the main nif and kfm. Those have internal references that lead them to use the other ones.

strategyonly
Mar 05, 2009, 04:40 PM
Did you get this fixed, its line 809 that was missing a line?

jbryant
Mar 05, 2009, 04:51 PM
Yes, thank you. Everything is good, adding more and more units, trying to make a Korea-Taiwan scenario.