GUIDE: Adding new units

The unit is a replacement marine for England, for now I have just put the standard marine into the
Art/Units/UKMARINE/Marines.nif</NIF>

CIV4UnitInfos.xml

<UnitInfo>
<Class>UNITCLASS_MARINE</Class>
<Type>UNIT_UKMARINE</Type>
<UniqueNames/>
<Special>NONE</Special>
<Capture>NONE</Capture>
<Combat>UNITCOMBAT_GUN</Combat>
<Domain>DOMAIN_LAND</Domain>
<DefaultUnitAI>UNITAI_ATTACK</DefaultUnitAI>
<Invisible>NONE</Invisible>
<SeeInvisible>NONE</SeeInvisible>
<Description>TXT_KEY_UNIT_UKMARINE</Description>
<Civilopedia>TXT_KEY_UNIT_UKMARINE_PEDIA</Civilopedia>
<Strategy>TXT_KEY_UNIT_UKMARINE_STRATEGY</Strategy>
<Advisor>ADVISOR_MILITARY</Advisor>
And
<UnitMeshGroups>
<iGroupSize>3</iGroupSize>
<fMaxSpeed>1.75</fMaxSpeed>
<iMeleeWaveSize>3</iMeleeWaveSize>
<iRangedWaveSize>0</iRangedWaveSize>
<UnitMeshGroup>
<iRequired>3</iRequired>
<EarlyArtDefineTag>ART_DEF_UNIT_UKMARINE</EarlyArtDefineTag>
</UnitMeshGroup>
</UnitMeshGroups>
<Button>,Art/Interface/Buttons/Units/UKMARINE.dds</Button>
<HotKey/>
<bAltDown>0</bAltDown>
<bShiftDown>0</bShiftDown>
<bCtrlDown>0</bCtrlDown>


I have left the class bit as it is, koz it uses the standard marine class, if I make a unique class for it, then all Civs will be able to build this unit.

CIV4ArtDefines_Unit.xml

<UnitArtInfo>
<Type>ART_DEF_UNIT_UKMARINE</Type>
<fScale>0.44</fScale>
<fInterfaceScale>1.0</fInterfaceScale>
<NIF>Art/Units/UKMARINE/Marines.nif</NIF>
<KFM>Art/Units/UKMARINE/Marines.kfm</KFM>
<SHADERNIF>Art/Units/UKMARINE/Marines_FX.nif</SHADERNIF>
<ShadowDef>
<ShadowNIF>Art/Units/01_UnitShadows/UnitShadow.nif</ShadowNIF>
<ShadowAttachNode>BIP Pelvis</ShadowAttachNode>
<fShadowScale>1.0</fShadowScale>
</ShadowDef>
<fBattleDistance>0.35</fBattleDistance>
<fRangedDeathTime>0.05</fRangedDeathTime>
<bActAsRanged>1</bActAsRanged>
<TrainSound>AS2D_UNIT_BUILD_UNIT</TrainSound>
<AudioRunSounds>
<AudioRunTypeLoop/>
<AudioRunTypeEnd/>
</AudioRunSounds>
</UnitArtInfo>
<UnitArtInfo>

CIV4CivilizationInfos.xml

<Units>
<Unit>
<UnitClassType>UNITCLASS_RIFLEMAN</UnitClassType>
<UnitType>UNIT_ENGLISH_REDCOAT</UnitType>
</Unit>
<Unit>
<UnitClassType>UNITCLASS_MARINE</UnitClassType>
<UnitType>UNIT_UKMARINE</UnitType>
</Unit>
</Units>

That&#8217;s all I have done. I left out all the civilopedia bit out(Text), I don&#8217;t think it will effect the game.
do you?
The tutorial left that bit out I&#8217;m assuming its ok .
I put the tech require to NONE so I could test this out as soon as I started the game. do you think that will effect it?
I can see the unit is fine, and the button shows in the city build screen, but as soon as I click the marine icon it crashes&#8230;
Someone please help
 
I'm not sure about this, but it could be a problem... I'll compare some of my stuff to yours and see if I can find something. If all else fails, re-read everything and try again. My first try I messed something up and couldn't find the error, I started over and 2nd time it worked. Hope this helps :)

The code you have changed should be ok. Did you copy the entire marines folder to your mod or just the 3 files? And did you make the buttons DXT 3 with mipmaps? I think it must be in this format. Maybe someone with more experience could help you, but I'm not sure what else could be wrong if those aren't.
 
The unit is a replacement marine for England, for now I have just put the standard marine into the
Art/Units/UKMARINE/Marines.nif</NIF>


ok Im not sure but here are two possible problems with this:
(Im not sure.. but Im guessing)

CIV4UnitInfos.xml

Code:
<UnitInfo>
			<Class>UNITCLASS_MARINE</Class>
			<Type>[COLOR="DarkSlateBlue"]UNIT_UKMARINE[/COLOR]</Type>
			<UniqueNames/>
			<Special>NONE</Special>
			<Capture>NONE</Capture>
			<Combat>UNITCOMBAT_GUN</Combat>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_ATTACK</DefaultUnitAI>
			<Invisible>NONE</Invisible>
...
...
...
					<EarlyArtDefineTag>[COLOR="darkslateblue"]ART_DEF_UNIT_UKMARINE[/COLOR]</EarlyArtDefineTag>
				</UnitMeshGroup>
			</UnitMeshGroups>
			<Button>,Art/Interface/Buttons/Units/[COLOR="darkslateblue"]UKMARINE[/COLOR].dds</Button>
			<HotKey/>
			<bAltDown>0</bAltDown>
			<bShiftDown>0</bShiftDown>
			<bCtrlDown>0</bCtrlDown>


[COLOR="Navy"]I have left the class bit as it is, koz it uses the standard marine class, if I make a unique class for it, then all Civs will be able to build this unit.[/COLOR]


you changed the button locations for the marine to UKMarine.dds file

did you copy the marine.dds file and rename it to UKMARINE.ddsfile? and put that in the correct path of:

[/custom assetsfolder (or your mod folder/assets/)]Art/Interface/Buttons/Units folder ?

also you did that... you used the wrong syntax where this:
Code:
<Button>[COLOR="Sienna"],Art[/COLOR]/Interface/Buttons/Units/[COLOR="darkslateblue"]UKMARINE[/COLOR].dds</Button>
			<HotKey/>

should be this:

Code:
<Button>[COLOR="DarkSlateBlue"]Art[/COLOR]/Interface/Buttons/Units/[COLOR="darkslateblue"]UKMARINE[/COLOR].dds</Button>
			<HotKey/>


notice the comma missing?


also the possible second problem:


CIV4ArtDefines_Unit.xml

<
Code:
UnitArtInfo>
			<Type>[COLOR="darkslateblue"]ART_DEF_UNIT_UKMARINE[/COLOR]</Type>
			<fScale>0.44</fScale>
			<fInterfaceScale>1.0</fInterfaceScale>
			<NIF>[COLOR="darkslateblue"]Art/Units/UKMARINE/Marines.nif[/COLOR]</NIF>
			<KFM>[COLOR="darkslateblue"]Art/Units/UKMARINE/Marines.kfm[/COLOR]</KFM>
			<SHADERNIF>[COLOR="darkslateblue"]Art/Units/UKMARINE/Marines_FX.nif[/COLOR]</SHADERNIF>
			<ShadowDef>
				<ShadowNIF>Art/Units/01_UnitShadows/UnitShadow.nif</ShadowNIF>
				<ShadowAttachNode>BIP Pelvis</ShadowAttachNode>
...
...
...
		<UnitArtInfo>

where you defined the new animations for the standard/default Marine to a new folder called UKMARINE Folder

did you make a new folder called UKMARINE using the path:
Art/Units/UKMARINE folder?


and did you place the standard/defualt Marine animations in that folder?


if you did not then you need to extract the marine animations from the:

Assets0.fpk
Assets1.fpk
Assets2.fpk
Assets3.fpk files

unpaking them first and copying the correct animation files

an easier way is to keep the animation tagline from the default marine unit:

Code:
		<UnitArtInfo>
			<Type>ART_DEF_UNIT_MARINE</Type>
			<fScale>0.44</fScale>
			<fInterfaceScale>1.0</fInterfaceScale>
[COLOR="Blue"]			<NIF>Art/Units/Marine/Marines.nif</NIF>
			<KFM>Art/Units/Marine/Marines.kfm</KFM>
			<SHADERNIF>Art/Units/Marine/Marines_FX.nif</SHADERNIF>
			<ShadowDef>[/COLOR]
				<ShadowNIF>Art/Units/01_UnitShadows/UnitShadow.nif</ShadowNIF>
				<ShadowAttachNode>
...
...
...
		</UnitArtInfo>


Just change the default unit to your UU:
(remember to cut and paste it first since you still need the original UU info in there!)

Code:
		<UnitArtInfo>
			[COLOR="Navy"]<Type>ART_DEF_UNIT_UKMARINE</Type>[/COLOR]

then you dont have to bother making a new folder/copying animation files because your UKMARINE uses the same animations as the default marine... that already exists :goodjob:

this looks ok

CIV4CivilizationInfos.xml

<Units>
<Unit>
<UnitClassType>UNITCLASS_RIFLEMAN</UnitClassType>
<UnitType>UNIT_ENGLISH_REDCOAT</UnitType>
</Unit>
<Unit>
<UnitClassType>UNITCLASS_MARINE</UnitClassType>
<UnitType>UNIT_UKMARINE</UnitType>
</Unit>
</Units>

That’s all I have done. I left out all the civilopedia bit out(Text), I don’t think it will effect the game.
do you?


I dont think it will affect it... only the appearance to the civilopedia

but those changes are not that hard once you get the hang of it

The tutorial left that bit out I’m assuming its ok .

doesnt affect much except instead of the real text you see TXT_ etc.



I put the tech require to NONE so I could test this out as soon as I started the game. do you think that will effect it?


since it is a UU it does matter what TECH is defined because a UU replaces a standard unit

since any unit is defined by what TECH is discovered (when you can build a unit and so forth) you must define the UU with the same tech that the standard unit uses

I can see the unit is fine, and the button shows in the city build screen, but as soon as I click the marine icon it crashes…
Someone please help

well I think that's a lot of work...

I could be wrong... but that's my ideas :crazyeye:

hope it helps


PS I found it easy to take an existing mod... and follow a "new" unit/building/UU

and see what changes worked...and how was it coded

that's what I did :D
 
Could anybody please:
1) tell me what xml files I have to edit to add a new unit in a civ4-warlords mod?
2) and to include a new building?
Thanks, I do appreciate it.
 
Could anybody please:
1) tell me what xml files I have to edit to add a new unit in a civ4-warlords mod?
2) and to include a new building?
Thanks, I do appreciate it.

I e-mailed you what i think will help, if not let us know.;)
 
sorry if this has been covered, but i have not found it yet. how do you make an aircraft usable or unusable on a carrier....ive been adding some new units but cant for the life of me figure it out...thanks
 
sorry if this has been covered, but i have not found it yet. how do you make an aircraft usable or unusable on a carrier....ive been adding some new units but cant for the life of me figure it out...thanks

In the civ4unitinfos.xml
Code:
<UnitInfo>
			<Class>UNITCLASS_CARRIER</Class>
			<Type>UNIT_CARRIER</Type>
			<UniqueNames/>
			<Special>NONE</Special>
			<Capture>NONE</Capture>
			<Combat>UNITCOMBAT_NAVAL</Combat>
			<Domain>DOMAIN_SEA</Domain>
			<DefaultUnitAI>UNITAI_CARRIER_SEA</DefaultUnitAI>
			<Invisible>NONE</Invisible>
			<SeeInvisible>NONE</SeeInvisible>
			<Description>TXT_KEY_UNIT_CARRIER</Description>
			<Civilopedia>TXT_KEY_UNIT_CARRIER_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_UNIT_CARRIER_STRATEGY</Strategy>
			<Advisor>ADVISOR_MILITARY</Advisor>
			<bAnimal>0</bAnimal>
			<bFood>0</bFood>
			<bNoBadGoodies>0</bNoBadGoodies>
			<bOnlyDefensive>0</bOnlyDefensive>
			<bNoCapture>0</bNoCapture>
			<bRivalTerritory>0</bRivalTerritory>
			<bMilitaryHappiness>0</bMilitaryHappiness>
			<bMilitarySupport>1</bMilitarySupport>
			<bMilitaryProduction>1</bMilitaryProduction>
			<bPillage>1</bPillage>
			<bSabotage>0</bSabotage>
			<bDestroy>0</bDestroy>
			<bStealPlans>0</bStealPlans>
			<bInvestigate>0</bInvestigate>
			<bCounterSpy>0</bCounterSpy>
			<bFound>0</bFound>
			<bGoldenAge>0</bGoldenAge>
			<bInvisible>0</bInvisible>
			<bFirstStrikeImmune>0</bFirstStrikeImmune>
			<bNoDefensiveBonus>0</bNoDefensiveBonus>
			<bIgnoreBuildingDefense>1</bIgnoreBuildingDefense>
			<bCanMoveImpassable>0</bCanMoveImpassable>
			<bFlatMovementCost>0</bFlatMovementCost>
			<bIgnoreTerrainCost>0</bIgnoreTerrainCost>
			<bNukeImmune>0</bNukeImmune>
			<bPrereqBonuses>0</bPrereqBonuses>
			<bPrereqReligion>0</bPrereqReligion>
			<bMechanized>1</bMechanized>
			<bRenderBelowWater>1</bRenderBelowWater>
			<UnitClassUpgrades/>
			<UnitClassTargets/>
			<UnitCombatTargets/>
			<UnitClassDefenders/>
			<UnitCombatDefenders/>
			<UnitAIs>
				<UnitAI>
					<UnitAIType>UNITAI_CARRIER_SEA</UnitAIType>
					<bUnitAI>1</bUnitAI>
				</UnitAI>
			</UnitAIs>
			<NotUnitAIs/>
			<Builds/>
			<ReligionSpreads/>
			<GreatPeoples/>
			<Buildings/>
			<ForceBuildings/>
			<HolyCity>NONE</HolyCity>
			<ReligionType>NONE</ReligionType>
			<StateReligion>NONE</StateReligion>
			<PrereqReligion>NONE</PrereqReligion>
			<PrereqBuilding>NONE</PrereqBuilding>
			<PrereqTech>TECH_FLIGHT</PrereqTech>
			<TechTypes/>
			<BonusType>NONE</BonusType>
			<PrereqBonuses>
				<BonusType>BONUS_OIL</BonusType>
				<BonusType>BONUS_URANIUM</BonusType>
				<BonusType>NONE</BonusType>
				<BonusType>NONE</BonusType>
			</PrereqBonuses>
			<ProductionTraits/>
			<Flavors/>
			<iAIWeight>0</iAIWeight>
			<iCost>175</iCost>
			<iHurryCostModifier>0</iHurryCostModifier>
			<iMinAreaSize>20</iMinAreaSize>
			<iMoves>5</iMoves>
			<iAirRange>0</iAirRange>
			<iNukeRange>-1</iNukeRange>
			<iWorkRate>0</iWorkRate>
			<iBaseDiscover>0</iBaseDiscover>
			<iDiscoverMultiplier>0</iDiscoverMultiplier>
			<iBaseHurry>0</iBaseHurry>
			<iHurryMultiplier>0</iHurryMultiplier>
			<iBaseTrade>0</iBaseTrade>
			<iTradeMultiplier>0</iTradeMultiplier>
			<iGreatWorkCulture>0</iGreatWorkCulture>
			<TerrainImpassables/>
			<FeatureImpassables/>
			<iCombat>16</iCombat>
			<iAirCombat>0</iAirCombat>
			<iAirCombatLimit>0</iAirCombatLimit>
			<iXPValueAttack>4</iXPValueAttack>
			<iXPValueDefense>2</iXPValueDefense>
			<iFirstStrikes>0</iFirstStrikes>
			<iChanceFirstStrikes>0</iChanceFirstStrikes>
			<iInterceptionProbability>0</iInterceptionProbability>
			<iEvasionProbability>0</iEvasionProbability>
			<iWithdrawalProb>0</iWithdrawalProb>
			<iCollateralDamage>0</iCollateralDamage>
			<iCollateralDamageLimit>0</iCollateralDamageLimit>
			<iCollateralDamageMaxUnits>0</iCollateralDamageMaxUnits>
			<iCityAttack>0</iCityAttack>
			<iCityDefense>0</iCityDefense>
			<iAnimalCombat>0</iAnimalCombat>
			<iHillsAttack>0</iHillsAttack>
			<iHillsDefense>0</iHillsDefense>
			<TerrainNatives/>
			<FeatureNatives/>
			<TerrainDefenses/>
			<FeatureDefenses/>
			<UnitClassAttackMods/>
			<UnitClassDefenseMods/>
			<UnitCombatMods/>
			<UnitCombatCollateralImmunes/>
			<DomainMods/>
			<BonusProductionModifiers/>
			<iBombRate>0</iBombRate>
			<iBombardRate>0</iBombardRate>
			[B]<SpecialCargo>SPECIALUNIT_FIGHTER</SpecialCargo>[/B]
			<DomainCargo>DOMAIN_AIR</DomainCargo>
			<iCargo>3</iCargo>
			<iConscription>0</iConscription>
			<iCultureGarrison>0</iCultureGarrison>
			<iExtraCost>0</iExtraCost>
			<iAsset>4</iAsset>
			<iPower>10</iPower>
			<UnitMeshGroups>
				<iGroupSize>1</iGroupSize>
				<fMaxSpeed>2.75</fMaxSpeed>
				<iMeleeWaveSize>1</iMeleeWaveSize>
				<iRangedWaveSize>1</iRangedWaveSize>
				<UnitMeshGroup>
					<iRequired>1</iRequired>
					<EarlyArtDefineTag>ART_DEF_UNIT_CARRIER</EarlyArtDefineTag>
				</UnitMeshGroup>
			</UnitMeshGroups>
			<Button>,Art/Interface/Buttons/Units/Carrier.dds,Art/Interface/Buttons/Unit_Resource_Atlas.dds,1,10</Button>
			<HotKey/>
			<bAltDown>0</bAltDown>
			<bShiftDown>0</bShiftDown>
			<bCtrlDown>0</bCtrlDown>
			<iHotKeyPriority>0</iHotKeyPriority>
			<FreePromotions/>
			<LeaderPromotion>NONE</LeaderPromotion>
			<iLeaderExperience>0</iLeaderExperience>
		</UnitInfo>

you will need to have the said unit defined also in this xml, and it will need the special tag filled. Possibly will need the civ4unitclass.xml, if it is a new unit class.

To get the unit to work, you will also need to edit the artdefinesunit.xml for the animation and art.

Also not 100&#37; on this part, but if you want multiple units to be able to load, you might be able to do this (in theory, not sure if specialcargos is defined).
Code:
<SpecialCargos>
                 <SpecialCargo>SPECIALUNIT_FIGHTER</SpecialCargo>
                 <SpecialCargo>SPECIALUNIT_BOMBER</SpecialCargo>         
</SpecialCargos>
 
Hello, thanks for this tutorial.
Unfortunately I'm not connected to the Internet at home so I'm saving these pages to have a closer look later. But could you tell me, is it possible to edit a unit's movement quota, so that it can move a greater number of tiles per turn? If so, what's the maximum amount of tiles a unit can move in CIV.
Thanks in advance.
 
I'm back! i figured it out, sorta, but when my units come out, they are just pink blobs. how do i fix that?
 
Hello, thanks for this tutorial.
Unfortunately I'm not connected to the Internet at home so I'm saving these pages to have a closer look later. But could you tell me, is it possible to edit a unit's movement quota, so that it can move a greater number of tiles per turn? If so, what's the maximum amount of tiles a unit can move in CIV.
Thanks in advance.

-------------------------------
yes in XML. Assets/xml/units/unitsomthing.xml. you need a word processer to edit it, I use wordpad. you can see a tag called <imoves>1</imoves> you can change it to any number you want. (Note i have not done this in a verrrry long time, so my info may be inacurate.)
 
aah great, thanks ckmcruel

oops I missed your post... (read the one after it)

sorry I didnt help in time :sad:

glad ckmcruel could help ya

PM me if I dont respond to your post (give me a couple of days to respond :goodjob: )


@ ckmcruel nice tagline ;)

your welcome...glad I could help :D
 
I'm back! i figured it out, sorta, but when my units come out, they are just pink blobs. how do i fix that?

ok this is a long tut if you dont know where to begin


the short version:

basically if you d/l a specific unit model you need to place it in a specific folder

to find out where the unit should be make sure you check

CIV4ArtDefines_Unit.xml file

this file is found in your:

assets/xml/art folder path

(remember to copy the original and modify the copy in your [mod name] folder following the same path ;) )




this will tell you where to place the folder/unit model files


of course you have to add an xml tagline entry if it's a custom/new unit :mischief:

for example

Code:
		<UnitArtInfo>
			<Type>ART_DEF_UNIT_WARRIOR</Type>
			<fScale>0.44</fScale>
			<fInterfaceScale>1.0</fInterfaceScale>
[COLOR="Navy"]			<NIF>Art/Units/Warrior/Warrior.nif</NIF>
			<KFM>Art/Units/Warrior/Warrior.kfm</KFM>
			<SHADERNIF>Art/Units/Warrior/Warrior_FX.nif</SHADERNIF>
			<ShadowDef>
				<ShadowNIF>Art/Units/01_UnitShadows/UnitShadow.nif</ShadowNIF>[/COLOR]
				<ShadowAttachNode>BIP Pelvis</ShadowAttachNode>
				<fShadowScale>1.0</fShadowScale>
			</ShadowDef>
			<fBattleDistance>0.35</fBattleDistance>
			<fRangedDeathTime>0.31</fRangedDeathTime>
			<bActAsRanged>0</bActAsRanged>
			<TrainSound>AS2D_UNIT_BUILD_UNIT</TrainSound>
			<AudioRunSounds>
				<AudioRunTypeLoop/>
				<AudioRunTypeEnd/>
			</AudioRunSounds>
		</UnitArtInfo>

notice the folder path of where those nif/kfm files are...

there is where you have to put your new/custom files


note alot of times the new/custom model uses some of the original art files

therefore you can have those folders paths point to the original files

only change/add folder paths to the files you have to add! :crazyeye:


long version:

let me know if you have problems with the short version and I'll post in depth about this :p


hope this helps
 
Hi ive been tring to add a english longbow (2UU for the english) for some time i've had 10 atempts and it woun't work so can some create it for me please i only want a normal longbow to replace alongbow but only for the english empire.
:please:
 
Does anyone know where all the CIV4GameText_Strategy.xml, CIV4GameTextInfos_Objects.xml, and CIV4GameText_Civililopedia_Units.xml went in the BTS expansion cause it is making the guide harder without these critical files.
 
Back
Top Bottom