How do i add units for civ 4

chickenx4

Prince
Joined
Jul 21, 2016
Messages
564
Location
Cobb county,GA
hey I got a unit called the ceo musket man and I don know what to do can you help me.
 
youre going to have to code it in unitinfos and then connect its tags in artdefines_Unit and GameText XML Files for your mod

example for:

Spoiler :

Code:
        <UnitInfo>
            <Class>UNITCLASS_MUSKETMAN</Class>
            <Type>UNIT_MISSISSIPPI_NATCHEZ</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_MISSISSIPPI_NATCHEZ</Description>
            <Civilopedia>TXT_KEY_UNIT_MISSISSIPPI_NATCHEZ_PEDIA</Civilopedia>
            <Strategy>TXT_KEY_UNIT_MISSISSIPPI_NATCHEZ_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>1</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_RIFLEMAN</UnitClassUpgradeType>
                    <bUnitClassUpgrade>1</bUnitClassUpgrade>
                </UnitClassUpgrade>
            </UnitClassUpgrades>
            <UnitClassTargets/>
            <UnitCombatTargets/>
            <UnitClassDefenders/>
            <UnitCombatDefenders/>
            <FlankingStrikes/>
            <UnitAIs>
                <UnitAI>
                    <UnitAIType>UNITAI_ATTACK</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_GUNPOWDER</PrereqTech>
            <TechTypes/>
            <BonusType>NONE</BonusType>
            <PrereqBonuses/>
            <ProductionTraits/>
            <Flavors/>
            <iAIWeight>0</iAIWeight>
            <iCost>80</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>10</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>0</iCityAttack>
            <iCityDefense>0</iCityDefense>
            <iAnimalCombat>0</iAnimalCombat>
            <iHillsAttack>0</iHillsAttack>
            <iHillsDefense>0</iHillsDefense>
            <TerrainNatives/>
            <FeatureNatives/>
            <TerrainAttacks/>
            <TerrainDefenses/>
            <FeatureAttacks/>
            <FeatureDefenses/>
            <UnitClassAttackMods/>
            <UnitClassDefenseMods/>
            <UnitCombatMods>
                <UnitCombatMod>
                    <UnitCombatType>UNITCOMBAT_MELEE</UnitCombatType>
                    <iUnitCombatMod>50</iUnitCombatMod>
                </UnitCombatMod>
            </UnitCombatMods>
            <UnitCombatCollateralImmunes/>
            <DomainMods/>
            <BonusProductionModifiers/>
            <iBombRate>0</iBombRate>
            <iBombardRate>0</iBombardRate>
            <SpecialCargo>NONE</SpecialCargo>
            <DomainCargo>NONE</DomainCargo>
            <iCargo>0</iCargo>
            <iConscription>4</iConscription>
            <iCultureGarrison>7</iCultureGarrison>
            <iExtraCost>0</iExtraCost>
            <iAsset>3</iAsset>
            <iPower>9</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_MISSISSIPPI_NATCHEZ</EarlyArtDefineTag>
                </UnitMeshGroup>
            </UnitMeshGroups>
            <FormationType>FORMATION_TYPE_RANGED</FormationType>
            <HotKey/>
            <bAltDown>0</bAltDown>
            <bShiftDown>0</bShiftDown>
            <bCtrlDown>0</bCtrlDown>
            <iHotKeyPriority>0</iHotKeyPriority>
            <FreePromotions/>
            <LeaderPromotion>NONE</LeaderPromotion>
            <iLeaderExperience>0</iLeaderExperience>
        </UnitInfo>


the art defines tag
<EarlyArtDefineTag>ART_DEF_UNIT_MISSISSIPPI_NATCHEZ</EarlyArtDefineTag>

and the GameText tag
<Description>TXT_KEY_UNIT_MISSISSIPPI_NATCHEZ</Description>
<Civilopedia>TXT_KEY_UNIT_MISSISSIPPI_NATCHEZ_PEDIA</Civilopedia>
<Strategy>TXT_KEY_UNIT_MISSISSIPPI_NATCHEZ_STRATEGY</Strategy>


must both have corresponding code in artdefines_unit XML and GameText XML



the tags
Spoiler :

<PrereqReligion>NONE</PrereqReligion>
<PrereqCorporation>NONE</PrereqCorporation>
<PrereqBuilding>NONE</PrereqBuilding>
<PrereqTech>TECH_GUNPOWDER</PrereqTech>


Can be used to define what techs or other prerequisites are need to build the unit
 
Ugh this is so hard to mod civ is there a program that helps you with modding the game I really need help with adding that Coe musketman I would also like to see a video on how to add units in the game
 
I think what gives you trouble is that you actually want to do two things:

a) add a new unit to the game
b) add new unit art to the game

If you don't have experience modding the game, things can be overwhelming, so I suggest breaking them into parts that are as small as possible.

In your case, why not try the following first:
- pick a unit (e.g. a musketman) and change its art to the one you want to use: go to XML/Art/CIV4ArtDefines_Unit.xml and edit ART_DEF_UNIT_MUSKETMAN to point to your new art. See in the game if it worked
- create a new unit by copy and pasting an existing one: go to XML/Units/CIV4UnitInfos.xml and copy the whole block containing say UNIT_MUSKETMAN and change it to UNIT_COE_MUSKETMAN, don't change anything else. Then check if the unit is in the game

It's not that hard, but to really understand it you have to get your hands dirty a bit first. As soon as you run into concrete problems (like error messages, or you make a change but it does not have the effect you expected) people can help you.
 
i have no experience i only have experience on moding civ 3
 
As leoreth has stated getting started is always tough. That being said there are quite a few good tutorials located here:
https://forums.civfanatics.com/forums/civ4-modding-tutorials-reference.177/

To narrow it down a bit kael made an excellent video tutorial series about the absolute basics of creating a mod in civilization 4:
https://forums.civfanatics.com/threads/msmd-how-to-create-a-mod-video-demo.262402/

It doesn't go into too much detail but it is a great place to start if you are an absolute beginner.

There are also quite a few tutorials about adding units to a mod. This one made by Rabbit, White is fairly informative but not too overwhelming:
https://forums.civfanatics.com/thre...created-units-to-civ4-in-6-easy-steps.176460/
 
i have no experience i only have experience on moding civ 3
Experience comes from doing, never from tutorials or guides alone. Focus on something as simple as possible first instead of trying to reach your ultimate goal on the first try. It's not bad if something goes wrong at first, we can help in that case and you will learn from the experience.

If you wait until you get experience before you start you will never start at all.
 
The unit I was going to add I'm not replacing a unit I'm adding a extra one
 
I think the easiest approach is to copy paste an existing unit and then change Type. After that you can change one thing at a time and see the result ingame. Trying to make everything from scratch is hard even for experienced modders.

If there was a video it would be easier
Yeah, video tutorials are often nice, but who should make them?

Also semi-related to this topic, I'm working on an xml editor to make it easier to set up xml files. It's not completely done yet though and has yet to be moved to BTS (though it shouldn't give major problems. I planned the move)
https://forums.civfanatics.com/threads/xml-gui-progress.561743/page-2
 
I think the easiest approach is to copy paste an existing unit and then change Type. After that you can change one thing at a time and see the result ingame. Trying to make everything from scratch is hard even for experienced modders.


Yeah, video tutorials are often nice, but who should make them?

Also semi-related to this topic, I'm working on an xml editor to make it easier to set up xml files. It's not completely done yet though and has yet to be moved to BTS (though it shouldn't give major problems. I planned the move)
https://forums.civfanatics.com/threads/xml-gui-progress.561743/page-2
Can I try it
 
Right now it exist inside Medieval Conquest (Colonization mod). The plan is to finish it and then make a modcomp for BTS. This modcomp can then be used as is or be added to existing BTS mods.

You can either try it in M:C or wait for the modcomp. I hope to make the modcomp soon, like in a week or two, but I can't promise a certain date. It all depends on issues encountered and my available modding time. Regardless of what happens, it's soon relative to the fact that I have worked on an editor on and off since 2015.
 
Back
Top Bottom