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. Vortilex

    Vortilex Imperator Mundi

    Joined:
    Oct 6, 2007
    Messages:
    1,457
    Location:
    St. Augustine, FL
    I've been looking for this tutorial!
     
  2. JA_Lamb

    JA_Lamb Warlord

    Joined:
    Aug 19, 2009
    Messages:
    231
    Location:
    The changing Dark Continent
    Hi The J, I'm unable to replicate the Pink workers conditions after I downloaded the Official and Unofficial patch of 3.19 which you so kindlysuggested I do.

    You were right the game "plays" so much better now. thank you for your help.
     
  3. Vortilex

    Vortilex Imperator Mundi

    Joined:
    Oct 6, 2007
    Messages:
    1,457
    Location:
    St. Augustine, FL
    I was able to replace .nif files regarding infantry, but so far I haven't done much :p
     
  4. JA_Lamb

    JA_Lamb Warlord

    Joined:
    Aug 19, 2009
    Messages:
    231
    Location:
    The changing Dark Continent
    Hi, i don't know if this is the correct place to ask this question but I don't know where else to ask it. :confused:

    I would like to change the cost of upgradiing a unit to another because of aTech change. I've looked in the Forums but couldn't find anything about this. Where is the Upgrade Cost defined? what file/s?

    Thanks.
     
  5. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,201
    Location:
    DE/NL/FR
    The upgrade cost is a value, which is based on the difference of the production costs of the two units.

    You can change this through a python modification in CvGameUtils, in getUpgradePriceOverride.

    You might want to look at the Leonardo's Workshop wonder from tsentom1, which changes the upgrade cost through a building.
     
  6. JA_Lamb

    JA_Lamb Warlord

    Joined:
    Aug 19, 2009
    Messages:
    231
    Location:
    The changing Dark Continent
    Thank you I'll folow your recommendation if I can.
     
  7. darth degox

    darth degox Chieftain

    Joined:
    Sep 18, 2009
    Messages:
    22
    when you say use notepad(i have a mac) could i use text edit?
     
  8. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,201
    Location:
    DE/NL/FR
    You can use whatever is able to edit a simple textfile.
    You could even use the writing program from open office.

    And welcome to CFC :).
     
  9. stgchuckles13

    stgchuckles13 Chieftain

    Joined:
    Aug 30, 2008
    Messages:
    15
    I followed this guide and try loading up my mod. I get an error:

    "Tag: UNIT_JAPANESE_HORSE_ARCHER in Info Class was in correct
    Current XML file is: Civilizations/CIV4civilizationInfos.xml"

    What does this mean? and how do I fix this. My UU shows up in the Civilopedia with info and everything, but it doesn't replace the basic horse archer for the Japanese.

    IF u need me to show you the code(s), let me know and thanks for your time.
     
  10. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,201
    Location:
    DE/NL/FR
    There's probably a typo somewhere in your definition of your UU.
    Check again, if it's written correctly, and then check, if you named the unit the same way in the unitInfos.xml.

    And take a look, if there's maybe a _ to much somewhere.
     
  11. stgchuckles13

    stgchuckles13 Chieftain

    Joined:
    Aug 30, 2008
    Messages:
    15
    Thank you, it was a misspelling LOLOL.
     
  12. eeveebreeder

    eeveebreeder Chieftain

    Joined:
    Jul 8, 2009
    Messages:
    19
    hey i ahve a question... im trying to make a uu, but an error keeps showing up


    <UnitInfo>
    <Class>UNITCLASS_HORSE_ARCHER</Class>
    <Type>UNIT_COMPANION_CALVARY</Type>
    <UniqueNames/>
    <Special>NONE</Special>
    <Capture>NONE</Capture>
    <Combat>UNITCOMBAT_MOUNTED</Combat>
    <Domain>DOMAIN_LAND</Domain>
    <DefaultUnitAI>UNITAI_ATTACK</DefaultUnitAI>
    <Invisible>NONE</Invisible>
    <SeeInvisible>NONE</SeeInvisible>
    <Description>TXT_KEY_UNIT_COMPANION_CALVARY</Description>
    <Civilopedia>TXT_KEY_UNIT_COMPANION_CALVARY_PEDIA</Civilopedia>
    <Strategy>TXT_KEY_UNIT_COMPANION_CALVARY_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_KNIGHT</UnitClassUpgradeType>
    <bUnitClassUpgrade>1</bUnitClassUpgrade>
    </UnitClassUpgrade>
    </UnitClassUpgrades>
    <UnitAIs>
    <UnitAI>
    <UnitAIType>UNITAI_ATTACK</UnitAIType>
    <bUnitAI>1</bUnitAI>
    </UnitAI>
    <UnitAI>
    <UnitAIType>UNITAI_PILLAGE</UnitAIType>
    <bUnitAI>1</bUnitAI>
    </UnitAI>
    </UnitAIs>
    <NotUnitAIs>
    <UnitAI>
    <UnitAIType>UNITAI_CITY_COUNTER</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>TECH_THE_WHEEL</PrereqTech>
    <TechTypes/>
    <BonusType>BONUS_HORSE</BonusType>
    <PrereqBonuses/>
    <ProductionTraits/>
    <Flavors/>
    <iAIWeight>0</iAIWeight>
    <iCost>25</iCost>
    <iHurryCostModifier>0</iHurryCostModifier>
    <iMinAreaSize>-1</iMinAreaSize>
    <iMoves>2</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>4</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>30</iWithdrawalProb>
    <iCollateralDamage>0</iCollateralDamage>
    <iCollateralDamageLimit>0</iCollateralDamageLimit>
    <iCollateralDamageMaxUnits>0</iCollateralDamageMaxUnits>
    <iCityAttack>0</iCityAttack>
    <iCityDefense>0</iCityDefense>
    <iAnimalCombat>0</iAnimalCombat>
    <iHillsDefense>0</iHillsDefense>
    <TerrainNatives/>
    <FeatureNatives/>
    <TerrainDefenses/>
    <FeatureDefenses/>
    <UnitClassAttackMods/>
    <UnitClassDefenseMods/>
    <UnitCombatMods>
    <UnitCombatMod>
    <UnitCombatType>UNITCOMBAT_ARCHER</UnitCombatType>
    <iUnitCombatMod>50</iUnitCombatMod>
    </UnitCombatMod>
    </UnitCombatMods>
    <DomainMods/>
    <BonusProductionModifiers/>
    <iBombRate>0</iBombRate>
    <iBombardRate>0</iBombardRate>
    <SpecialCargo>NONE</SpecialCargo>
    <DomainCargo>NONE</DomainCargo>
    <iCargo>0</iCargo>
    <iConscription>0</iConscription>
    <iCultureGarrison>4</iCultureGarrison>
    <iExtraCost>0</iExtraCost>
    <iAsset>1</iAsset>
    <iPower>3</iPower>
    <UnitMeshGroups>
    <iGroupSize>3</iGroupSize>
    <fMaxSpeed>1.75</fMaxSpeed>
    <iMeleeWaveSize>3</iMeleeWaveSize>
    <iRangedWaveSize>0</iRangedWaveSize>
    <UnitMeshGroup>
    <iRequired>3</iRequired>
    <EarlyArtDefineTag>ART_DEF_UNIT_PERSIA_IMMORTAL</EarlyArtDefineTag>
    </UnitMeshGroup>
    </UnitMeshGroups>
    <Button>,Art/Interface/Buttons/Units/Companion.dds,Art>
    <HotKey/>
    <bAltDown>0</bAltDown>
    <bShiftDown>0</bShiftDown>
    <bCtrlDown>0</bCtrlDown>
    <iHotKeyPriority>0</iHotKeyPriority>
    <FreePromotions/>
    </UnitInfo>
     
  13. phungus420

    phungus420 Deity

    Joined:
    Mar 1, 2003
    Messages:
    6,296
    What are you trying to do, and What's the error you're getting?

    Also when you post code put it inside [code][/code] tags, as it makes it easier to read.
     
  14. Ysharma

    Ysharma Chieftain

    Joined:
    Dec 21, 2009
    Messages:
    28
    i come up with a lot of xml errors and all my units are disabled
     
  15. The_J

    The_J Say No 2 Net Validations Retired Moderator Supporter

    Joined:
    Oct 22, 2008
    Messages:
    31,201
    Location:
    DE/NL/FR
    What error exactly?

    I guess, you've forgot to copy something (delete your new unit, do it again), or you've used a XML from the wrong civ version (you have to use the UnitInfos.xml and the other ones from BtS).
     
  16. Vortilex

    Vortilex Imperator Mundi

    Joined:
    Oct 6, 2007
    Messages:
    1,457
    Location:
    St. Augustine, FL
    Spoiler :


    Could you put that code in CODE or SPOILER tags?
     
  17. Ysharma

    Ysharma Chieftain

    Joined:
    Dec 21, 2009
    Messages:
    28
    problem fixed but the guide is not working for me
     
  18. phungus420

    phungus420 Deity

    Joined:
    Mar 1, 2003
    Messages:
    6,296
    This tutorial is one of the best I have found.

    As The_J says, you should tell us what error messages you are getting, and you'll probably receive some help.
     
  19. Ysharma

    Ysharma Chieftain

    Joined:
    Dec 21, 2009
    Messages:
    28
    i fixed the errors i am trying this one last time
     
  20. Ysharma

    Ysharma Chieftain

    Joined:
    Dec 21, 2009
    Messages:
    28
    i did everything but when i go to its civilopedia entry it only shows a box with a PICTURE OF THE BUTTON
    at least it started and shows it in the civilopedia
     

Share This Page