GUIDE: Adding new units

OK. Use the Cavalry's KFM then (just copy the KFM line from the Cavalry's art defines, you don't need to do anything with the file itself). If that doesn't work, try the Cossack's, if that doesn't work try the Cuirassier's, etc. You should eventually find a kfm that works for the model, it'll most likely be the Cavalry's.
 
OK. Use the Cavalry's KFM then (just copy the KFM line from the Cavalry's art defines, you don't need to do anything with the file itself). If that doesn't work, try the Cossack's, if that doesn't work try the Cuirassier's, etc. You should eventually find a kfm that works for the model, it'll most likely be the Cavalry's.

Thank you for your help
funny thing is, the cavalry one's kept freezing my computer... the pikeman works! go figure.
 
Why does it have to be so stinking confusing to add new units.............

I second this. :mischief:

I read all the tutorials around and informations are still confused and even contadictory sometimes when related to the plugins/tools used to export a unit.

What should be great : updated tutorials beginning from A to the end : the unit in game ...

- One related to the 3D part ( with both examples like modifying existing unit and adding a new unit )
- One related to the skinning part
- One related to the xml part

These ones stinked as absolute references.
 
This might be stated somewhere else in the thread, but seeing how its over 20 pages long I didn't read it all. My files are called AssetsX.fpk, not ArtX.fpk. I spent several minutes trying to figure out where the Art0.fpk file was until I decided to unpack the Assests0.fpk file on a hunch and found what I was looking for.
 
...and I'm also stumped. Trying to do the example in the OP and create the terry unit. I get the unit to show up on the city advisor with a proper button and stats and everything, but when it make the unit, it doesn't display properly. It is this bright red orb. I tried several different skins from the download section; some infantry, a bomber, just to see if that was the issue, so it must be in the XML. Can someone help me locate the problem?

Spoiler :
Code:
		<UnitClassInfo>
			<Type>UNITCLASS_TERRY</Type>
			<Description>TXT_KEY_UNIT_TERRY</Description>
			<iMaxGlobalInstances>-1</iMaxGlobalInstances>
			<iMaxTeamInstances>-1</iMaxTeamInstances>
			<iMaxPlayerInstances>-1</iMaxPlayerInstances>
			<DefaultUnit>UNIT_TERRY</DefaultUnit>
		</UnitClassInfo>
Code:
		<UnitInfo>
			<Class>UNITCLASS_TERRY</Class>
			<Type>UNIT_TERRY</Type>
			<UniqueNames/>
			<Special>NONE</Special>
			<Capture>NONE</Capture>
			<Combat>UNITCOMBAT_MELEE</Combat>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_ATTACK</DefaultUnitAI>
			<Invisible>NONE</Invisible>
			<SeeInvisible>NONE</SeeInvisible>
			<Description>TXT_KEY_UNIT_TERRY</Description>
			<Civilopedia>TXT_KEY_UNIT_TERRY_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_UNIT_TERRY_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>1</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>0</bIgnoreBuildingDefense>
			<bCanMoveImpassable>0</bCanMoveImpassable>
			<bFlatMovementCost>0</bFlatMovementCost>
			<bIgnoreTerrainCost>0</bIgnoreTerrainCost>
			<bNukeImmune>0</bNukeImmune>
			<bPrereqBonuses>0</bPrereqBonuses>
			<bPrereqReligion>0</bPrereqReligion>
			<bMechanized>0</bMechanized>
			<UnitClassUpgrades>
				<UnitClassUpgrade>
					<UnitClassUpgradeType>UNITCLASS_AXEMAN</UnitClassUpgradeType>
					<bUnitClassUpgrade>1</bUnitClassUpgrade>
				</UnitClassUpgrade>
				<UnitClassUpgrade>
					<UnitClassUpgradeType>UNITCLASS_SPEARMAN</UnitClassUpgradeType>
					<bUnitClassUpgrade>1</bUnitClassUpgrade>
				</UnitClassUpgrade>
			</UnitClassUpgrades>
			<UnitAIs>
				<UnitAI>
					<UnitAIType>UNITAI_ATTACK</UnitAIType>
					<bUnitAI>1</bUnitAI>
				</UnitAI>
			</UnitAIs>
			<NotUnitAIs>
				<UnitAI>
					<UnitAIType>UNITAI_CITY_DEFENSE</UnitAIType>
					<bUnitAI>1</bUnitAI>
				</UnitAI>
			</NotUnitAIs>
			<Builds/>
			<ReligionSpreads/>
			<GreatPeoples/>
			<Buildings/>
			<ForceBuildings/>
			<HolyCity>NONE</HolyCity>
			<ReligionType>NONE</ReligionType>
			<StateReligion>NONE</StateReligion>
			<PrereqReligion>NONE</PrereqReligion>
			<PrereqBuilding>NONE</PrereqBuilding>
			<PrereqTech>NONE</PrereqTech>
			<TechTypes/>
			<BonusType>NONE</BonusType>
			<PrereqBonuses/>
			<ProductionTraits/>
			<Flavors/>
			<iAIWeight>0</iAIWeight>
			<iCost>15</iCost>
			<iHurryCostModifier>0</iHurryCostModifier>
			<iMinAreaSize>-1</iMinAreaSize>
			<iMoves>1</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>2</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>25</iCityDefense>
			<iAnimalCombat>0</iAnimalCombat>
			<iHillsDefense>0</iHillsDefense>
			<TerrainNatives/>
			<FeatureNatives/>
			<TerrainDefenses/>
			<FeatureDefenses/>
			<UnitClassAttackMods/>
			<UnitClassDefenseMods/>
			<UnitCombatMods/>
			<DomainMods/>
			<BonusProductionModifiers/>
			<iBombRate>0</iBombRate>
			<iBombardRate>0</iBombardRate>
			<SpecialCargo>NONE</SpecialCargo>
			<DomainCargo>NONE</DomainCargo>
			<iCargo>0</iCargo>
			<iConscription>1</iConscription>
			<iCultureGarrison>3</iCultureGarrison>
			<iExtraCost>0</iExtraCost>
			<iAsset>1</iAsset>
			<iPower>1</iPower>
			<UnitMeshGroups>
				<iGroupSize>3</iGroupSize>
				<fMaxSpeed>1.75</fMaxSpeed>
				<iMeleeWaveSize>3</iMeleeWaveSize>
				<iRangedWaveSize>0</iRangedWaveSize>
				<UnitMeshGroup>
					<iRequired>8</iRequired>
					<EarlyArtDefineTag>ART_DEF_UNIT_TERRY</EarlyArtDefineTag>
				</UnitMeshGroup>
			</UnitMeshGroups>
			<Button>,Art/Interface/Buttons/Units/Terry.dds</Button>
			<HotKey/>
			<bAltDown>0</bAltDown>
			<bShiftDown>0</bShiftDown>
			<bCtrlDown>0</bCtrlDown>
			<iHotKeyPriority>0</iHotKeyPriority>
			<FreePromotions/>
		</UnitInfo>
Code:
		<UnitArtInfo>
			<Type>ART_DEF_UNIT_TERRY</Type>
			<fScale>0.44</fScale>
			<fInterfaceScale>1.0</fInterfaceScale>
			<NIF>Art/Units/Terry/Warrior.nif</NIF>
			<KFM>Art/Units/Terry/Warrior.kfm</KFM>
			<SHADERNIF>Art/Units/Terry/Warrior_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.31</fRangedDeathTime>
			<bActAsRanged>0</bActAsRanged>
			<TrainSound>AS2D_UNIT_BUILD_UNIT</TrainSound>
			<AudioRunSounds>
				<AudioRunTypeLoop/>
				<AudioRunTypeEnd/>
			</AudioRunSounds>
		</UnitArtInfo>
 
what do i do to make is so tha tmy unit is specific to a certian civilization and doesnt replace another unit?
 
what do i do to make is so tha tmy unit is specific to a certian civilization and doesnt replace another unit?

Short answer, you can't. If you want a unit to be specific for a civilization, the only way with the CivIV gamecore is to make it a UU, ie make it a unitclass of some other unit, and have it replace that unit the same way other UUs do.

Long answer, you could program this in the gamecore if you know C++. But it would be pretty complicated and is a C++ issue well beyond the scope of this tutorial/thread.

Edit: Actually there is an XML hack you could use. You can set it up in the XML so that the new unitclass you create is replaced by NONE in the civilizationInfos for all civilizations except the one you want to use it:

Code:
			<Units>
				<Unit>
					<UnitClassType>UNITCLASS_KNIGHT</UnitClassType>
					<UnitType>UNIT_ARABIA_CAMELARCHER</UnitType>
				</Unit>
				[B]<Unit>
					<UnitClassType>UNITCLASS_YOURUNITCLASS</UnitClassType>
					<UnitType>NONE</UnitType>
				</Unit>[/B]
			</Units>
 
It's maybe easier, to set the default unit class in UnitClassInfos.xml to none, and add it only as an UU for the civ.

My understanding is this causes a crash for vista users. Could someone with Vista confirm? (I've only heard rumors).
 
Is there an article conserning the making of new units using the old models and skins?

What I'm trying to do is making a Horse Lancer that would use pretty much the same stats as the original horse archer, but look like an Immortal. (I can't change the looks and the name.)

Another similar problem:
Making the Immortal look like a Samurai (I prefer Civ3's Immortal). Also, after making Immortal a replacement for Swordsman, I have noticed that Persia can't build Immortals, but Swordsmen instead... (It doesn't say "Unique unit for Persia" in unit description anymore - don't know why.)
 
Is there an article conserning the making of new units using the old models and skins?

What I'm trying to do is making a Horse Lancer that would use pretty much the same stats as the original horse archer, but look like an Immortal. (I can't change the looks and the name.)

You're talking about two different things ;).
If you say "unit", you normally mean the 3D modell, and not the stats, so creating a new unit would be working with a modelling tool.

But you "just" want to change the modells ingame.
You can do this in an easy way.
Look at the normal entries for units.
At the end is a section, for example from the lion
Spoiler :
PHP:
<UnitMeshGroups>
				<iGroupSize>3</iGroupSize>
				<fMaxSpeed>1.75</fMaxSpeed>
				<fPadTime>1</fPadTime>
				<iMeleeWaveSize>3</iMeleeWaveSize>
				<iRangedWaveSize>0</iRangedWaveSize>
				<UnitMeshGroup>
					<iRequired>3</iRequired>
					<EarlyArtDefineTag>ART_DEF_UNIT_LION</EarlyArtDefineTag>
				</UnitMeshGroup>
			</UnitMeshGroups>

ART_DEF_UNIT_LION points to an entry in ArtDefines_Units.xml, where the model for the lion is assigned.
If you put here instead ART_DEF_UNIT_BEAR, your lion will look like a bear.
 
I followed all the steps in the tutorial and I am still getting an error:

"Failed Loading XML file xml\Art/Civ4ArtDefines_Unit.xml. [.\FXml.cpp:133] Error parsing XML File - File: xml\Art/Civ4ArtDefines_Unit.xml
Reason: Element content is invalid according to the DTD/Schema.
Expecting: {x-schema:Civ4ArtDefinesSchema.xml}NIF.

Line 2432, 15
Source: <bActAsAir>0</bActAsAir>"

Then a second message:

LoadXML call failed for Art/Civ4ArtDefines_Unit.xml
 
I followed all the steps in the tutorial and I am still getting an error:

"Failed Loading XML file xml\Art/Civ4ArtDefines_Unit.xml. [.\FXml.cpp:133] Error parsing XML File - File: xml\Art/Civ4ArtDefines_Unit.xml
Reason: Element content is invalid according to the DTD/Schema.
Expecting: {x-schema:Civ4ArtDefinesSchema.xml}NIF.

Line 2432, 15
Source: <bActAsAir>0</bActAsAir>"

Then a second message:

LoadXML call failed for Art/Civ4ArtDefines_Unit.xml
Based on what you wrote... if you compare an Artdefinesunit xml from BtS assets to your own xml... and look at the line you mention above on the BtS version, and compare it to the same line on yours, you will probably find that the line before or after it is gone on yours, and you will need to add it.

Basically, everything has to line up to a working version... such as in the BtS assets xml for art defines...
There is likely just a small thing missing, but if it doesn't match up to exactly the order the "schema" is expecting, you will always get the failure...
 
Based on what you wrote... if you compare an Artdefinesunit xml from BtS assets to your own xml... and look at the line you mention above on the BtS version, and compare it to the same line on yours, you will probably find that the line before or after it is gone on yours, and you will need to add it.

Basically, everything has to line up to a working version... such as in the BtS assets xml for art defines...
There is likely just a small thing missing, but if it doesn't match up to exactly the order the "schema" is expecting, you will always get the failure...

Well I added one new unit... Cruiser. Is that the problem?

I used the BTS file. I recopied it and everything. This is third time it has messed up.
 
So I downloaded this "Bolter" unit: http://forums.civfanatics.com/downloads.php?do=file&id=11973 with the intent of taking the cool blasting projectile animation and applying it to one of my other units. The animation works fine on the actual downloaded bolter unit, but I just haven't been able to get it to work on any other units. Does anyone know how to apply the animation for the projectile to another unit? Or is there a better thread for this?

Edit: and I just want to change the projectile animation, not the animation of the unit itself. For instance, I want to get a rifleman (using rifleman animation not the bolter's marine animation) to shoot the bolt, etc.

....aaand, I'm a loser and I don't have 3ds max, so I'm looking for a method that doesn't need it, if that's possible. Is there any way for the xml to just tell the unit to use the different projectile animation?
 
Back
Top Bottom