[TUT] Adding newly created units to Civ4 in 6 "easy" steps

hey so i've gotten through the tutorial and understand it all up to step 5. Its the formations part. I don't understand what we do here. could someone explain it to me??? thanks
 
ok, I followed this tutorial in order to create a UU for Japan, SWORDSMAN_JAPAN. Everything is working properly except......in between turns, he becomes a Samurai. :eek: I used danrell's 11 Japan Units for the art. Here is my XML:

UnitIfos:
Spoiler :
<UnitInfo>
<Class>UNITCLASS_SWORDSMAN</Class>
<Type>UNIT_SWORDSMAN_JAPAN</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_SWORDSMAN_JAPAN</Description>
<Civilopedia>TXT_KEY_UNIT_SWORDSMAN_PEDIA</Civilopedia>
<Strategy>TXT_KEY_UNIT_SWORDSMAN_STRATEGY</Strategy>
<Advisor>ADVISOR_MILITARY</Advisor>
<bAnimal>0</bAnimal>
<bFood>0</bFood>
<bNoBadGoodies>0</bNoBadGoodies>
<bOnlyDefensive>0</bOnlyDefensive>
<bNoCapture>0</bNoCapture>
<bQuickCombat>0</bQuickCombat>
<bRivalTerritory>0</bRivalTerritory>
<bMilitaryHappiness>1</bMilitaryHappiness>
<bMilitarySupport>1</bMilitarySupport>
<bMilitaryProduction>1</bMilitaryProduction>
<bPillage>1</bPillage>
<bSpy>0</bSpy>
<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>
<bCanMoveAllTerrain>0</bCanMoveAllTerrain>
<bFlatMovementCost>0</bFlatMovementCost>
<bIgnoreTerrainCost>0</bIgnoreTerrainCost>
<bNukeImmune>0</bNukeImmune>
<bPrereqBonuses>0</bPrereqBonuses>
<bPrereqReligion>0</bPrereqReligion>
<bMechanized>0</bMechanized>
<bSuicide>0</bSuicide>
<bHiddenNationality>0</bHiddenNationality>
<bAlwaysHostile>0</bAlwaysHostile>
<UnitClassUpgrades>
<UnitClassUpgrade>
<UnitClassUpgradeType>UNITCLASS_AXEMAN</UnitClassUpgradeType>
<bUnitClassUpgrade>1</bUnitClassUpgrade>
</UnitClassUpgrade>
</UnitClassUpgrades>
<UnitClassTargets/>
<UnitCombatTargets/>
<UnitClassDefenders/>
<UnitCombatDefenders/>
<FlankingStrikes/>
<UnitAIs>
<UnitAI>
<UnitAIType>UNITAI_ATTACK</UnitAIType>
<bUnitAI>1</bUnitAI>
</UnitAI>
<UnitAI>
<UnitAIType>UNITAI_ATTACK_CITY</UnitAIType>
<bUnitAI>1</bUnitAI>
</UnitAI>
<UnitAI>
<UnitAIType>UNITAI_RESERVE</UnitAIType>
<bUnitAI>1</bUnitAI>
</UnitAI>
<UnitAI>
<UnitAIType>UNITAI_CITY_DEFENSE</UnitAIType>
<bUnitAI>1</bUnitAI>
</UnitAI>
</UnitAIs>
<NotUnitAIs/>
<Builds/>
<ReligionSpreads/>
<CorporationSpreads/>
<GreatPeoples/>
<Buildings/>
<ForceBuildings/>
<HolyCity>NONE</HolyCity>
<ReligionType>NONE</ReligionType>
<StateReligion>NONE</StateReligion>
<PrereqReligion>NONE</PrereqReligion>
<PrereqCorporation>NONE</PrereqCorporation>
<PrereqBuilding>NONE</PrereqBuilding>
<PrereqTech>TECH_IRON_WORKING</PrereqTech>
<TechTypes/>
<BonusType>BONUS_IRON</BonusType>
<PrereqBonuses/>
<ProductionTraits/>
<Flavors/>
<iAIWeight>0</iAIWeight>
<iCost>40</iCost>
<iHurryCostModifier>0</iHurryCostModifier>
<iAdvancedStartCost>100</iAdvancedStartCost>
<iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
<iMinAreaSize>-1</iMinAreaSize>
<iMoves>1</iMoves>
<bNoRevealMap>0</bNoRevealMap>
<iAirRange>0</iAirRange>
<iAirUnitCap>0</iAirUnitCap>
<iDropRange>0</iDropRange>
<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>
<iEspionagePoints>0</iEspionagePoints>
<TerrainImpassables/>
<FeatureImpassables/>
<TerrainPassableTechs/>
<FeaturePassableTechs/>
<iCombat>6</iCombat>
<iCombatLimit>100</iCombatLimit>
<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>10</iCityAttack>
<iCityDefense>0</iCityDefense>
<iAnimalCombat>0</iAnimalCombat>
<iHillsAttack>0</iHillsAttack>
<iHillsDefense>0</iHillsDefense>
<TerrainNatives/>
<FeatureNatives/>
<TerrainAttacks/>
<TerrainDefenses/>
<FeatureAttacks/>
<FeatureDefenses/>
<UnitClassAttackMods/>
<UnitClassDefenseMods/>
<UnitCombatMods/>
<UnitCombatCollateralImmunes/>
<DomainMods/>
<BonusProductionModifiers/>
<iBombRate>0</iBombRate>
<iBombardRate>0</iBombardRate>
<SpecialCargo>NONE</SpecialCargo>
<DomainCargo>NONE</DomainCargo>
<iCargo>0</iCargo>
<iConscription>1</iConscription>
<iCultureGarrison>5</iCultureGarrison>
<iExtraCost>0</iExtraCost>
<iAsset>2</iAsset>
<iPower>6</iPower>
<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_SWORDSMAN_JAPAN</EarlyArtDefineTag>
</UnitMeshGroup>
</UnitMeshGroups>
<FormationType>FORMATION_TYPE_DEFAULT</FormationType>
<HotKey/>
<bAltDown>0</bAltDown>
<bShiftDown>0</bShiftDown>
<bCtrlDown>0</bCtrlDown>
<iHotKeyPriority>0</iHotKeyPriority>
<FreePromotions/>
<LeaderPromotion>NONE</LeaderPromotion>
<iLeaderExperience>0</iLeaderExperience>
</UnitInfo>


ArtDefines_Unit:
Spoiler :
<UnitArtInfo>
<Type>ART_DEF_UNIT_SWORDSMAN_JAPAN</Type>
<Button>,Art/Interface/Buttons/Units/Swordsman.dds,Art/Interface/Buttons/Unit_Resource_Atlas.dds,4,5</Button>
<fScale>0.44</fScale>
<fInterfaceScale>1.0</fInterfaceScale>
<bActAsLand>0</bActAsLand>
<bActAsAir>0</bActAsAir>
<NIF>Art/Units/Swordsman_Japan/Swordsman.nif</NIF>
<KFM>Art/Units/Unique/Japan/Samurai/JapaneseSamurai.kfm</KFM>
<SHADERNIF></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>


the nif is the path for danrell's mod and the kfm is for civ4's Samurai (the animation danrell reccomended) his mod does not have a shader nif or shadow.

What am I doing wrong? :confused:

Update: It only changes to samurai after attacking, after moving it stays with the right art
 
I guess you're running the game with low graphical settings, right ;)?
Then go in Civ4 into the graphics options menu, and look at the right, there's an option "frozen animations" or similar, and the box is probably ticket, right? Untick it, should fix the problem :).
 
I guess you're running the game with low graphical settings, right ;)?
Then go in Civ4 into the graphics options menu, and look at the right, there's an option "frozen animations" or similar, and the box is probably ticket, right? Untick it, should fix the problem :).

Well that's just silly, thanks for the assist The_J :high5:
 
I'm getting the red blob with one new unit and a pink warrior with the other. I'm confused about the file paths. My new unit art folders are in CivIV/BTS/Mods/mymod/Assets/Art/Units. Looking at other mods, all the file paths just go Art/Units/unit but sometimes seem to be referencing files not in the mod folder. I've tried putting the new unit folders in the main Art/Units folder also but with the same results.

my code:
Spoiler :
red ball
Code:
<UnitMeshGroups>
				<iGroupSize>3</iGroupSize>
				<fMaxSpeed>1.75</fMaxSpeed>
				<fPadTime>1</fPadTime>
				<iMeleeWaveSize>3</iMeleeWaveSize>
				<iRangedWaveSize>3</iRangedWaveSize>
				<UnitMeshGroup>
					<iRequired>3</iRequired>
					<EarlyArtDefineTag>ART_DEF_UNIT_GRIVPANVAR</EarlyArtDefineTag>
				</UnitMeshGroup>
			</UnitMeshGroups>

Code:
<UnitArtInfo>
			<Type>ART_DEF_UNIT_GRIVPANVAR</Type>
			<Button>,Art/Interface/Buttons/Units/ICBM.dds,Art/Interface/Buttons/Beyond_the_Sword_Atlas.dds,2,10</Button>
			<fScale>0.42</fScale>
			<fInterfaceScale>0.9</fInterfaceScale>
			<bActAsLand>0</bActAsLand>
			<bActAsAir>0</bActAsAir>
			<NIF>Art/Units/Grivpanvar/Grivpanvar.nif</NIF>
			<KFM>Art/Units/Unique_Byzantine_Cataphract/Unique_Byzantine_Cataphract.kfm</KFM>
			<SHADERNIF>Art/Grivpanvar/Grivpanvar.nif</SHADERNIF>
			<ShadowDef>
				<ShadowNIF>Art/Units/01_UnitShadows/HorseShadow.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>
		<UnitArtInfo>

pink warrior

Code:
<UnitMeshGroups>
				<iGroupSize>3</iGroupSize>
				<fMaxSpeed>1.75</fMaxSpeed>
				<fPadTime>1</fPadTime>
				<iMeleeWaveSize>3</iMeleeWaveSize>
				<iRangedWaveSize>0</iRangedWaveSize>
				<UnitMeshGroup>
					<iRequired>8</iRequired>
					<EarlyArtDefineTag>ART_DEF_UNIT_JAVELINMAN</EarlyArtDefineTag>
				</UnitMeshGroup>
			</UnitMeshGroups>

Code:
<UnitArtInfo>
			<Type>ART_DEF_UNIT_JAVELINMAN</Type>
			<Button>,Art/Interface/Buttons/Units/Warrior.dds,Art/Interface/Buttons/Unit_Resource_Atlas.dds,2,1</Button>
			<fScale>0.44</fScale>
			<fInterfaceScale>1.0</fInterfaceScale>
			<bActAsLand>0</bActAsLand>
			<bActAsAir>0</bActAsAir>
			<NIF>Art/Units/Javelinman/Warrior.nif</NIF>
			<KFM>Art/Units/Javelinman/Warrior.kfm</KFM>
			<SHADERNIF>Art/Units/Javelinman/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>

my indentation pasted funny but I get no xml errors.
 
Looking at other mods, all the file paths just go Art/Units/unit

This is right, relative paths are enough for civ.

but sometimes seem to be referencing files not in the mod folder.

For faster loading many modders (and Firaxis) put art files into bigger .fpk files (Firaxis ones are in Civ4\Assets), which you can unpack with the utility pakbuild (in our download database). That's probably the reason why you can't find the file paths.

my indentation pasted funny but I get no xml errors.

Python is sensitive about indentation, XML is not ;).

@the problem:
Grivpanvar, shadernif,
PHP:
Art/Grivpanvar/

you forgot the units subfolder.

For the warrior...is it really a pink warrior, or a pink blob?
 
I've added in a few units and even some buildings. And I can add them in through world builder and they function just fine. But if i'm playing the game and I select to build them from a city, the game crashes. What did I do wrong?
 
2 possibilities, which would fit to the symptoms:
a) your button is bigger than 64*64.
b) if not a, then i'm sure you took a look at the button definitions before, and you saw:
PHP:
	<Button>,Art/Interface/Buttons/Units/Lion.dds,Art/Interface/Buttons/Unit_Resource_Atlas.dds,6,5</Button>

Afterwards, you deduced you'll add a button like this:
PHP:
	<Button>,Art/Interface/Buttons/myNewButton.dds</Button>

Right?
Congrats :D, you've stumbled upon the error which really everyone here does (including myself at the beginning): Remove the comma at the beginning. No idea why, but if you only have a single button, and you have a comma at the beginning, it will crash the game.
That's one of the most occuring "beginner errors", and hell, i still don't understand why it happens.
 
Rabbit, thank you for the great tutorial! Even though I'm completely new to modding, I was able to follow your simple instructions and came to a satisfying result for my first try.

I have a few questions if you could spare some time to answer them:

1) I had to skip step 5 as I couldn't find any list of units to add my new unit to. I have seen other posts suggesting to skip this step, but it doesn't sound so hard if I can only find that unit list you're referring to. Maybe you can elaborate on this step a bit more? I'm not even sure what formations are exactly.

2) The unit I've added is a chariot type unit with art created by Bakuel. It is based on the unique Egyptian War Chariot unit. While I've got it to appear on the map and I can play with it, the horses' reins are pink! Please find two images attached to this post, what the unit is supposed to look like and what it actually looks like in-game.

Could you please tell me what I've done wrong? Here is the code in my ArtDefines_Unit file for this specific unit:

Spoiler :

<UnitArtInfo><Type>ART_DEF_UNIT_INDIA_WARCHARIOT</Type><Button>,Art/Interface/Buttons/Units/Chariot_WarChariot.dds,Art/Interface/Buttons/Unit_Resource_Atlas.dds,6,7</Button><fScale>0.37</fScale><fInterfaceScale>0.8</fInterfaceScale><bActAsLand>0</bActAsLand><bActAsAir>0</bActAsAir><NIF>Art/Units/INDIA_WARCHARIOT/IndianTamilChariot.nif</NIF><KFM>Art/Units/Unique/Egypt/WarChariot/EgyptianWarChariot.kfm</KFM><SHADERNIF>Art/Units/INDIA_WARCHARIOT/IndianTamilChariot.nif</SHADERNIF><ShadowDef><ShadowNIF>Art/Units/01_UnitShadows/WarChariotShadow.nif</ShadowNIF><ShadowAttachNode>BIP Pelvis</ShadowAttachNode><fShadowScale>1.0</fShadowScale></ShadowDef><fBattleDistance>0.20</fBattleDistance><fRangedDeathTime>0.31</fRangedDeathTime><bSmoothMove>1</bSmoothMove><fAngleInterpRate>360.0</fAngleInterpRate><fExchangeAngle>-30.0</fExchangeAngle><bActAsRanged>0</bActAsRanged><TrainSound>AS2D_UNIT_BUILD_UNIQUE_UNIT</TrainSound><AudioRunSounds><AudioRunTypeLoop>LOOPSTEP_WHEELS_2</AudioRunTypeLoop><AudioRunTypeEnd>ENDSTEP_WHEELS_2</AudioRunTypeEnd></AudioRunSounds></UnitArtInfo>


Also, here is the link to the art by Bakuel, in case this can help provide a solution to my problem: http://forums.civfanatics.com/downloads.php?do=file&id=20054

3) There doesn't seem to be any player colours on this unit and the only way to differentiate it from another player's is by the flag. Is this normal? Is there something simple I can do to remedy this? I don't know the first thing about 3D modeling and I'm not about to get into that, but I'm quite handy with Photoshop if that can do the trick.

Thanks again for the great tutorial Rabbit. I couldn't believe my eyes when I saw that new unit pop onto the map!

Frugalmeister
 

Attachments

  • good.jpg
    good.jpg
    16 KB · Views: 229
  • bad.jpg
    bad.jpg
    38.6 KB · Views: 204
Since the OP is not anymore active...

1) formations are just nice to have eye candy. Not really necessary for the basic things.
Don't understand that part either, so feel free to ignore it.

2) there must be some texture missing from the download (-> not your fault). Best to ask in the units thread.

3) To add or not to add team colour parts is a decision of the artist. If there's no team colour part, then yes, it's normal.
Adding team colour is AFAIK not too difficult. It would require that some parts of the texture are made transparent, but I don't know anything more about it.
 
2) The unit I've added is a chariot type unit with art created by Bakuel. It is based on the unique Egyptian War Chariot unit. While I've got it to appear on the map and I can play with it, the horses' reins are pink! Please find two images attached to this post, what the unit is supposed to look like and what it actually looks like in-game.

You say the horse reins are pink - but so is the player colour in your added pic. In the original pic from Bakuel the reins are white (instead of black/brown or barely visible), which suggests to me they should match the player colour in-game.
 
Thank you The_J. I will try and see with the creator if a file is missing from the graphics pack.

Jeelen, for that game I picked India whose colour is purple, closely resembling the pink of the reins. Bad choice on my part. :p I did lay the unit as other players and the reins remained pink. No team colours are displayed on the unit.

Frugalmeister
 
Hey! Thanks for this wonderful tutorial, I've been able to make lots of units. I have a question though. How do I limit the number of a specific unit per player? Like in FfH. I want to make my "French Duke" unit limit to only one per player. How do I do that?
 
Can someone tell me why some units show up in game and others do not? Everything in the coding is identical.
 
Top Bottom