Quick Modding Questions Thread

Yeah, sorry. I have apparently misremembered this aspect.
 
I have recently stumbled across a weird Civilopedia issue. Suddenly, my Pedia shows no World Wonders in the appropriate section. All the other sections work just fine. (In the RAND mod I use, there are more Pedia sections than vanilla Civ.) The odd thing is that I haven't touched any of the Python files related to Civilopedia screens, just done some XML add-ons, and everything's been working fine - until now. Any idea what might be the cause of this?
 
Never mind; the issue seems to have been caused by some weird bugging in building replacements, and has auto-magically resolved itself.
 
Is the KFM layout fixed or can I play around and do stuff like add more than 3 attack animations etc?
 
I think that should be possible, never tried myself though. First you will have to access the code of the kfm file, I normally use Esemjay's KFM Converter for that. Then you need to add the new kf files. I think for another attack animation, you will need to add the animations for "die", "die_fade", "fortify", "hurt" and "strike".

When you look into the xml file you decode from the kfm, you will see that for example the strike animtions are in this format:
Code:
       <Animation>
           <Event>1022</Event>
           <Variation>0</Variation>
           <File>Axeman_MD_StrikeA.kf</File>
       </Animation>
       <Animation>
           <Event>2022</Event>
           <Variation>0</Variation>
           <File>Axeman_MD_StrikeB.kf</File>
       </Animation>
       <Animation>
           <Event>3022</Event>
           <Variation>0</Variation>
           <File>Axeman_MD_StrikeC.kf</File>
       </Animation>
So I guess the new strike animation entry should look like this:
Code:
       <Animation>
           <Event>4022</Event>
           <Variation>0</Variation>
           <File>Axeman_MD_StrikeD.kf</File>
       </Animation>
As far as I understand it the first number in the <Event> tag is for the variation, while the other three numbers are the BaseID of the animation defined in the Civ4AnimationInfos.xml.

For reference for adding a new animation type, you could have a look at some of the units I modified the animations for, for example Rifleman with Melee Combat Animations or Medic Promotion Visualization.
 
I am trying to include the NIF for the "South American city centre" from this building pack, however the I always get a Python error when trying to look at it in civilopedia. I double checked the paths in my art defines multiple times, everything seems to be fine. Is there anything wrong with the NIF? What am I missing?

(The button from the art defines works fine, so it's not an XML error.)
 
I am trying to include the NIF for the "South American city centre" from this building pack, however the I always get a Python error when trying to look at it in civilopedia. I double checked the paths in my art defines multiple times, everything seems to be fine. Is there anything wrong with the NIF? What am I missing?

(The button from the art defines works fine, so it's not an XML error.)
To be honest, I don't know what the problem is. I received the error as well.

However, I imported and exported the NIF through Blender (exported as 20.0.0.4) and now it works. :)

Please tell me if this works for you. It works on my end.

If you need the flags, I can do that as well. If you have Blender, you could do it too.
 

Attachments

  • SAPalace.zip
    99 KB · Views: 108
Great, that was answered a lot faster than I expected. Thank you for taking the time to look into it and fix it for me. I actually prefer the version without flags, trying it now.

Edit: it works, thanks again!
 
Great, that was answered a lot faster than I expected. Thank you for taking the time to look into it and fix it for me. I actually prefer the version without flags, trying it now.

Edit: it works, thanks again!
No problem. The Import/Export Blender trick works again. :)
 
Can someone tell me what the bMonument tag in BuildingClassInfos is used for? The modiki claims it's unused, is that true?
 
Can someone tell me what the bMonument tag in BuildingClassInfos is used for? The modiki claims it's unused, is that true?
I think so.
bMonument is a left-over tag from some idea Firaxis never finished. It's value has no effect on the game, so just leave it alone.
 
Interesting, thanks. I found some XML entries that used it (not necessarily from vanilla BtS), so I wondered if the wiki was wrong. Looks like copy/paste is the culprit here.
 
I think that should be possible, never tried myself though. First you will have to access the code of the kfm file, I normally use Esemjay's KFM Converter for that. Then you need to add the new kf files. I think for another attack animation, you will need to add the animations for "die", "die_fade", "fortify", "hurt" and "strike".

When you look into the xml file you decode from the kfm, you will see that for example the strike animtions are in this format:
Code:
       <Animation>
           <Event>1022</Event>
           <Variation>0</Variation>
           <File>Axeman_MD_StrikeA.kf</File>
       </Animation>
       <Animation>
           <Event>2022</Event>
           <Variation>0</Variation>
           <File>Axeman_MD_StrikeB.kf</File>
       </Animation>
       <Animation>
           <Event>3022</Event>
           <Variation>0</Variation>
           <File>Axeman_MD_StrikeC.kf</File>
       </Animation>
So I guess the new strike animation entry should look like this:
Code:
       <Animation>
           <Event>4022</Event>
           <Variation>0</Variation>
           <File>Axeman_MD_StrikeD.kf</File>
       </Animation>
As far as I understand it the first number in the <Event> tag is for the variation, while the other three numbers are the BaseID of the animation defined in the Civ4AnimationInfos.xml.

For reference for adding a new animation type, you could have a look at some of the units I modified the animations for, for example Rifleman with Melee Combat Animations or Medic Promotion Visualization.
I did the testing. Apparently you can only have up to 3 unit animations per attack type. But there are two attack types (melee and ranged). Have not done any testing for ranged attacks though on account of the fact ranged combat really does not need animations beyond the one.
 
I did the testing. Apparently you can only have up to 3 unit animations per attack type. But there are two attack types (melee and ranged). Have not done any testing for ranged attacks though on account of the fact ranged combat really does not need animations beyond the one.
That's unfortunate. I thought that the game would be more flexible with the possible number of attack animations, since there are units with only two melee animations and also since other aspects, like unit sounds, seem not to be limited in numbers.
 
Hi, quick question

I'm trying to mod in a new improvement, and a new worker to build it. The worker works fine, and the improvement shows up in the pedia, but when I add the improvement to the list of builds for the worker a message comes up when loading the mod (attached).



The mod is literally just a farm with +1 food output (named Kfarm).

UnitInfos excerpt:
Code:
<FlankingStrikes/>
            <UnitAIs>
                <UnitAI>
                    <UnitAIType>UNITAI_WORKER</UnitAIType>
                    <bUnitAI>1</bUnitAI>
                </UnitAI>
            </UnitAIs>
            <NotUnitAIs/>
            <Builds>
                <Build>
                    <BuildType>BUILD_ROAD</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_RAILROAD</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_FARM</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_KFARM</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_MINE</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_WORKSHOP</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_LUMBERMILL</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_WINDMILL</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_WATERMILL</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_PLANTATION</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_QUARRY</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_PASTURE</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_CAMP</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_WELL</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_WINERY</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_COTTAGE</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_FORT</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_REMOVE_JUNGLE</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_REMOVE_FOREST</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_SCRUB_FALLOUT</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_FOREST_PRESERVE</BuildType>
                    <bBuild>1</bBuild>
                </Build>
            </Builds>
            <ReligionSpreads/>
            <CorporationSpreads/>

ImprovementInfos code

Code:
<ImprovementInfo>
            <Type>IMPROVEMENT_KFARM</Type>
            <Description>Kamma Farm</Description>
            <Civilopedia>TXT_KEY_IMPROVEMENT_FARM_PEDIA</Civilopedia>
            <ArtDefineTag>ART_DEF_IMPROVEMENT_FARM</ArtDefineTag>
            <PrereqNatureYields>
                <iYield>1</iYield>
                <iYield>0</iYield>
                <iYield>0</iYield>
            </PrereqNatureYields>
            <IrrigatedYieldChange>
                <iYield>2</iYield>
                <iYield>0</iYield>
                <iYield>0</iYield>
            </IrrigatedYieldChange>
            <bActsAsCity>0</bActsAsCity>
            <bHillsMakesValid>0</bHillsMakesValid>
            <bFreshWaterMakesValid>1</bFreshWaterMakesValid>
            <bRiverSideMakesValid>0</bRiverSideMakesValid>
            <bNoFreshWater>0</bNoFreshWater>
            <bRequiresFlatlands>1</bRequiresFlatlands>
            <bRequiresRiverSide>0</bRequiresRiverSide>
            <bRequiresIrrigation>1</bRequiresIrrigation>
            <bCarriesIrrigation>1</bCarriesIrrigation>
            <bRequiresFeature>0</bRequiresFeature>
            <bWater>0</bWater>
            <bGoody>0</bGoody>
            <bPermanent>0</bPermanent>
            <bUseLSystem>1</bUseLSystem>
            <iAdvancedStartCost>30</iAdvancedStartCost>
            <iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
            <iTilesPerGoody>0</iTilesPerGoody>
            <iGoodyRange>0</iGoodyRange>
            <iFeatureGrowth>0</iFeatureGrowth>
            <iUpgradeTime>0</iUpgradeTime>
            <iAirBombDefense>5</iAirBombDefense>
            <iDefenseModifier>0</iDefenseModifier>
            <iHappiness>0</iHappiness>
            <iPillageGold>5</iPillageGold>
            <bOutsideBorders>0</bOutsideBorders>
            <TerrainMakesValids>
                <TerrainMakesValid>
                    <TerrainType>TERRAIN_GRASS</TerrainType>
                    <bMakesValid>1</bMakesValid>
                </TerrainMakesValid>
                <TerrainMakesValid>
                    <TerrainType>TERRAIN_PLAINS</TerrainType>
                    <bMakesValid>1</bMakesValid>
                </TerrainMakesValid>
            </TerrainMakesValids>
            <FeatureMakesValids/>
            <BonusTypeStructs>
                <BonusTypeStruct>
                    <BonusType>BONUS_CORN</BonusType>
                    <bBonusMakesValid>1</bBonusMakesValid>
                    <bBonusTrade>1</bBonusTrade>
                    <iDiscoverRand>0</iDiscoverRand>
                    <YieldChanges>
                        <iYieldChange>2</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                    </YieldChanges>
                </BonusTypeStruct>
                <BonusTypeStruct>
                    <BonusType>BONUS_RICE</BonusType>
                    <bBonusMakesValid>1</bBonusMakesValid>
                    <bBonusTrade>1</bBonusTrade>
                    <iDiscoverRand>0</iDiscoverRand>
                    <YieldChanges>
                        <iYieldChange>1</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                    </YieldChanges>
                </BonusTypeStruct>
                <BonusTypeStruct>
                    <BonusType>BONUS_WHEAT</BonusType>
                    <bBonusMakesValid>1</bBonusMakesValid>
                    <bBonusTrade>1</bBonusTrade>
                    <iDiscoverRand>0</iDiscoverRand>
                    <YieldChanges>
                        <iYieldChange>2</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                    </YieldChanges>
                </BonusTypeStruct>
            </BonusTypeStructs>
            <ImprovementPillage/>
            <ImprovementUpgrade/>
            <TechYieldChanges>
                <TechYieldChange>
                    <PrereqTech>TECH_BIOLOGY</PrereqTech>
                    <TechYields>
                        <iYield>1</iYield>
                        <iYield>0</iYield>
                        <iYield>0</iYield>
                    </TechYields>
                </TechYieldChange>
            </TechYieldChanges>
            <RouteYieldChanges/>
            <bGraphicalOnly>0</bGraphicalOnly>
        </ImprovementInfo>
 
Hi, quick question

I'm trying to mod in a new improvement, and a new worker to build it. The worker works fine, and the improvement shows up in the pedia, but when I add the improvement to the list of builds for the worker a message comes up when loading the mod (attached).



The mod is literally just a farm with +1 food output (named Kfarm).

UnitInfos excerpt:
Code:
<FlankingStrikes/>
            <UnitAIs>
                <UnitAI>
                    <UnitAIType>UNITAI_WORKER</UnitAIType>
                    <bUnitAI>1</bUnitAI>
                </UnitAI>
            </UnitAIs>
            <NotUnitAIs/>
            <Builds>
                <Build>
                    <BuildType>BUILD_ROAD</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_RAILROAD</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_FARM</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_KFARM</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_MINE</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_WORKSHOP</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_LUMBERMILL</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_WINDMILL</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_WATERMILL</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_PLANTATION</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_QUARRY</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_PASTURE</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_CAMP</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_WELL</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_WINERY</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_COTTAGE</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_FORT</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_REMOVE_JUNGLE</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_REMOVE_FOREST</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_SCRUB_FALLOUT</BuildType>
                    <bBuild>1</bBuild>
                </Build>
                <Build>
                    <BuildType>BUILD_FOREST_PRESERVE</BuildType>
                    <bBuild>1</bBuild>
                </Build>
            </Builds>
            <ReligionSpreads/>
            <CorporationSpreads/>

ImprovementInfos code

Code:
<ImprovementInfo>
            <Type>IMPROVEMENT_KFARM</Type>
            <Description>Kamma Farm</Description>
            <Civilopedia>TXT_KEY_IMPROVEMENT_FARM_PEDIA</Civilopedia>
            <ArtDefineTag>ART_DEF_IMPROVEMENT_FARM</ArtDefineTag>
            <PrereqNatureYields>
                <iYield>1</iYield>
                <iYield>0</iYield>
                <iYield>0</iYield>
            </PrereqNatureYields>
            <IrrigatedYieldChange>
                <iYield>2</iYield>
                <iYield>0</iYield>
                <iYield>0</iYield>
            </IrrigatedYieldChange>
            <bActsAsCity>0</bActsAsCity>
            <bHillsMakesValid>0</bHillsMakesValid>
            <bFreshWaterMakesValid>1</bFreshWaterMakesValid>
            <bRiverSideMakesValid>0</bRiverSideMakesValid>
            <bNoFreshWater>0</bNoFreshWater>
            <bRequiresFlatlands>1</bRequiresFlatlands>
            <bRequiresRiverSide>0</bRequiresRiverSide>
            <bRequiresIrrigation>1</bRequiresIrrigation>
            <bCarriesIrrigation>1</bCarriesIrrigation>
            <bRequiresFeature>0</bRequiresFeature>
            <bWater>0</bWater>
            <bGoody>0</bGoody>
            <bPermanent>0</bPermanent>
            <bUseLSystem>1</bUseLSystem>
            <iAdvancedStartCost>30</iAdvancedStartCost>
            <iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
            <iTilesPerGoody>0</iTilesPerGoody>
            <iGoodyRange>0</iGoodyRange>
            <iFeatureGrowth>0</iFeatureGrowth>
            <iUpgradeTime>0</iUpgradeTime>
            <iAirBombDefense>5</iAirBombDefense>
            <iDefenseModifier>0</iDefenseModifier>
            <iHappiness>0</iHappiness>
            <iPillageGold>5</iPillageGold>
            <bOutsideBorders>0</bOutsideBorders>
            <TerrainMakesValids>
                <TerrainMakesValid>
                    <TerrainType>TERRAIN_GRASS</TerrainType>
                    <bMakesValid>1</bMakesValid>
                </TerrainMakesValid>
                <TerrainMakesValid>
                    <TerrainType>TERRAIN_PLAINS</TerrainType>
                    <bMakesValid>1</bMakesValid>
                </TerrainMakesValid>
            </TerrainMakesValids>
            <FeatureMakesValids/>
            <BonusTypeStructs>
                <BonusTypeStruct>
                    <BonusType>BONUS_CORN</BonusType>
                    <bBonusMakesValid>1</bBonusMakesValid>
                    <bBonusTrade>1</bBonusTrade>
                    <iDiscoverRand>0</iDiscoverRand>
                    <YieldChanges>
                        <iYieldChange>2</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                    </YieldChanges>
                </BonusTypeStruct>
                <BonusTypeStruct>
                    <BonusType>BONUS_RICE</BonusType>
                    <bBonusMakesValid>1</bBonusMakesValid>
                    <bBonusTrade>1</bBonusTrade>
                    <iDiscoverRand>0</iDiscoverRand>
                    <YieldChanges>
                        <iYieldChange>1</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                    </YieldChanges>
                </BonusTypeStruct>
                <BonusTypeStruct>
                    <BonusType>BONUS_WHEAT</BonusType>
                    <bBonusMakesValid>1</bBonusMakesValid>
                    <bBonusTrade>1</bBonusTrade>
                    <iDiscoverRand>0</iDiscoverRand>
                    <YieldChanges>
                        <iYieldChange>2</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                        <iYieldChange>0</iYieldChange>
                    </YieldChanges>
                </BonusTypeStruct>
            </BonusTypeStructs>
            <ImprovementPillage/>
            <ImprovementUpgrade/>
            <TechYieldChanges>
                <TechYieldChange>
                    <PrereqTech>TECH_BIOLOGY</PrereqTech>
                    <TechYields>
                        <iYield>1</iYield>
                        <iYield>0</iYield>
                        <iYield>0</iYield>
                    </TechYields>
                </TechYieldChange>
            </TechYieldChanges>
            <RouteYieldChanges/>
            <bGraphicalOnly>0</bGraphicalOnly>
        </ImprovementInfo>
Units don't reference improvements directly - you need to add a new build in your Civ4BuildInfos under the Units folder that corresponds to your improvement.
 
Another quick question, is it possible to give units multiple combat types in the XML?

Say, for example I wanted to make Horse Archers both mounted and archery units, so anything with bonuses against either would affect them?
 
Unfortunately not, the only way to make that happen is a new "mounted archer" combat type and you would have to give the associated modifiers to all units and promotions etc. as well.
 
Top Bottom