Adding bombardment capability to units...?

Lord Haldane

Chieftain
Joined
Mar 23, 2009
Messages
24
Location
Dublin
I would like to add bombardment of city defences as a Treant ability, having seen this already implemented for Hill Giants, but I am afraid that my experience with Civ4 modding extends beyond little more than tweaking game speed modifiers. I suspect that my wish could be accomplished by a bit of tinkering in the xml, though I haven't the slightest idea as to where I might even find the appropriate file! Could any of you fellows kindly explain what I would need to do?

Any assistance would be greatly appreciated!
 
C:\Program Files\Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword\Mods\Fall from Heaven 2\Assets\XML\Units\CIV4UnitInfos.xml

This is my version of the Treant's defines. In addition to letting them bombard city defenses, I also decided to give them UNITCOMBAT_SIEGE so they can get promotions to make them better as siege, and also giving them the abilities of FoL priests.
Code:
        <UnitInfo>
            <Class>UNITCLASS_TREANT</Class>
            <Type>UNIT_TREANT</Type>
            <UniqueNames>
            </UniqueNames>
            <Special>NONE</Special>
            <Capture>NONE</Capture>[B]
            <Combat>UNITCOMBAT_SIEGE</Combat>[/B]
            <Domain>DOMAIN_LAND</Domain>
            <DefaultUnitAI>UNITAI_ATTACK</DefaultUnitAI>
            <Invisible>NONE</Invisible>
            <SeeInvisible>NONE</SeeInvisible>
            <Description>TXT_KEY_UNIT_TREANT</Description>
            <Civilopedia>TXT_KEY_UNIT_TREANT_PEDIA</Civilopedia>
            <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>0</bMilitarySupport>
            <bMilitaryProduction>1</bMilitaryProduction>
            <bPillage>0</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>
            </UnitClassUpgrades>
            <UnitClassTargets>
            </UnitClassTargets>
            <UnitCombatTargets>
            </UnitCombatTargets>
            <UnitClassDefenders>
            </UnitClassDefenders>
            <UnitCombatDefenders>
            </UnitCombatDefenders>
            <FlankingStrikes>
            </FlankingStrikes>
            <UnitAIs>
                <UnitAI>
                    <UnitAIType>UNITAI_ATTACK</UnitAIType>
                    <bUnitAI>1</bUnitAI>
                </UnitAI>
                <UnitAI>
                    <UnitAIType>UNITAI_ATTACK_CITY</UnitAIType>
                    <bUnitAI>1</bUnitAI>
                </UnitAI>
                <UnitAI>
                    <UnitAIType>UNITAI_COUNTER</UnitAIType>
                    <bUnitAI>1</bUnitAI>
                </UnitAI>
                <UnitAI>
                    <UnitAIType>UNITAI_CITY_COUNTER</UnitAIType>
                    <bUnitAI>1</bUnitAI>
                </UnitAI>
            </UnitAIs>
            <NotUnitAIs>
            </NotUnitAIs>
            <Builds>
            </Builds>
            <ReligionSpreads>
            </ReligionSpreads>
            <CorporationSpreads>
            </CorporationSpreads>
            <GreatPeoples>
            </GreatPeoples>
            <Buildings>
            </Buildings>
            <ForceBuildings>
            </ForceBuildings>
            <HolyCity>NONE</HolyCity>[B]
            <ReligionType>RELIGION_FELLOWSHIP_OF_LEAVES</ReligionType>[/B]
            <StateReligion>NONE</StateReligion>
            <PrereqReligion>NONE</PrereqReligion>
            <PrereqCorporation>NONE</PrereqCorporation>
            <PrereqBuilding>NONE</PrereqBuilding>
            <PrereqTech>NONE</PrereqTech>
            <TechTypes>
            </TechTypes>
            <BonusType>NONE</BonusType>
            <PrereqBonuses>
            </PrereqBonuses>
            <ProductionTraits>
            </ProductionTraits>
            <Flavors>
            </Flavors>
            <iAIWeight>0</iAIWeight>
            <iCost>-1</iCost>
            <iHurryCostModifier>0</iHurryCostModifier>
            <iAdvancedStartCost>-1</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>
            </TerrainImpassables>
            <FeatureImpassables>
            </FeatureImpassables>
            <TerrainPassableTechs>
            </TerrainPassableTechs>
            <FeaturePassableTechs>
            </FeaturePassableTechs>
            <iCombat>10</iCombat>
            <iCombatLimit>100</iCombatLimit>
            <iAirCombat>0</iAirCombat>
            <iAirCombatLimit>0</iAirCombatLimit>
            <iXPValueAttack>8</iXPValueAttack>
            <iXPValueDefense>4</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>
            </TerrainNatives>
            <FeatureNatives>
            </FeatureNatives>
            <TerrainAttacks>
            </TerrainAttacks>
            <TerrainDefenses>
            </TerrainDefenses>
            <FeatureAttacks>
            </FeatureAttacks>
            <FeatureDefenses>
            </FeatureDefenses>
            <UnitClassAttackMods>
            </UnitClassAttackMods>
            <UnitClassDefenseMods>
            </UnitClassDefenseMods>
            <UnitCombatMods>
            </UnitCombatMods>
            <UnitCombatCollateralImmunes>
            </UnitCombatCollateralImmunes>
            <DomainMods>
            </DomainMods>
            <BonusProductionModifiers>
            </BonusProductionModifiers>
            <iBombRate>0</iBombRate>[B][U]
            <iBombardRate>15</iBombardRate>[/U][/B]
            <SpecialCargo>NONE</SpecialCargo>
            <DomainCargo>NONE</DomainCargo>
            <iCargo>0</iCargo>
            <iConscription>3</iConscription>
            <iCultureGarrison>6</iCultureGarrison>
            <iExtraCost>0</iExtraCost>
            <iAsset>20</iAsset>
            <iPower>40</iPower>
            <UnitMeshGroups>
            <iGroupSize>1</iGroupSize>
            <fMaxSpeed>1.75</fMaxSpeed>
            <fPadTime>1</fPadTime>
            <iMeleeWaveSize>1</iMeleeWaveSize>
            <iRangedWaveSize>0</iRangedWaveSize>
                <UnitMeshGroup>
                    <iRequired>1</iRequired>
                    <EarlyArtDefineTag>ART_DEF_UNIT_TREANT</EarlyArtDefineTag>
                </UnitMeshGroup>
            </UnitMeshGroups>
            <FormationType>FORMATION_TYPE_DEFAULT</FormationType>
            <HotKey></HotKey>
            <bAltDown>0</bAltDown>
            <bShiftDown>0</bShiftDown>
            <bCtrlDown>0</bCtrlDown>
            <bGraphicalOnly>0</bGraphicalOnly>
            <iHotKeyPriority>0</iHotKeyPriority>
            <FreePromotions>
                <FreePromotion>
                    <PromotionType>PROMOTION_WOODSMAN1</PromotionType>
                    <bFreePromotion>1</bFreePromotion>
                </FreePromotion>
                <FreePromotion>
                    <PromotionType>PROMOTION_WOODSMAN2</PromotionType>
                    <bFreePromotion>1</bFreePromotion>
                </FreePromotion>
                <FreePromotion>
                    <PromotionType>PROMOTION_ELEMENTAL</PromotionType>
                    <bFreePromotion>1</bFreePromotion>
                </FreePromotion>
                <FreePromotion>
                    <PromotionType>PROMOTION_VULNERABLE_TO_FIRE</PromotionType>
                    <bFreePromotion>1</bFreePromotion>
                </FreePromotion>
                
                
                [B]<FreePromotion>
                    <PromotionType>PROMOTION_DIVINE</PromotionType>
                    <bFreePromotion>1</bFreePromotion>
                </FreePromotion>
                <FreePromotion>
                    <PromotionType>PROMOTION_CHANNELING2</PromotionType>
                    <bFreePromotion>1</bFreePromotion>
                </FreePromotion>[/B]
            </FreePromotions>
            <LeaderPromotion>NONE</LeaderPromotion>
            <iLeaderExperience>0</iLeaderExperience>
            <iCombatDefense>10</iCombatDefense>
            <iTier>4</iTier>
            <PythonPostCombatLost>postCombatTreant(pCaster,pOpponent)</PythonPostCombatLost>
        </UnitInfo>
My changes are in bold, but you probably only want the underlined part.
 
Many thanks to you, Treants can now properly unleash their terrible fury upon the enemies of the Elves! :D

(I also adopted your other changes, as they seem reasonable enough, and certainly these creatures would prove the most knowledgeable regarding matters of 'Bloom'-type stewarding.)

Again, thanks!
 
How difficult would it be to make them buildable? Would you just change the civinfo xml, assign them a cost other than -1, and give them a prerequisite? I was thinking Commune With Nature as the tech, grove as the building, FOL religion required, and slide them in as a catapult replacement for elves. What would be a fair cost for them? 200?
 
There is no reason to touch CIV4CivilizationInfos.xml unless you want them to be unavalible to certain civs, either entirely of by being replaced by some UU. Kael doesn't bother to block certain civs from building unbuildable units, so CIV4UnitInfos.xml is the only file you's have to change.


Giving them a non-negative cost is the only thing needed to make them buildable, but unless you add more prereqs then everyone could build them from turn 1.


200 seems to be a fairly reasonable cost. It is a little more then an Arquebus, Longbow, Champion, or Cannon, but less than a Crossbow, Druid, Paladin, Eidolon, or Phalanx.


The code I gave already would require FoL in the city that builds them, but you'd probably want them to require FoL state religion too. For that, just add <StateReligion>RELIGION_FELLOWSHIP_OF_LEAVES</StateReligion> right below <ReligionType>RELIGION_FELLOWSHIP_OF_LEAVES</ReligionType>


You could also make them have Guardian of Nature as a prereq instead/too if you like.

They seem to me like the kind of unit that would not keep serving elves who no longer revere nature. You may want to love them <bAbandon>1, which would make them leave you if you switch to a different religion/civic than the one that is needed to build them..




I'd probably make them national units if I were to make them buildable, but you don't have to. If that's the way you want it you'll have to edit CIV4UnitClassInfos.xml, to change the unitclass's <iMaxPlayerInstances> to 4 or however many you want to be the maximum.


When you say to make them a Catapult replacement, you don't actually mean to make them be Elven UUs of that unitclass, right? I think having a unit in multiple unitclasses, while possible, can cause some complications. You could of course get rid of UNITCLASS_TREANT if you really want to. I don't see any real reason to touch it though.
 
Top Bottom