Quick Modding Questions Thread

Yeah, all the leaderheads have the same problem, no idle animations in game, but all other anims.
Unfortunately, your suggestion of using the unmodded FF defines_leaderhead xml didn't work, the same issue persisted. Changing the <kfm> line didn't do anything either.
To be extra certain I reinstalled the mod into a clean folder and tried it again, but the idle error still persisted, I used the installer executable as those tend to be idiot proof, but still no dice.

The really weird thing about this problem is that I just noticed it only happens while you are in the in-game diplomatic screen, it doesn't happen anywhere else, idle animations for the leaderheads play in the civilopedia and even in that little pop up you get at the start of a new game that shows your choice of leader, yeah pretty dang weird that it works in the 2 least important places for the leaderheads but it doesn't work in the one place that really matters: in-game.

Is there anywhere else at all that could be affecting this aside from the CIV4ArtDefines_Leaderhead.xml file and the leaderhead art directory?
That is certainly strange and I have not heard anybody else having a similar issue before. I am unfortunately out of ideas what could be done here, pretty sure no other xml file influences the animation.

On the python side, CvDiplomacy.py should be the place if something goes wrong, but I have no experience with that file and do not know if it can in fact influence the animation in any way. From a first glance, I would say something could go wrong in the "performHeadAction" function. Maybe check if that file is present in the python folder of your mod.

Then there is of course always the CvGameCoreDLL.dll file, but to access what is happening there you would need the unencoded source files as far as I know.
 
CvCity::canCreate uses Python callbacks named "canCreate" and "cannotCreate". I don't have the source code on hand for that but you should find this function in EntryPoints/CvGameInterface.py. You have the city and the project ID available there.

This made me curious so I went and chopped up canCreate in CvGameUtils, trying to make the Manhattan Project require Islam. But it doesn't seem to affect anything at all...? Both functions return False normally, and changing that doesn't do anything either...as if they are never called...

So I am confused.
 
It could be the bFreshWaterMakesValid value. It could also be in the Builds file. Just guessing.

bFreshWaterMakesValid is also set in Vanilla game.
Checked Builds file - nothing interesting there:

Code:
       <BuildInfo>
           <Type>BUILD_FARM</Type>
           <Description>TXT_KEY_BUILD_FARM</Description>
           <Help/>
           <PrereqTech>TECH_AGRICULTURE</PrereqTech>
           <iTime>600</iTime>
           <iCost>0</iCost>
           <bKill>0</bKill>
           <ImprovementType>IMPROVEMENT_FARM</ImprovementType>
           <RouteType>NONE</RouteType>
           <EntityEvent>ENTITY_EVENT_IRRIGATE</EntityEvent>
           <FeatureStructs>
               <FeatureStruct>
                   <FeatureType>FEATURE_JUNGLE</FeatureType>
                   <PrereqTech>TECH_IRON_WORKING</PrereqTech>
                   <iTime>400</iTime>
                   <iProduction>10</iProduction>
                   <bRemove>1</bRemove>
               </FeatureStruct>
               <FeatureStruct>
                   <FeatureType>FEATURE_FOREST</FeatureType>
                   <PrereqTech>TECH_WOODWORKING</PrereqTech>
                   <iTime>300</iTime>
                   <iProduction>30</iProduction>
                   <bRemove>1</bRemove>
               </FeatureStruct>
               <FeatureStruct>
                   <FeatureType>FEATURE_SAVANNA</FeatureType>
                   <PrereqTech>TECH_WOODWORKING</PrereqTech>
                   <iTime>200</iTime>
                   <iProduction>15</iProduction>
                   <bRemove>1</bRemove>
               </FeatureStruct>
               <FeatureStruct>
                   <FeatureType>FEATURE_SCRUB</FeatureType>
                   <PrereqTech>TECH_WOODWORKING</PrereqTech>
                   <iTime>100</iTime>
                   <iProduction>5</iProduction>
                   <bRemove>1</bRemove>
               </FeatureStruct>
               <FeatureStruct>
                   <FeatureType>FEATURE_VEGETATION</FeatureType>
                   <PrereqTech>TECH_AGRICULTURE</PrereqTech>
                   <iTime>0</iTime>
                   <iProduction>0</iProduction>
                   <bRemove>1</bRemove>
               </FeatureStruct>
               <FeatureStruct>
                   <FeatureType>FEATURE_SWAMP</FeatureType>
                   <PrereqTech>TECH_MACHINERY</PrereqTech>
                   <iTime>1000</iTime>
                   <iProduction>0</iProduction>
                   <bRemove>1</bRemove>
               </FeatureStruct>
           </FeatureStructs>
           <HotKey>KB_I</HotKey>
           <bAltDown>0</bAltDown>
           <bShiftDown>0</bShiftDown>
           <bCtrlDown>0</bCtrlDown>
           <iHotKeyPriority>2</iHotKeyPriority>
           <Button>,Art/Interface/Buttons/Builds/BuildFarm.dds,Art/Interface/Buttons/Actions_Builds_LeaderHeads_Specialists_Atlas.dds,3,7</Button>
       </BuildInfo>

[\code]


[QUOTE="Zeta Nexus, post: 15716940, member: 254526"]Maybe you set Tundra to have 1:food: ?[/QUOTE]

Well it is already set to 1 food in vanilla game too
 
This made me curious so I went and chopped up canCreate in CvGameUtils, trying to make the Manhattan Project require Islam. But it doesn't seem to affect anything at all...? Both functions return False normally, and changing that doesn't do anything either...as if they are never called...

So I am confused.
In Platy's Gigapack (https://forums.civfanatics.com/threads/platypings-python.450416/) I have found projects that have requirements such as "Can only be built on Medieval or earlier starts". But I had no time yet to investigate it deeply and try to find out how to make it into a religion requirement.
 
bFreshWaterMakesValid is also set in Vanilla game.
Checked Builds file - nothing interesting there:

Maybe you set Tundra to have 1:food: ?

Well it is already set to 1 food in vanilla game too[/code]

So here is a screenshot of me farming four tundra tiles in vanilla BTS Screenshot (1).png

They are all next to rivers, which makes them irrigated and able to farm.

Other tundras not next to rivers are unable to farm, and all I can build is fortsScreenshot (2).png

Is this what is happening in your mod? Are the tundras all next to rivers?

If not, they could be getting irrigated some other way, like how farms spread irrigation. Maybe you changed some other improvement to spread irrigation or something.
 
In Platy's Gigapack (https://forums.civfanatics.com/threads/platypings-python.450416/) I have found projects that have requirements such as "Can only be built on Medieval or earlier starts". But I had no time yet to investigate it deeply and try to find out how to make it into a religion requirement.

Interesting. So I downloaded Gigapack and looked at the CvGameUtils file, and platy put all the requirements (quite a few) in the cannotCreate function. So I decided to mimic that with my Muslim Manhattan Project thing, and nothing happened still. Even when I copied over platy's PythonCallbackDefines.xml file (there's nothing about cannotCreate in there but I thought I'd use it just to be sure)

So I'm going to fiddle with it some more and see if the confusion gets cleared up.

Edit: I'm out of ideas.

Here is the bit that I put in cannotCreate, which is currently not working:
Code:
## Religious Project ##
        if eProject == gc.getInfoTypeForString("MANHATTAN_PROJECT"):
            if not pCity.isHasReligion(gc.getInfoTypeForString("RELIGION_ISLAM")):
                return True
## Religious Project ##

....anyone see any problems with that? I don't...
 
Hi,

Can someone explain what the purpose of GlobalDefinesAlt.xml is?

I'm modding based on FFH and there's some TECH_, PROMOTION_ and SPELL_ in there (just a handful).
The <DefineName> and <DefineTextVal> appear to be identical for those that I've looked at.:confused:
What's the knock on effect of deleting Defines from the GlobalDefinesAlt.xml?
Why would someone include something in GlobalDefinesAlt.xml?

thanks
 
That is certainly strange and I have not heard anybody else having a similar issue before. I am unfortunately out of ideas what could be done here, pretty sure no other xml file influences the animation.

On the python side, CvDiplomacy.py should be the place if something goes wrong, but I have no experience with that file and do not know if it can in fact influence the animation in any way. From a first glance, I would say something could go wrong in the "performHeadAction" function. Maybe check if that file is present in the python folder of your mod.

Then there is of course always the CvGameCoreDLL.dll file, but to access what is happening there you would need the unencoded source files as far as I know.

Looks like I'm out of luck then, there is no CvDiplomacy.py python entrypoint/file is the python folder, not even in the unmodded final frontier folder.

I guess I'll have to see if I can contact the author of FFP, or even see if there is a github for the mod that contains the source code as you mentioned.
 
So here is a screenshot of me farming four tundra tiles in vanilla BTS View attachment 550411

They are all next to rivers, which makes them irrigated and able to farm.

Other tundras not next to rivers are unable to farm, and all I can build is fortsView attachment 550412

Is this what is happening in your mod? Are the tundras all next to rivers?

If not, they could be getting irrigated some other way, like how farms spread irrigation. Maybe you changed some other improvement to spread irrigation or something.

Oh, I am an idiot! I had no idea/forgot that it was always possible to build Tundra farms, and of course irrigation is spread once you get the proper tech.
I was sure it was something I did, that caused Tundra to allow farms and was looking for a way to fix it :lol::lol::lol:

This however brings up an issue of the purpose of the lines like Grassland makes valid, and Plains makes valid.
Logically, I would love to actually disable farms for Tundras, as I have a different improvement which I made Specifically for Tundras... :cry::cry::cry:
 
Hi,

Can someone explain what the purpose of GlobalDefinesAlt.xml is?

I'm modding based on FFH and there's some TECH_, PROMOTION_ and SPELL_ in there (just a handful).
The <DefineName> and <DefineTextVal> appear to be identical for those that I've looked at.:confused:
What's the knock on effect of deleting Defines from the GlobalDefinesAlt.xml?
Why would someone include something in GlobalDefinesAlt.xml?

thanks
The plan was that modders would never change GlobalDefines.XML. Any changes and additions they made would go in GlobalDefinesAlt.XML. That way you could easily see what the differences were in the mod from the default game.

Values in the Alt file overwrite the values (for the same tag name) set in the normal file.
 
Values in the Alt file overwrite the values (for the same tag name) set in the normal file.

Why would you need to add something in this file where the two entries are the same, i.e. overwriting with itself?
Trying to remove one of the entries, where both values were the same resulted in an error message with a load of symbols in it on loading. When does a modder need to add something to this file and why does deleting an entry result in such an error?
 
Why would you need to add something in this file where the two entries are the same, i.e. overwriting with itself?
Trying to remove one of the entries, where both values were the same resulted in an error message with a load of symbols in it on loading. When does a modder need to add something to this file and why does deleting an entry result in such an error?
"One of the entries". Are you removing from Alt or the normal file? As the base game demonstrates, the game is supposed to still work when the Alt file is empty. There is no need to override existing defines with the same value in the Alt file. If you see different behaviour, that may be due to some idiosyncracies of FFH.
 
This however brings up an issue of the purpose of the lines like Grassland makes valid, and Plains makes valid.
Logically, I would love to actually disable farms for Tundras, as I have a different improvement which I made Specifically for Tundras... :cry::cry::cry:
That is super annoying that you can't disable builds for certain terrains...I sense a need for an sdk mod...

But without sdk here are a few slightly fudgey ways to maybe fix it.
Spoiler :

  1. Change tundra terrain to not have a food yield anymore - then it would be like a colder desert.
  2. Change farm to require 2 food yield instead of 1 - but you'd have to change Plains yield too
  3. Change farm FreshWaterMakesValid to 0, but that might screw up rivers and lakes with farms
  4. Add something to canBuild in CvGameUtils

 
That is super annoying that you can't disable builds for certain terrains...I sense a need for an sdk mod...

But without sdk here are a few slightly fudgey ways to maybe fix it.
Spoiler :

  1. Change tundra terrain to not have a food yield anymore - then it would be like a colder desert.
  2. Change farm to require 2 food yield instead of 1 - but you'd have to change Plains yield too
  3. Change farm FreshWaterMakesValid to 0, but that might screw up rivers and lakes with farms
  4. Add something to canBuild in CvGameUtils


Yeah that was exactly what I was thinking: either set Tundra to 0 food, and then have my special tundra food improvement to work of 0 food, OR set Farm req to 2 food, increase plains, grass and water by 1 food, but also set req food per population by +1 as well.

I will play with FreshWaterMakesValid and see farms can be build without that thing, if not, then its one of the above ;)


UPDATE: Ok I tested it - I set FreshWaterMakesValid to 0, and you can still build farms, but NOT in Tundra! Requires irrigation seem to do the trick just fine - it recognized water sources, it spreads across neighboring farms, and across cities. AI also doesn't seem to be affected and still builds farms.
 
Last edited:
Yeah that was exactly what I was thinking: either set Tundra to 0 food, and then have my special tundra food improvement to work of 0 food, OR set Farm req to 2 food, increase plains, grass and water by 1 food, but also set req food per population by +1 as well.

I will play with FreshWaterMakesValid and see farms can be build without that thing, if not, then its one of the above ;)


UPDATE: Ok I tested it - I set FreshWaterMakesValid to 0, and you can still build farms, but NOT in Tundra! Requires irrigation seem to do the trick just fine - it recognized water sources, it spreads across neighboring farms, and across cities. AI also doesn't seem to be affected and still builds farms.
Would you mind to post this with your tundra improvement as a modcomp? I'm super-curious to try it or even add to my mod - if you don't mind.
 
Will gc.getInfoTypeForString("FLAVOR_MILITARY") ever work? Or do I have to use the hardcoded values for flavors like 0,1, etc?
 
Would you mind to post this with your tundra improvement as a modcomp? I'm super-curious to try it or even add to my mod - if you don't mind.

Heya, its not much of a modcomp but here is the model:
https://forums.civfanatics.com/threads/yaranga-tundra-improvement.613889/#post-15265818

And here is my xml entry (which also uses some of my custom tech, but you can replace them with your own):

Code:
       <ImprovementInfo>
           <Type>IMPROVEMENT_TUNDRA_CAMP</Type>
           <Description>TXT_KEY_IMPROVEMENT_TUNDRA_CAMP</Description>
           <Civilopedia>TXT_KEY_IMPROVEMENT_TUNDRA_CAMP_PEDIA</Civilopedia>
           <ArtDefineTag>ART_DEF_IMPROVEMENT_TUNDRA_CAMP</ArtDefineTag>
           <PrereqNatureYields>
               <iYield>1</iYield>
               <iYield>0</iYield>
               <iYield>0</iYield>
           </PrereqNatureYields>
           <YieldChanges>
               <iYieldChange>1</iYieldChange>
               <iYieldChange>0</iYieldChange>
               <iYieldChange>1</iYieldChange>
           </YieldChanges>
           <RiverSideYieldChange>
               <iYield>0</iYield>
               <iYield>0</iYield>
               <iYield>1</iYield>
           </RiverSideYieldChange>
           <IrrigatedYieldChange>
               <iYield>0</iYield>
               <iYield>0</iYield>
               <iYield>0</iYield>
           </IrrigatedYieldChange>
           <bActsAsCity>0</bActsAsCity>
           <bHillsMakesValid>0</bHillsMakesValid>
           <bFreshWaterMakesValid>0</bFreshWaterMakesValid>
           <bRiverSideMakesValid>0</bRiverSideMakesValid>
           <bNoFreshWater>0</bNoFreshWater>
           <bRequiresFlatlands>0</bRequiresFlatlands>
           <bRequiresRiverSide>0</bRequiresRiverSide>
           <bRequiresIrrigation>0</bRequiresIrrigation>
           <bCarriesIrrigation>0</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_TUNDRA</TerrainType>
                   <bMakesValid>1</bMakesValid>
               </TerrainMakesValid>
           </TerrainMakesValids>
           <FeatureMakesValids/>   

           <BonusTypeStructs>
               <BonusTypeStruct>
                   <BonusType>BONUS_DEER</BonusType>
                   <bBonusMakesValid>1</bBonusMakesValid>
                   <bBonusTrade>1</bBonusTrade>
                   <iDiscoverRand>0</iDiscoverRand>
                   <YieldChanges>
                       <iYieldChange>3</iYieldChange>
                       <iYieldChange>1</iYieldChange>
                       <iYieldChange>1</iYieldChange>
                   </YieldChanges>
               </BonusTypeStruct>
           </BonusTypeStructs>
   
           <ImprovementPillage/>
           <ImprovementUpgrade/>
           <TechYieldChanges>
               <TechYieldChange>
                   <PrereqTech>TECH_FEUDAL_ECONOMY</PrereqTech>
                   <TechYields>
                       <iYield>0</iYield>
                       <iYield>1</iYield>
                       <iYield>1</iYield>
                   </TechYields>
               </TechYieldChange>
               <TechYieldChange>
                   <PrereqTech>TECH_BIOLOGY</PrereqTech>
                   <TechYields>
                       <iYield>1</iYield>
                       <iYield>0</iYield>
                       <iYield>0</iYield>
                   </TechYields>
               </TechYieldChange>
               <TechYieldChange>
                   <PrereqTech>TECH_BARBWIRE</PrereqTech>
                   <TechYields>
                       <iYield>0</iYield>
                       <iYield>0</iYield>
                       <iYield>1</iYield>
                   </TechYields>
               </TechYieldChange>
               <TechYieldChange>
                   <PrereqTech>TECH_MEDICINE3</PrereqTech>
                   <TechYields>
                       <iYield>1</iYield>
                       <iYield>0</iYield>
                       <iYield>1</iYield>
                   </TechYields>
               </TechYieldChange>
           </TechYieldChanges>
           <RouteYieldChanges/>
           <bGraphicalOnly>0</bGraphicalOnly>
       </ImprovementInfo>
 
Back
Top Bottom