GUIDE: Adding new units

thanks now the problem is setting the pak thingy up (where to put it)


the program itself can go anywhere (doesnt have to be put in the CIV4 folder)

remember that to unpak the file you have to click the "PAK" tab (in the pakbuild program) and click on "unpack"

my advice is to save it (pak files) in a different directory than CIV4 and use it as a reference (so that you dont get confused with custom and default art stuff)....


then when you edit/mod/replace an art unit/building/resource/etc...

follow the path (folders where you unpacked them all) and copy that path/folders in you mods (basically your mod folder will override all the default ones)

NOTE: you only have to copy the file you edited/replaced/etc.

for example lets say you change the skin to the axeman

all you have to do is replace that dds file in the appropriate folder in your mod


you do not have to copy ALL art files in your mod (CIV4 unpaks them on start up and replaces any default art with the files replaced in your mod)


the same thing goes for changing whole units....

let say you want to replace the tank with a better tank model

you will have to replace ALL the tank files with the custom model

(possibly have to change the ART xml files to point to the custom model too)


hope that helps ;)
 
well let me know how it goes and I'll try to help if necessary ;)


also you can download a mod... which uses all the stuff you need and see what they did... :D


yeah ive been trying to pick through the mods and figure out how they did some of this. well i got it added no problem now my only problem is figuring out why one of the units pic doesnt show up in the discription or the pedia list its a minor problem that i should be able to work out since all the others work fine. thanks again for the help :)
 
yeah ive been trying to pick through the mods and figure out how they did some of this. well i got it added no problem now my only problem is figuring out why one of the units pic doesnt show up in the discription or the pedia list its a minor problem that i should be able to work out since all the others work fine. thanks again for the help :)

np :goodjob:

make sure the size/type of the image button is correct 64x64

make sure all of your XML taglines are defined correctly by pointing to that button.

best bet check all the ART XML files that point to the image and see if they are correct (alot of times it's a syntax problem... ex. extra comma/period or missing tag info)

also the civilopedia must be defined ... (look at the XML files in the Text folder)

hope that helps... and if it doesnt.... let me know ;)
 
the program itself can go anywhere (doesnt have to be put in the CIV4 folder)

remember that to unpak the file you have to click the "PAK" tab (in the pakbuild program) and click on "unpack"

my advice is to save it (pak files) in a different directory than CIV4 and use it as a reference (so that you dont get confused with custom and default art stuff)....


then when you edit/mod/replace an art unit/building/resource/etc...

follow the path (folders where you unpacked them all) and copy that path/folders in you mods (basically your mod folder will override all the default ones)

NOTE: you only have to copy the file you edited/replaced/etc.

for example lets say you change the skin to the axeman

all you have to do is replace that dds file in the appropriate folder in your mod


you do not have to copy ALL art files in your mod (CIV4 unpaks them on start up and replaces any default art with the files replaced in your mod)


the same thing goes for changing whole units....

let say you want to replace the tank with a better tank model

you will have to replace ALL the tank files with the custom model

(possibly have to change the ART xml files to point to the custom model too)


hope that helps ;)

i still dont get it
if i click on PAK, unpack ,assets ,assets0.fpk
sorry
 
i still dont get it
if i click on PAK, unpack ,assets ,assets0.fpk
sorry

Im not sure what you dont understand but....

I hope you at least d/l the PAKBUILD Program....

install this file ANYWHERE YOU WANT...

just make sure you have a shortcut to run the program....


Now:

1) Click on shortcut to start the program
This should open up a program window.
On the top tab there should be 4 tabs : "File" "View" "PAK" "Help"

2) Click on the tab " PAK"
This should open another tab list with "Unpack" tab option

3) Click on the tab "Unpack"
This should open a search window

then do the following:
a) FIND your CIV4 (Civilization4 or whatever you called it) directory
b) Click on "Assets" folder
You should then see: assets0.fpk, assets1.fpk, assets2.fpk, assets3.fpk files

4) Click on assets0.fpk
It should prompt you where to save that file
I would save it in a file you know
I would not save it in your CIV4 Folder
If You are unsure save it to your DESKTOP

5) Repeat Steps 2-4 until you unpak all assets....files


now you have the correct path and folders of where the art files are and should be placed in your mod
(follow the folders but copy/make the folders in your mod with in Art Folder - you will probably have to make this folder.... )


Im not sure what you dont understand but I tried to be as clear and simple as possible.... if you can not understand these instructions.... can you be alittle more specific...........about what you dont understand....

That way I can help you better......
 
Can i ask, whether this tutorial is also valid for civ 4 expansion 'warlords'? sory if this question already asked
 
Can i ask, whether this tutorial is also valid for civ 4 expansion 'warlords'? sory if this question already asked

I believe so but Im not sure....

The only difference that I could see is that if you want to skin warlords units you have to find the folder where the art is for warlords game/folder

but if you just mess with the vanilla units... it should be the same

sorry I cant help more
 
This is a great tut to get you started, but I seem to have a problem with my units that no one seems to have. My new units are in the game and all, but they don't have any formation or promotion buttons visible. Is there something I'm missing?
 
This is a great tut to get you started, but I seem to have a problem with my units that no one seems to have. My new units are in the game and all, but they don't have any formation or promotion buttons visible. Is there something I'm missing?

well Im not sure what the problem is... but here are some ideas:

If you created a UU they must therefore replace an existing default unit...

for example:
(refer to CIV4UnitInfos.xml file for details)

Fast Workers replace Workers:

Code:
		<UnitInfo>
			<Class>UNITCLASS_WORKER</Class>
			<Type>[COLOR="Blue"]UNIT_INDIAN_FAST_WORKER[/COLOR]</Type>
			<UniqueNames/>
			<Special>NONE</Special>
			<Capture>UNITCLASS_WORKER</Capture>
			<Combat>NONE</Combat>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_WORKER</DefaultUnitAI>
...
...
...


notice the difference where the fast worker changes the <Type> tagline but not the class.

this is because the unit is a UU that replaces the default unit as seen here:

Code:
		<UnitInfo>
			<Class>UNITCLASS_WORKER</Class>
			<Type>[COLOR="Blue"]UNIT_WORKER[/COLOR]</Type>
			<UniqueNames/>
			<Special>NONE</Special>
			<Capture>UNITCLASS_WORKER</Capture>
			<Combat>NONE</Combat>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_WORKER</DefaultUnitAI>
...
...
...

Thus with UU DO NOT add any info to the CIV4UnitClassInfos.xml file since it is already covered by the:

Code:
<Class>UNITCLASS_WORKER</Class>
(being the same class as worker)



Also with UU you have to add them to your civilizations:
(check the CIV4CivilizationInfos.xml file for details)

Code:
		<CivilizationInfo>
			<Type>CIVILIZATION_INDIA</Type>
			<Description>TXT_KEY_CIV_INDIA_DESC</Description>
			<ShortDescription>TXT_KEY_CIV_INDIA_SHORT_DESC</ShortDescription>
			<Adjective>TXT_KEY_CIV_INDIA_ADJECTIVE</Adjective>
			<Civilopedia>TXT_KEY_CIV_INDIA_PEDIA</Civilopedia>
			<DefaultPlayerColor>PLAYERCOLOR_PURPLE</DefaultPlayerColor>
			<ArtDefineTag>ART_DEF_CIVILIZATION_INDIA</ArtDefineTag>
			<ArtStyleType>ARTSTYLE_ASIAN</ArtStyleType>
			<bPlayable>1</bPlayable>
			<bAIPlayable>1</bAIPlayable>
			<Cities>
				<City>TXT_KEY_CITY_NAME_DELHI</City>
				<City>TXT_KEY_CITY_NAME_BOMBAY</City>
				<City>TXT_KEY_CITY_NAME_MADRAS</City>
...
...
...
			</Cities>
			<Buildings/>
			<Units>
				<Unit>
					<UnitClassType>UNITCLASS_WORKER</UnitClassType>
					<UnitType>[COLOR="Blue"]UNIT_INDIAN_FAST_WORKER[/COLOR]</UnitType>
				</Unit>
...
...
...

this allows your UU to replace the default unit in your civilization





If that's not the problem I can only hazard a guess that:

1) A tagline is incomplete /incorrect syntax
(missing comma/period/etc. or wrong place for comma/period/etc.)

2) AI Tags are not correct
Code:
		<UnitInfo>
			<Class>UNITCLASS_WARRIOR</Class>
			<Type>UNIT_WARRIOR</Type>
			<UniqueNames/>
			<Special>NONE</Special>
			<Capture>NONE</Capture>
			[COLOR="Blue"]<Combat>UNITCOMBAT_MELEE</Combat>[/COLOR]
[COLOR="Blue"]			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_ATTACK</DefaultUnitAI>[/COLOR]
			<Invisible>NONE</Invisible>
			<SeeInvisible>NONE</SeeInvisible>
			<Description>TXT_KEY_UNIT_WARRIOR</Description>
			<Civilopedia>TXT_KEY_UNIT_WARRIOR_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_UNIT_WARRIOR_STRATEGY</Strategy>
[COLOR="Blue"]			<Advisor>ADVISOR_MILITARY</Advisor[/COLOR]>
			<bAnimal>0</bAnimal>
			<bFood>0</bFood>
			<bNoBadGoodies>0</bNoBadGoodies>
			<bOnlyDefensive>0</bOnlyDefensive>
			<bNoCapture>0</bNoCapture>
			<bRivalTerritory>0</bRivalTerritory>
			<bMilitaryHappiness>1</bMilitaryHappiness>
			<bMilitarySupport>1</bMilitarySupport>
			<bMilitaryProduction>1</bMilitaryProduction>
...
...
...
			<UnitClassUpgrades>
				<UnitClassUpgrade>
					<UnitClassUpgradeType>UNITCLASS_AXEMAN</UnitClassUpgradeType>
					<bUnitClassUpgrade>1</bUnitClassUpgrade>
				</UnitClassUpgrade>
				<UnitClassUpgrade>
					<UnitClassUpgradeType>UNITCLASS_SPEARMAN</UnitClassUpgradeType>
					<bUnitClassUpgrade>1</bUnitClassUpgrade>
				</UnitClassUpgrade>
			</UnitClassUpgrades>
[COLOR="Blue"]			<UnitAIs>
				<UnitAI>
					<UnitAIType>UNITAI_ATTACK</UnitAIType>
					<bUnitAI>1</bUnitAI>
				</UnitAI>
			</UnitAIs>[/COLOR]
			<NotUnitAIs>
				<UnitAI>
					<UnitAIType>UNITAI_CITY_DEFENSE</UnitAIType>
					<bUnitAI>1</bUnitAI>
				</UnitAI>
			</NotUnitAIs>
...

NOTE: I Used the Warrior as opposed Fast Worker to portray the example better


If this doesnt work, try to give me more info... and I'll try to work on it again

Hope this helps ;)

PS This is for Vanilla only not warlords... but from my understanding Warlords adds some more taglines... but this should not affect your problem.... unless you didnt add the warlord taglines to the vanilla version AND you're using it as a Warlords Mod in the Warlords expansion :crazyeye:
 
Thanks for the possible solution. I'll go back through my xml files and make sure none of the taglines are incomplete. But, I don't know if this is going to solve it since I copied the same taglines as maceman for my new unit squire. In Vanilla, what is happening is that the squire unit appears in play, but none of the functions such as fortify or any of the promotion buttons show up when the unit is activated. The buttons seem to only show when the squire unit is grouped with other units like a knight. I thought that maybe after adding it to the CIV4FormationInfos.xml file that this would solve it, but it hasn't.

I'm wondering if the problem is with this tagline <Button>,Art/Interface/Buttons/Units/Warrior.dds,Art/Interface/Buttons/Unit_Resource_Atlas.dds,2,1</Button> which I changed to <Button>Art/Interface/Buttons/Units/Squire.dds</Button> as to what the TUT said to do. Have you had any problem with this?
 
Thanks for the possible solution. I'll go back through my xml files and make sure none of the taglines are incomplete. But, I don't know if this is going to solve it since I copied the same taglines as maceman for my new unit squire. In Vanilla, what is happening is that the squire unit appears in play, but none of the functions such as fortify or any of the promotion buttons show up when the unit is activated. The buttons seem to only show when the squire unit is grouped with other units like a knight. I thought that maybe after adding it to the CIV4FormationInfos.xml file that this would solve it, but it hasn't.

Is your new squire unit a UU for one (or more) civs?

if it is NOT a UU you can not have it share the same class as the axeman...

for example in the CIV4UnitInfos.xml file:

Code:
		<UnitInfo>
[COLOR="Blue"]			<Class>UNITCLASS_AXEMAN</Class>
			<Type>UNIT_AXEMAN</Type>[/COLOR]
			<UniqueNames/>
			<Special>NONE</Special>
			<Capture>NONE</Capture>
			<Combat>UNITCOMBAT_MELEE</Combat>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_COUNTER</DefaultUnitAI>

if it is a default unit you can not put this:

Code:
		<UnitInfo>
[COLOR="DarkRed"]		<Class>UNITCLASS_AXEMAN</Class>
			<Type>UNIT_SQUIRE</Type>[/COLOR]
			<UniqueNames/>
			<Special>NONE</Special>
			<Capture>NONE</Capture>
			<Combat>UNITCOMBAT_MELEE</Combat>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_COUNTER</DefaultUnitAI>

Because it is not a UU that replace an axeman

Remember this is only if the squire unit is NOT a UU.
also for the example I used the UNIT_SQUIRE as reference
(although you may call it something different)

Again if it is not a UU you have to add a class to your CIV4UnitClassInfos.xml file

Using the example above you would have to put something like this:

Code:
		<UnitClassInfo>
[COLOR="Blue"]			<Type>UNITCLASS_SQUIRE</Type>
			<Description>TXT_KEY_UNIT_SQUIRE</Description>[/COLOR]
			<iMaxGlobalInstances>-1</iMaxGlobalInstances>
			<iMaxTeamInstances>-1</iMaxTeamInstances>
			<iMaxPlayerInstances>-1</iMaxPlayerInstances>
[COLOR="Blue"]			<DefaultUnit>UNIT_SQUIRE</DefaultUnit>[/COLOR]
		</UnitClassInfo>

also in your CIV4UnitInfos.xml file you would this entry for your new unit:

Code:
		<UnitInfo>
[COLOR="Blue"]		<Class>UNITCLASS_SQUIRE</Class>[/COLOR]
			<Type>UNIT_SQUIRE</Type>
			<UniqueNames/>
			<Special>NONE</Special>
			<Capture>NONE</Capture>
			<Combat>UNITCOMBAT_MELEE</Combat>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_COUNTER</DefaultUnitAI>

this defines it as a regular/default unit not a UU

you may be also missing some info/data but Remember with XML and python it can be touchy if you miss a comma (for example) where no errors would occur... but some functions would be missing (like promotion buttons) :crazyeye:

I will keep trying to think of other possible solutions... but try to give me more details....

I'm wondering if the problem is with this tagline <Button>,Art/Interface/Buttons/Units/Warrior.dds,Art/Interface/Buttons/Unit_Resource_Atlas.dds,2,1</Button> which I changed to <Button>Art/Interface/Buttons/Units/Squire.dds</Button> as to what the TUT said to do. Have you had any problem with this?

That is not the problem.

Code:
<Button>,Art/Interface/Buttons/Units/Warrior.dds[COLOR="DarkRed"],Art/Interface/Buttons/Unit_Resource_Atlas.dds,2,1[/COLOR]</Button>


Unit_Resource_Atlas.dds,2,1 refers to a "chart" of all unit image buttons and the numbers refer to the location (x/y) coordinates

for some reason CIV4 developers did not allow modders to access it and edit/edit to this chart :(

therefore when you remove the comma at the start and only put the first part of the line (like in this tutorial) the CIV4 engine IGNORES the button chart and uses your Image for the Button and Button Chart reference ;)

therefore you dont need to mod the "chart" (since you cant anyway) and that chart is only for default/vanilla units

I have read alot on this issue, and have used this "work around" in my mod without any problems :goodjob:

Just remember that to put your Squire.dds FILE in the correct folder using the correct image file (.dds duh :p ) and correct size (usually 64X64)

Note you really dont need the Alpha Channel part of the .dds file (I dont use it) unless you make custom flags (in the main game screen) or you want resources and new city specialists/great specialist (like in my mod) to appear correctly in the Civilopedia and the City Screen (basically city specialists need a "Clear/Transparent" alpha channel so that the city screens/civilopedia background appears.... Although it is purely cosmetic and you dont have to it at all (your images background will appear over the default screen)

basically when the great specialist appear next to each other in the city screen, they blend better with an alpha channel, but has no bearing on the game or actions :lol:

*takes a breather*

ok that was too much info...

but anyway I hope this helps ;)
 
Yes, the squire unit I added is supposed to be a default unit and not a UU. Sorry I didn't mention that before. I followed this TUT to the "T" editing CIV4UnitClassInfos.xml, CIV4UnitInfos.xml, CIV4ArtDefines_Unit.xml, and the CIV4FormationInfos.xml. In the CIV4FormationInfos.xml I added my squire tagline <UnitType>UNIT_SQUIRE</UnitType> next to each occurrence of the maceman; since this is the unit I copied all of taglines from in the other xml files. I edited each tagline in the above xml files to the new unit's folder. This part seems to work and the unit appears in the world with all of its animations working fine. The only problem is that the buttons aren't appearing for the unit when it's activated such as fortify and promotions. The TUT didn't mention altering any python files, CIV4GameText_Strategy.xml, CIV4GameTextInfos_Objects.xml or CIV4GameText_Civilopedia_Units.xml. I'm going to add taglines to the squire unit in these files too to see if anything changes. From what I've read, it seems to be an isolated incident. I'll edit these files and check my lines again for the 20th time. Thank you for your help, and please let me know if you figure out anything. I have to go and read how to create these fancy code div boxes you pros use.
 
Yes, the squire unit I added is supposed to be a default unit and not a UU. Sorry I didn't mention that before.

then if it is a default unit and not a UU make sure you edit the CIV4UnitClassInfos.xml file with the new class as well as the CIV4UnitInfos.xml file (as mentioned in my previous post)

I followed this TUT to the "T" editing CIV4UnitClassInfos.xml, CIV4UnitInfos.xml, CIV4ArtDefines_Unit.xml, and the CIV4FormationInfos.xml. In the CIV4FormationInfos.xml I added my squire tagline <UnitType>UNIT_SQUIRE</UnitType> next to each occurrence of the maceman; since this is the unit I copied all of taglines from in the other xml files. I edited each tagline in the above xml files to the new unit's folder. This part seems to work and the unit appears in the world with all of its animations working fine.

In my experience (and in my mod) formationsinfos.xml is not important to use... that only matter if you change the setup of formations etc

I never edited that file for my UU or new "default" units and I didnt notice any problems with my units or animations


The only problem is that the buttons aren't appearing for the unit when it's activated such as fortify and promotions. The TUT didn't mention altering any python files, CIV4GameText_Strategy.xml, CIV4GameTextInfos_Objects.xml or CIV4GameText_Civilopedia_Units.xml. I'm going to add taglines to the squire unit in these files too to see if anything changes. From what I've read, it seems to be an isolated incident.

again this is odd... or its because CIV4 gets confused when you used a default unit... but based it as a UU (see my previous post to fix that)

as for the CIV4GameText_Strategy.xml file I believe that is only a hints text used in the tutorial mods, which dont effect the game (because you dont dont use the tutorial mod)

I usually fill in the tagline for the CIV4UnitInfos.xml file but dont edit CIV4GameText_Strategy.xml file and it works fine

for example in my mod my new Default unit the Sepoy I did the following:

Code:
		<UnitInfo>
			<Class>UNITCLASS_SEPOY</Class>
			<Type>UNIT_SEPOY</Type>
			<UniqueNames/>
			<Special>NONE</Special>
			<Capture>NONE</Capture>
			<Combat>UNITCOMBAT_GUN</Combat>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_CITY_DEFENSE</DefaultUnitAI>
			<Invisible>NONE</Invisible>
			<SeeInvisible>NONE</SeeInvisible>
			<Description>TXT_KEY_UNIT_SEPOY</Description>
			<Civilopedia>TXT_KEY_UNIT_SEPOY_PEDIA</Civilopedia>
			[COLOR="Blue"]<Strategy>TXT_KEY_UNIT_SEPOY_STRATEGY</Strategy>[/COLOR]
			<Advisor>ADVISOR_MILITARY</Advisor>

notice I filled in the tagline but as I stated before, I did not edit that actual file...and it worked fine (it ignores that tagline since that tagline only appears in the tutorial mod)


CIV4GameTextInfos_Objects.xml file is optional... for other languages in text parts or current language (it doenst matter as long as you enter the correct data in the appropriate language tagline and load up the game in that particular language version)


CIV4GameText_Civilopedia_Units.xml file
is usually required so the unit appears in the civilopedia but Im not sure if it affects gameplay
(Note: one thing that does affect gameplay is the civ/leader info in the civilopedia... where if it is not entered correctly or not at all.. then you cannot pick that civ upon start up)



I'll edit these files and check my lines again for the 20th time. Thank you for your help, and please let me know if you figure out anything. I have to go and read how to create these fancy code div boxes you pros use.

bah I use basic images for the borders :D if that's what your refering to :crazyeye:


My only suggestion is that you add the new unit class since you are making it a default unit and not a UU

Keep me posted ;)
 
Thanks for all of your assistance. I didn't have time to play with it last night, work got in the way--darn nuisance. I'll revert back to the original vanilla civ iv tonight and retrace my steps. Reverting isn't that big a deal, since I am a nubie to this. I'll keep you post on what happens.
 
Thanks for all of your assistance. I didn't have time to play with it last night, work got in the way--darn nuisance. I'll revert back to the original vanilla civ iv tonight and retrace my steps. Reverting isn't that big a deal, since I am a nubie to this. I'll keep you post on what happens.

ok keep me posted
 
I found out what the problem was.... You're going to laugh when you hear this. It was user error. I changed the file name of the nif file from maceman.nif to squire.nif. This caused the break in the buttons appearing in the game. As soon as I changed the file name back everything started to appear. Ah, one day we'll look back at this thread and laugh...but not today.
 
I found out what the problem was.... You're going to laugh when you hear this. It was user error. I changed the file name of the nif file from maceman.nif to squire.nif. This caused the break in the buttons appearing in the game. As soon as I changed the file name back everything started to appear. Ah, one day we'll look back at this thread and laugh...but not today.



well I hope at least the default/UU difference in UNITCLASS helped ya :lol:

anyway glad you got it working...


also syntax error is the #1 reason something doesnt work in XML :p




FYI You didnt mention you changed the animation files and that is a whole other animal :mischief:
 
I'm new at modding and need some help urgently. I tried to make a new Unit for Warlords with the Mig-21 model based on the Jet Fighter. So I followed this guied. I can place the plane in the World Builder, it looks fine, but there are no order buttons. If I select for example a settler first and then click on the Mig, there are the same order options!

Can somebody please give me some advice?
 
I think this is the same problem I had. Did you by chance rename the .nif file? If the .nif file is named mig-21.nif, try renaming it the same name as the jet fighter in the game. I don't have civ iv in front of me, but it could be something like jetfight.nif...just a guess.
 
Back
Top Bottom