GUIDE: Adding new units

here's the thread with the pakbuild utility program


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


;)


NOTE: when you unpack all those files, its best NOT to put it in CIV4 folder!

make a new folder

The reason you dont need to unpack it there... everytime you start up CIV4 it unpacks the files automatically.... you only need to unpack it to:

1) use as a reference - putting new/edited files in the correct directory path
2) edit a "vanilla" file (ex. Changes colors to a dds file) and placing the new file in the correct folder
3) use some of the "vanilla" files in a new Unique Unit (Ex. you want to use the swordsman model in a new Unique unit of the Scots Highlander)
4) use as a reference - checking vanilla versions of files to edit or change
5) Probably some other stuff I missed! :mischief:
(Forgive me I am alittle drunk and tired now)

etc
use these files to edit/copy/replace vanilla files either in Custom Assets or your own mod

(when you add/edit files... follow the directory/folder path to properly place the files in the correct folder)


probably some other stuff too...

I'll get back to ya when I am sober... :D
 
jstarbuck5 said:
OK, I got the assets unpacked and followed the tutorial here.

1- button worked fine, showed up where it's supposed to.

2- I can build the unit in a game, but the section that has promotions to be assigned and orders to give is blank.

3. The unit itself is not visible, only a red octagon.

4. The unit moves and fights, but won't show up or take promotions.

Any useful ideas?

Thanks,

Starbuck


ok Im sober.... but I cant give a long explanation... (got some stuff to do IRL)

but here are some quick answers..

2. the promotions info is in the CIV4UnitInfos.xml (What Unit are you basing it off of? You should follow the template of the unit you are basing it off of) I think the "orders to give" are here too... (also check your CIV4ArtDefines_Unit.xml) not sure and maybe later I can answer it better (Im short on time)

3. you didnt refer to the correct files in the CIV4ArtDefines_Unit.xml

4. CIV4UnitInfos.xml again (see#2)

hope that helps

but I am short on time... I'll try to get back to you later...

unless you solved the problem by then.... :D
 
7rew said:
...I get 3 red spheres that orbit slowly instead of the animation. How do I fix this - also how do I set a build limit on the SBS guys?


3 red spheres means you didnt reference the right files in the CIV4ArtDefines_Unit.xml

to set build limit I would suggest following the spy template in CIV4UnitInfos.xml
(since you can only make 3... there's probably a way to limit or increase this number - I just dont got the time to explain right now :mischief:

7rew said:
Also my peadia artical for SBS doesn't work (does for humvee).

you gotta add the txt about it (and use the right tag lines too) to CIV4GameText_Civilopedia_units.xml file


Well I hope that helps... :crazyeye:

I 'll get back to you all later... and try to help you all out more


TIP: When making a new unit follow a template of a "vanilla" version unit

remember to try keep this line the same as a vanilla Unit:

ex.

<Class>UNITCLASS_MECHANIZED_INFANTRY</Class>

or UNITCLASS_WARRIOR

or UNITCLASS_RIFLEMAN

etc

just keep the unit class as a vanilla verison (you can customize it...but it means more modding files!)


Well I gotta go... I'll try to explain it better later! ;)
 
I'm new to the modding part of Civ so please excuse the newbish question(s) that are to follow.

What I'm trying to do is take a unit in a person's mod that I love and add in a duplicate of it. The unit upgrades later in the game and I don't mind it losing it's advantage, but what I'm trying to do is have it upgrade to the 'new' unit I want to make. I want to use the same skin as the original but just bring up the stats.

I copied the original units data and changed it to reflect the new unit class it would be and name, but the problem is the file refuses to load. I get an XML Load Error that pops up and says : "Failed Loading XML file XML\Civilizations/CIV4CivilizatinsInfo.xml. [.\FXml.cpp:133] Error parsing XML File-

Reason: Invalid at the top level of the document."

I'm at a loss to explain it. I'm sure it's an extreme newb mistake I'm doing here and overlooking something but would love some help figuring it out. I use the same stratagy, description, and civilopedia tags as the orginal unit. The same with the art tag. The only thing I do is change the thing to not upgrade, the unit class to what the orginal unit upgrades to, and the title tag.

Thanks for any help.
 
generalshake said:
I'm new to the modding part of Civ so please excuse the newbish question(s) that are to follow.

What I'm trying to do is take a unit in a person's mod that I love and add in a duplicate of it. The unit upgrades later in the game and I don't mind it losing it's advantage, but what I'm trying to do is have it upgrade to the 'new' unit I want to make. I want to use the same skin as the original but just bring up the stats.

I copied the original units data and changed it to reflect the new unit class it would be and name, but the problem is the file refuses to load. I get an XML Load Error that pops up and says : "Failed Loading XML file XML\Civilizations/CIV4CivilizatinsInfo.xml. [.\FXml.cpp:133] Error parsing XML File-

Reason: Invalid at the top level of the document."

I'm at a loss to explain it. I'm sure it's an extreme newb mistake I'm doing here and overlooking something but would love some help figuring it out. I use the same stratagy, description, and civilopedia tags as the orginal unit. The same with the art tag. The only thing I do is change the thing to not upgrade, the unit class to what the orginal unit upgrades to, and the title tag.

Thanks for any help.


it's a little hard to give you that answer without all the details in front of me...
however it sounds like a "mis"tagged data...

can you copy and paste the part of the XML file with your new unit stats?

or post the XML file here so I can examine it?
(and tell me what is the name of your new unit so I know what I am looking for ;) )



however:

generalshake said:
... I get an XML Load Error that pops up and says : "Failed Loading XML file XML\Civilizations/CIV4CivilizatinsInfo.xml. [.\FXml.cpp:133] Error parsing XML File-

Reason: Invalid at the top level of the document."

it is tough to say.... but if the CIV4CivilizationsInfo.XML file causes the problem... then it may be a Unique Unit for a Civilization which:

A) you didnt add to the new civilization

B) the unit you copied referenced a civilization that doesnt exist in your mod (the unit you copied belonged to a unique civilization that you didnt add)

C) the unit is assigned/defined for the wrong civ

D) other problems I am not sure of at this time... :crazyeye:


of course alot of errors are inter-related where if one XML file is wrong... it make another XML file wrong... and so on... but the only error is in the original file.... where you correct that so the other xml error files work fine... :mischief:


bottom line.... I need more info :D

Ill stand by for your reply :)
 
Thanks for the quick reply, didn't expect anyone else to be up as early as me lol. I'll upload the files I modded into a zip It's from the excellent 'The Ancient Mediterranean' mod.

I'm basically trying to get the legionnaire to upgrade to the heavy infantry but to keep the skin of the legionnaire. The stats haven't been fully nerfed down to the Heavy Infantry as I've been banging my head trying to figure out what I'm doing wrong. Just bugs me to lose my legionnaire skin when they upgrade. :cool: I've named the upgraded form LegionaryII

I'm sure it's an silly mistake I'm making, as I'm no where near as good as the modders who made the mod LoL. I've tried a bunch (and the mess that is the mod files I'm sure shows it) of things to get it to work, but to no avail.

I've gotta bounce off to do the family thing, but will definitly check back. I appreciate any help you can offer, as the good Lord knows I need it LoL.
 
generalshake said:
...Thanks for the quick reply, didn't expect anyone else to be up as early as me lol...

Actually I was heading to bed (im a night person :mischief: ) but I always check the threads before I go to bed....
(Thats why my replies are so late since I go to sleep then reply back over 6 hours later :p )


generalshake said:
...I'm basically trying to get the legionnaire to upgrade to the heavy infantry but to keep the skin of the legionnaire. The stats haven't been fully nerfed down to the Heavy Infantry as I've been banging my head trying to figure out what I'm doing wrong.

ok preliminary results:

(like you I have to do stuff IRL - but not as noble as you with your family - mine is just errands :blush: )

first I noticed in

CIV4Unitinfos.XML file
you define your new UU as:

<Class>UNITCLASS_ARMORED_INFANTRY</Class>
<Type>UNIT_ROME_LEGIONARYII</Type>

however in your

CIV4UnitClassInfos.XML file
you define your UU as:

<Type>UNITCLASS_ARMORED_INFANTRY</Type>
<Description>TXT_KEY_UNIT_SWORDSMAN</Description>
<iMaxGlobalInstances>-1</iMaxGlobalInstances>
<iMaxTeamInstances>-1</iMaxTeamInstances>
<iMaxPlayerInstances>-1</iMaxPlayerInstances>
<DefaultUnit>UNIT_ARMORED_INFANTRY</DefaultUnit>


the types have to be the same to work!

(the easiest is changing UNIT_ARMORED_INFANTRY to UNIT_ROME_LEGIONARYII in the CIV4UnitClassInfos.XML file)

NOTE there is different ways to define UU

for example I made a unit but used the default swordsman unit as a reference
since it was the similar! :) you could have done that to with your UNIT_ARMORED_INFANTRY and use the old UNITCLASS_SWORDSMAN like the original UNIT_ROME_LEGIONARY

this looks complicated but it is not... it just saves having to edit the CIV4UnitClassInfos.XML file when you dont really have to... (I can go into detail later if you wish)

as for the TXT for the unit ... you could easily make a new entry (in another file) to give it's description

basically the CIV4UnitClassInfos.XML file just defines whether it is a limited # unit like the spy or not...

brief explanation:

<iMaxGlobalInstances>-1</iMaxGlobalInstances> - defines how many times the unit can appear in all civilizations
<iMaxTeamInstances>-1</iMaxTeamInstances> - defines how many times the unit can appear on teammates civilizations
<iMaxPlayerInstances>-1</iMaxPlayerInstances> - defines how many times the unit can appear in one civilization

-1 = unlimited
0 = none
any positive Number (1/2/3...etc) = # of units

for example:

<iMaxPlayerInstances>3</iMaxPlayerInstances>

means 3 units can appear in one entire civilization (check the spy stats)

this is particularly important in limiting building/wonders...

in this file

CIV4UBuildingClassInfos.XML

where:

<iMaxGlobalInstances>-1</iMaxGlobalInstances> - think World Wonders Define
<iMaxPlayerInstances>-1</iMaxPlayerInstances> - think National Wonders

of course
if both those tags are -1 that just means it's a regular building

ok enough of the modding tutorial... dont want to drive you crazy :crazyeye:

Like I said.... this is a preliminary report...

there may be other errors but I am not done checking (RL stuff to do)

try those changes and see what happens ;)

Please note any errors and post them here... (PLEASE be specific about the errors that pop up!)


NOTE: I am still suspicious about the civilization.xml error but like I said before the errors may be related.... and you fix the main problem... the other problems may go away :mischief:

generalshake said:
Just bugs me to lose my legionnaire skin when they upgrade. :cool: I've named the upgraded form LegionaryII

there is another way to "save" your legionary skins (but that a little more advanced... but not very hard to do once you do it a couple of times)


generalshake said:
... I appreciate any help you can offer, as the good Lord knows I need it LoL.


any time I can help... I will...

I hope this helps...:)

keep me updated! :goodjob:
 
Officer Reene said:
there is another way to "save" your legionary skins (but that a little more advanced... but not very hard to do once you do it a couple of times)

That's prob what I'm going to have to do. I can't make the armored infantry class default unit the LegionaryII as the other races use the regular. I'm just looking to add another UU in on this mod as the LegionaryII instead of the armored infantry. The Goths in this mod have a UU that is of the armored infantry and that's kinda what I'm going after as well, though instead of it being a 'true' UU like the goths with better stats, I'll just mirror the normal Armored Infantry stat wise.

I tried creating a seperate unit class just for the legionaryII and it gave me the same Civ4unitclassinfo error and a few others. I've uploaded the changed files of the mod and here's the errors they are giving me.

1. The same error as the first one with the Error parsing XML File. Reason: End Tag 'UnitClassInfo' does not match the start tag 'UnitClassInfos'. Line: 121, 5 Source: </UnitClassInfo>

2. Tag: UNITCLASS_PROPHET in Info class was incorrect. (This one is funny as I didn't even touch that part of it.)

3. Tag: UNITCLASS_ARTIST in Info class was incorrect. Same for the _SCIENTIST, _MERCHANT, ENGINEER, and so on. Basically seems to be doing it to a whole list of 'em.

Lastly, the strangest thing of all is when I go back and take out any of the modding I done, it does a similiar error, though they change. The only way I clear it is to completly replace it with an untouched copy of the files I was modding. (I just copy and paste the whole folder though in that case). I've uploaded the orginal files as well. I'm wondering if it could be that I'm using notepad and it's changing something that the original modders put in?

Thanks for the help, and words of encouragement. All in all I still love this mod the original creators made and can live w/o my anal need to have legionaries till the end hehe.
 
generalshake said:
...1. The same error as the first one with the Error parsing XML File. Reason: End Tag 'UnitClassInfo' does not match the start tag 'UnitClassInfos'. Line: 121, 5 Source: </UnitClassInfo>...

well I found one problem:

<UnitClassInfo>
<Type>UNITCLASS_ARMORED_INFANTRY</Type>
<Description>TXT_KEY_UNIT_SWORDSMAN</Description>
<iMaxGlobalInstances>-1</iMaxGlobalInstances>
<iMaxTeamInstances>-1</iMaxTeamInstances>
<iMaxPlayerInstances>-1</iMaxPlayerInstances>
<DefaultUnit>UNIT_ARMORED_INFANTRY</DefaultUnit>
</UnitClassInfo>
</UnitClassInfo>
<UnitClassInfo>
<Type>UNITCLASS_SPEARMAN</Type>
<Description>TXT_KEY_UNIT_SPEARMAN</Description>
<iMaxGlobalInstances>-1</iMaxGlobalInstances>
<iMaxTeamInstances>-1</iMaxTeamInstances>
<iMaxPlayerInstances>-1</iMaxPlayerInstances>
<DefaultUnit>UNIT_SPEARMAN</DefaultUnit>
</UnitClassInfo>


you have an extra "</UnitClassInfo>"

erase that and it should fix it

(also line 121 refers to where the error is occuring)

you might want to use notepad++ to edit XML files

its free and color coordinated (easier on the eyes :mischief:)

plus if you go to the control tabs you can have it "check" your XML taglines where it lets you know if there is a mismatch or incorrect tag
it's a basic checker but it will find your errors
(and wont let you re-save until you fix the error ;) )

it found your error... and made my job easier

go here to d/l notepad++


http://notepad-plus.sourceforge.net/

let me know if the changes help ya! :)

generalshake said:
...2. Tag: UNITCLASS_PROPHET in Info class was incorrect. (This one is funny as I didn't even touch that part of it.)

3. Tag: UNITCLASS_ARTIST in Info class was incorrect. Same for the _SCIENTIST, _MERCHANT, ENGINEER, and so on. Basically seems to be doing it to a whole list of 'em.


usually when you make one mistake... it affects the whole XML database and gives you sorts of errors... once you fix the original mistake... the others clear up :crazyeye:


hope this helps :p
 
Officer Reene said:
well I found one problem:

<UnitClassInfo>
<Type>UNITCLASS_ARMORED_INFANTRY</Type>
<Description>TXT_KEY_UNIT_SWORDSMAN</Description>
<iMaxGlobalInstances>-1</iMaxGlobalInstances>
<iMaxTeamInstances>-1</iMaxTeamInstances>
<iMaxPlayerInstances>-1</iMaxPlayerInstances>
<DefaultUnit>UNIT_ARMORED_INFANTRY</DefaultUnit>
</UnitClassInfo>
</UnitClassInfo>
<UnitClassInfo>
<Type>UNITCLASS_SPEARMAN</Type>
<Description>TXT_KEY_UNIT_SPEARMAN</Description>
<iMaxGlobalInstances>-1</iMaxGlobalInstances>
<iMaxTeamInstances>-1</iMaxTeamInstances>
<iMaxPlayerInstances>-1</iMaxPlayerInstances>
<DefaultUnit>UNIT_SPEARMAN</DefaultUnit>
</UnitClassInfo>


you have an extra "</UnitClassInfo>"

erase that and it should fix it

(also line 121 refers to where the error is occuring)

you might want to use notepad++ to edit XML files

its free and color coordinated (easier on the eyes :mischief:)

plus if you go to the control tabs you can have it "check" your XML taglines where it lets you know if there is a mismatch or incorrect tag
it's a basic checker but it will find your errors
(and wont let you re-save until you fix the error ;) )

it found your error... and made my job easier

let me know if the changes help ya! :)

hope this helps :p

LoL thanks for the catch, and the tip on Notepad++ Using it now.

I'm thinking it's tied to the civilizationinfos file. I use the modded unit files and the old civ4civilizationsinfos file and it loads. When I put in the file to add it as an extra UU for rome that's when it gives me the error. The Error that pops up is

Tag: CIVILIZATION_BARBARIAN in Info class was incorrect.
Current XML file is: Interface/CIV4WorldPickerInfos.xml

I'm gonna keep tinkering with that file and see if something pops up, though can't figure it out as I didn't even touch the Barb civ lol.
 
generalshake said:
LoL thanks for the catch, and the tip on Notepad++ Using it now.

I'm thinking it's tied to the civilizationinfos file. I use the modded unit files and the old civ4civilizationsinfos file and it loads. When I put in the file to add it as an extra UU for rome that's when it gives me the error. The Error that pops up is

Tag: CIVILIZATION_BARBARIAN in Info class was incorrect.
Current XML file is: Interface/CIV4WorldPickerInfos.xml

I'm gonna keep tinkering with that file and see if something pops up, though can't figure it out as I didn't even touch the Barb civ lol.


once you add a UU to a civ... there are other files that you need to edit other XML files...

check this tutorial out... it helps alot

and I was able to make a new civ with 2 UU w/o problems...

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


I gotta go do some things... but I'll check in later tonight or tomorrow morning...

yeah adding stuff is a pain (but not really once you get the hang of it :crazyeye: ) because you have to edit alot of XML files to get just one thing working :mischief:


hope this helps;)
 
Officer Reene said:
once you add a UU to a civ... there are other files that you need to edit other XML files...

check this tutorial out... it helps alot

and I was able to make a new civ with 2 UU w/o problems...

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


I gotta go do some things... but I'll check in later tonight or tomorrow morning...

yeah adding stuff is a pain (but not really once you get the hang of it :crazyeye: ) because you have to edit alot of XML files to get just one thing working :mischief:


hope this helps;)

I just wanted to thank you for all your help. The link will help me greatly, perhaps convince me to try and create my own mod oneday instead of just tinkering with others :lol: .

The best thing you done though is show me the Notepad++. I took an unmodded civ4civilizationsinfo file and opened it in N++ and modded as I had done the first file I modded. The mod loaded and worked perfectly. I'm not sure what was actually happening as I done everything the same as I did, but my theory is the crap windows notepad program has a max character limit, and the N++ either doesn't, or a higher max. I'm going to try and compare the two old modded files and see if that's the case. If so that'd explain why it kept flippin out on me.

Either way I'm just glad it's finally working, and definitly appreciate the help you gave. :D
 
generalshake said:
I just wanted to thank you for all your help. The link will help me greatly, perhaps convince me to try and create my own mod oneday instead of just tinkering with others :lol: .


hey no problem... I find modding quite fun (when the mod runs correctly :D )

I'm glad I could help... I am just a bit pre-occuppied with my own mod testing right now :cool:

generalshake said:
The best thing you done though is show me the Notepad++. I took an unmodded civ4civilizationsinfo file and opened it in N++ and modded as I had done the first file I modded. The mod loaded and worked perfectly. I'm not sure what was actually happening as I done everything the same as I did, but my theory is the crap windows notepad program has a max character limit, and the N++ either doesn't, or a higher max.

yeah notepad++ is a neat little program


generalshake said:
I'm going to try and compare the two old modded files and see if that's the case. If so that'd explain why it kept flippin out on me.


you can compare them both at the same time using notepad++ :eek:

just open both xml files

click on one of the files tabs and click "open to another view" or something like that...

it then opens the files next to each other :goodjob:

I'm sure there is also an option in the top menu bar...


and you can lock the horizontal and vertical scrolling with the the buttons in the menu bar! :p

this way you can scroll simultaneously and compare line for line what is the difference (and possibly the error) between the two files

there are lots of options to use... just check all the options in the menu bar....

the search capabilities has some neat stuff too!


generalshake said:
Either way I'm just glad it's finally working, and definitly appreciate the help you gave. :D

great to hear that your mod's working !

that's all I like to hear and Im glad I can help in any way!:D


good luck and happy modding :king:
 
N8DoGG said:
How do you do this? I got PakBuild but now I'm stumped... :confused:...


1) Run the pakbuild program

2) click on "PAK" Tab (next to File and View Tabs)
*DO NOT CLICK on FILE or OPEN (file)

3) click on Unpack

(make sure you are in the Assets FOLDER of the main CIV4 Directory)

4) Unpack (click on)

Assets0.fpk

***SAVE in NEW FOLDER***


***NOT IN MAIN CIV4 Directory***


repeat steps 2-4 for Assets1.fpk, Assets2.fpk, and Assets3.fpk
(NOTE: you can save them all in the same directory you just created in step 4.... the first time around)


now you have the skins to reference this tutorial ;)


Follow the instructions in the begining of this post :D


Hope this helps :)
 
SwordOfJustice said:
I found the answer. I wasn't clearing the cache properly! I thought it was in My Documents but no, it's in Application Data\My Games. ahem :blush:

- Pete


I'm having the same problem:
"Tag: UNITCLASS_HUMVEE in Info class was incorrect Current XML file is: Units\CIV4UnitInfos.xml"

This may be a stupid question, but how do you go about clearing the cache? Also, I finally got the Humvee to show up in the game, but it does nothing when you order it to attack... on the other hand is does a great job of shooting back, then exploding when attacked.

Since there is a RangedStrike.kf file in the folder, I'm at a loss why that function only does not work. My armies are inept enough without extra units that are qualified only at bursting into flames :crazyeye:
 
Sentoa said:
I'm having the same problem:
"Tag: UNITCLASS_HUMVEE in Info class was incorrect Current XML file is: Units\CIV4UnitInfos.xml"

can u please post your XML files or cut and paste the portion that refers to your UNITCLASS_HUMVEE in your CIV4UnitInfos.xml?

It's hard to comment what may be the error since I dont know what your tagline data looks like :mischief:

that error is usually because you did not properly define the unit in the CIV4UnitClassInfos.xml

or you have the wrong data in one of your taglines in your CIV4UnitInfos.xml File...

but without seeing the raw data I cant be more specific :crazyeye:



Sentoa said:
This may be a stupid question, but how do you go about clearing the cache?...

usually the cache is found here:

C:\Documents and Settings\[USER LOGIN NAME]\Application Data\My Games\[Civilization 4 folder]\cache Folder


I dont know why they made two different civ4 folders...

its stupid :mad:

everytime after you exit CIV4 (or before you start CIV4) empty all the files in that cache folder...

(I made a shortcut to that folder on my desktop to make it easier to access :goodjob: )



Sentoa said:
Also, I finally got the Humvee to show up in the game, but it does nothing when you order it to attack... on the other hand is does a great job of shooting back, then exploding when attacked....Since there is a RangedStrike.kf file in the folder, I'm at a loss why that function only does not work. My armies are inept enough without extra units that are qualified only at bursting into flames :crazyeye:

not sure but here is a general tutorial on placing custom unit skins in the game:

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


hope that helps ;)



post if you need more help :)
 
Top Bottom