1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

GUIDE: Adding new units

Discussion in 'Civ4 - Modding Tutorials & Reference' started by sovarn, Nov 10, 2005.

  1. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,211
    Location:
    DE/NL/FR
    Hey, one of them is directly at the top ;), this one. This here might maybe be a better place to start (although i have no idea about it, but the name indicates that it's a bit more generall ;)).
     
  2. progressregress

    progressregress Chieftain

    Joined:
    Jul 5, 2010
    Messages:
    12
    Location:
    England
    Thank you very much Vortilex and The_J, I'll give that a go now.

    Also thanks for the warm welcome!

    [ Worked perfectly :D ]
     
  3. BlackswordSteve

    BlackswordSteve Chieftain

    Joined:
    Jul 5, 2010
    Messages:
    9
    Ok, so I've been looking around on the forums all day to find out why my UU wouldn't work, but I haven't been able to fix the problem yet.

    All I'm doing is copying and pasting the info for the marine unit and changing the stats and stuff. No unique art or anything. I changed it so my civilizationinfos is showing the correct information (unitclass_marine and then my UU as the unit type), but when I load my mod, it says that my UU's unit type's info class was incorrect in the civilizationsinfos xml.

    I'm still very new to modding, so sorry if I'm missing something obvious here.
     
  4. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,211
    Location:
    DE/NL/FR
    Welcome to CFC :).

    Could you please paste your unit info and the short additional entry you've made in the civilizationInfos in here?
    Use a
    Spoiler :
    Spoiler
    if necessary.
     
  5. BlackswordSteve

    BlackswordSteve Chieftain

    Joined:
    Jul 5, 2010
    Messages:
    9
    Alright, I'll do that, but first, maybe I should've asked this in my first post; Do you NEED to change or create text files when making new units? Even if its just copying and pasting pretty much all the information?
     
  6. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,211
    Location:
    DE/NL/FR
    What do you mean with text files? The files in XML\Text? Then...if you want to. If you don't want to distribute a mod, or it should be in one language only, then you can also put the text directly in the unit xml, instead of linking it to another file.
     
  7. BlackswordSteve

    BlackswordSteve Chieftain

    Joined:
    Jul 5, 2010
    Messages:
    9
    Ok, yeah, I was thinking that maybe I needed an xml text entry for my unit to work, but I guess thats not the problem.

    here's my unit info:


    Spoiler :
    <UnitInfo>
    <Class>UNITCLASS_MARINE</Class>
    <Type>UNIT_PARTOPIAN_VANGUARD</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>Vanguard</Description>
    <Civilopedia>TXT_KEY_UNIT_MARINE_PEDIA</Civilopedia>
    <Strategy>TXT_KEY_UNIT_MARINE_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/>
    <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_INDUSTRIALISM</PrereqTech>
    <TechTypes>
    <PrereqTech>TECH_RIFLING</PrereqTech>
    <PrereqTech>NONE</PrereqTech>
    <PrereqTech>NONE</PrereqTech>
    </TechTypes>
    <BonusType>NONE</BonusType>
    <PrereqBonuses/>
    <ProductionTraits/>
    <Flavors/>
    <iAIWeight>0</iAIWeight>
    <iCost>160</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>24</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>
    <UnitClassAttackMod>
    <UnitClassType>UNITCLASS_MACHINE_GUN</UnitClassType>
    <iUnitClassMod>50</iUnitClassMod>
    </UnitClassAttackMod>
    <UnitClassAttackMod>
    <UnitClassType>UNITCLASS_ARTILLERY</UnitClassType>
    <iUnitClassMod>50</iUnitClassMod>
    </UnitClassAttackMod>
    </UnitClassAttackMods>
    <UnitClassDefenseMods/>
    <UnitCombatMods/>
    <UnitCombatCollateralImmunes/>
    <DomainMods/>
    <BonusProductionModifiers/>
    <iBombRate>0</iBombRate>
    <iBombardRate>0</iBombardRate>
    <SpecialCargo>NONE</SpecialCargo>
    <DomainCargo>NONE</DomainCargo>
    <iCargo>0</iCargo>
    <iConscription>0</iConscription>
    <iCultureGarrison>12</iCultureGarrison>
    <iExtraCost>0</iExtraCost>
    <iAsset>5</iAsset>
    <iPower>18</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_MARINE</EarlyArtDefineTag>
    </UnitMeshGroup>
    </UnitMeshGroups>
    <FormationType>FORMATION_TYPE_DEFAULT</FormationType>
    <HotKey/>
    <bAltDown>0</bAltDown>
    <bShiftDown>0</bShiftDown>
    <bCtrlDown>0</bCtrlDown>
    <iHotKeyPriority>0</iHotKeyPriority>
    <FreePromotions>
    <FreePromotion>
    <PromotionType>PROMOTION_COMBAT1</PromotionType>
    <bFreePromotion>1</bFreePromotion>
    </FreePromotion>
    <FreePromotion>
    <PromotionType>PROMOTION_COMBAT2</PromotionType>
    <bFreePromotion>1</bFreePromotion>
    </FreePromotion>
    </FreePromotions>
    <LeaderPromotion>NONE</LeaderPromotion>
    <iLeaderExperience>0</iLeaderExperience>
    </UnitInfo>



    and my civilizationinfo:

    Spoiler :
    <Units>
    <Unit>
    <UnitClassType>UNITCLASS_MARINE</UnitClassType>
    <UnitType>UNIT_PARTPOPIAN_VANGUARD</UnitType>
    </Unit>
    </Units>
     
  8. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,211
    Location:
    DE/NL/FR
    Typo in there:
    UNIT_PARTOPIAN_VANGUARD vs:
    UNIT_PARTPOPIAN_VANGUARD
     
  9. BlackswordSteve

    BlackswordSteve Chieftain

    Joined:
    Jul 5, 2010
    Messages:
    9
    Alright. Fixed the typo. Its still not working, though.
     
  10. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,211
    Location:
    DE/NL/FR
    What error (exact please) do you get now?
     
  11. BlackswordSteve

    BlackswordSteve Chieftain

    Joined:
    Jul 5, 2010
    Messages:
    9
    The same error I mentioned in my first post.

    tag: UNIT_PARTOPIAN_VANGUARD in info class was incorrect

    current xml file is: xml\civilizations/CIV4civilizationinfos.xml
     
  12. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,211
    Location:
    DE/NL/FR
    :think: try to hold down shift during loading.
    Maybe the old, unchanged files are still in the cache and your changes are not loaded.


    You should disable caching in the civilization4.ini (in the main BtS folder, open it with a text editor, search for cache or caching).
     
  13. BlackswordSteve

    BlackswordSteve Chieftain

    Joined:
    Jul 5, 2010
    Messages:
    9
    hmmmm. I did all that, but its still not working.
     
  14. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,211
    Location:
    DE/NL/FR
    Then you should check, if the Civ4UnitInfos.xml is at the right place.
    Maybe you've named the folder only "unit" instead of "units", please check that.
     
  15. BlackswordSteve

    BlackswordSteve Chieftain

    Joined:
    Jul 5, 2010
    Messages:
    9
    Sweet! It works now.

    I had thought that since I could run my mod using folders with JUST the files I had changed for my civilizations and leaderheads, I could do the same with the unitinfo file. My mistake, lol.

    Thanks for all the help :)
     
  16. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,211
    Location:
    DE/NL/FR
    Er... you can :confused:.
    What have you done to fix your problem?
     
  17. BlackswordSteve

    BlackswordSteve Chieftain

    Joined:
    Jul 5, 2010
    Messages:
    9
    hmm, I guess I should've been more specific.

    Originally, the only xml files I had in my mod folder was the civilizationinfos and the leaderheadinfos, and it worked fine. Then once I started messing around with units, I figured I could do the same thing, and just put the unitinfos xml in my mod folder. When that didn't work, I put ALL of the unit xml files (from the BTS and original Civ folders) in my mod folder, and then it worked.

    I'm going to work on unique buildings next. Is it basically the same thing as adding unique units? Or is there something special I have to do for buildings?
     
  18. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,211
    Location:
    DE/NL/FR
    Strange, it should have worked in the way you've done it :confused:.
    Okay, doesn't matter, problem solved :lol:.

    Buildings, yes it's in general the same.
    You have to edit the building and -classInfos.xml, the corresponding artDefines, and for an UB you do it in the same like for the UU.
    The stats are sure different, but i guess i don't really have to mention it :D.
     
  19. faexpopuli

    faexpopuli Chieftain

    Joined:
    Sep 22, 2009
    Messages:
    2
    Location:
    Melbourne
    Thanks to Officer Reene for your post. I've been attempting to add units and buildings from FFH2 to Next War and all have caused the game to crash when I've try to build these units. Now everything works. Removing the comma from Buttons did the trick. Thanks Again.
     
  20. justinian66

    justinian66 Chieftain

    Joined:
    Jul 22, 2010
    Messages:
    70

Share This Page