[BNW] Some XML values (traits/difficulty) not being applied

clamlol

Chieftain
Joined
Feb 10, 2022
Messages
6
I'm making a small balance mod, and I need help getting my changes to traits and AI difficulty to apply in-game.

I should start off by saying I don't use ModBoddy for the simple reason that I can't look at such a bright screen. Instead, I skim through the vanilla files until I find the XML value I want to change and then update that value in my own file. Currently, my .modinfo file looks like this:

Mini Balance Mod.modinfo
Spoiler :

Code:
<?xml version="1.0" encoding="utf-8"?>
<Mod id="38fa82c9-e1ab-43a7-8b64-c2fec723d96e" version="5">
  <Properties>
    <Name>Mini Balance Mod</Name>
    <Stability>Alpha</Stability>
    <Teaser>A small balance mod.</Teaser>
    <Description>This is a work-in-progress mod intended to balance Civilization V by tweaking a handful of beliefs, buildings, policies, traits and units to bring them in line with the rest. Also nerfs the AI on Immortal and Deity somewhat, especially at the start of the game.</Description>
    <Authors>Me</Authors>
    <HideSetupGame>0</HideSetupGame>
    <AffectsSavedGames>0</AffectsSavedGames>
    <SupportsSinglePlayer>1</SupportsSinglePlayer>
    <SupportsMultiplayer>1</SupportsMultiplayer>
    <SupportsHotSeat>1</SupportsHotSeat>
    <SupportsMac>1</SupportsMac>
    <ReloadAudioSystem>0</ReloadAudioSystem>
    <ReloadLandmarkSystem>0</ReloadLandmarkSystem>
    <ReloadStrategicViewSystem>0</ReloadStrategicViewSystem>
    <ReloadUnitSystem>0</ReloadUnitSystem>
  </Properties>
  <Dependencies />
  <References />
  <Blocks />
  <Files>
    <File md5="C050B3DD9249A93003701CE9F6FD155F" import="0">Beliefs.xml</File>
    <File md5="CD02CF9440A3703E954697023A30BDBF" import="0">Buildings.xml</File>
    <File md5="2155830174BA6E69C819C3FF1ECE8CB6" import="0">SocialPolicies.xml</File>
    <File md5="AF0500E3693DF4206276F43335706235" import="0">Text.xml</File>
    <File md5="9BFDC6296AE6055C787C45B6F910398E" import="0">Traits_Babylon.xml</File>
    <File md5="1ECFC6296AE6055C787C45B6F910398E" import="0">Traits_Korea.xml</File>
    <File md5="BAFDC6296AE6055C687C45B6E910398E" import="0">Units.xml</File>
    <File md5="CF0500E3293DF4206170F03335706452" import="0">HandicapInfos.xml</File>
  </Files>
  <Actions>
    <OnModActivated>
      <UpdateDatabase>Beliefs.xml</UpdateDatabase>
      <UpdateDatabase>Buildings.xml</UpdateDatabase>
      <UpdateDatabase>SocialPolicies.xml</UpdateDatabase>
      <UpdateDatabase>Text.xml</UpdateDatabase>
        <UpdateDatabase>Traits_Babylon.xml</UpdateDatabase>
      <UpdateDatabase>Traits_Korea.xml</UpdateDatabase>
        <UpdateDatabase>Units.xml</UpdateDatabase>
      <UpdateDatabase>HandicapInfos.xml</UpdateDatabase>
    </OnModActivated>
  </Actions>


My assumption here is that if I want to update a value I found in Sid Meier's Civilization V/Assets/DLC/DLC_05/Gameplay/XML/CIV5Traits_Korea.xml (in this case, the science bonus from specialists), I list "Traits_Korea.xml" under the <Files> tag and give it a random unique value for "md5", then list that filename again under <OnModActivated>. If this is incorrect, please let me know. As for what that file contains, it's as follows:

Traits_Korea.xml
Spoiler :

Code:
<?xml version="1.0" encoding="utf-8"?>
<GameData>
    <Trait_SpecialistYieldChanges>
        <Update>
            <Set Yield="1"/>
            <Where TraitType="TRAIT_SCHOLARS_JADE_HALL"/>
        </Update>
    </Trait_SpecialistYieldChanges>
    <Traits>
        <Update>
            <Set Help="TXT_KEY_TRAIT_SCHOLARS_JADE_HALL"/>
            <Where TraitType="TRAIT_SCHOLARS_JADE_HALL"/>
        </Update>
    </Traits>
    <!-- (Some commented-out stuff) -->
</GameData>


This seems correct to me, and yet when I test it in game Korean specialists still give +2 Science. It seems like this file isn't being applied at all. The same happens for the following 2 files:

Traits_Babylon.xml
Spoiler :

Code:
<?xml version="1.0" encoding="utf-8"?>
<GameData>
    <Traits>
        <Update>
            <Set GreatScientistRateModifier="25" Help="TXT_KEY_TRAIT_INGENIOUS"/>
            <Where TraitType="TRAIT_INGENIOUS"/>
        </Update>
    </Traits>
</GameData>

HandicapInfos.xml
Spoiler :

Code:
<?xml version="1.0" encoding="utf-8"?>
<GameData>
    <HandicapInfos>
        <Update>
            <Set AIStartingDefenseUnits="1"
                AIStartingWorkerUnits="0"
                AIWorkRateModifier="50"
                AITrainPercent="70"
                AIConstructPercent="70"
                AIPerEraModifier="-3"
                AIAdvancedStartPercent="135"
                AICreatePercent="70"
                AIBuildingCostPercent="70"
                AIFreeXP="10"
                AIFreeXPPercent="25"/>
            <Where Type="HANDICAP_IMMORTAL"/>
        </Update>
        <Update>
            <Set AIStartingWorkerUnits="1"
                AIWorkRateModifier="75"
                AIPerEraModifier="-4"
                AIAdvancedStartPercent="135"/>
            <Where Type="HANDICAP_DEITY"/>
        </Update>
    </HandicapInfos>
</GameData>


For contrast, here's my social policies file, which is applied correctly:

SocialPolicies.xml
Spoiler :

Code:
<?xml version="1.0" encoding="utf-8"?>
<GameData>
    <Policies>
        <Update>
            <Where Type="POLICY_LEGALISM"/>
            <Set NumCitiesFreeCultureBuilding="3"/>          
        </Update>

        <Update>
            <Where Type="POLICY_TRADITION_FINISHER"/>
            <Set NumCitiesFreeFoodBuilding="2"/>
        </Update>

        <Update>
            <Set Help="TXT_KEY_POLICY_SPACE_PROCUREMENTS_HELP"/>
            <Where Type="POLICY_SPACE_PROCUREMENTS"/>
        </Update>
    </Policies>

    <Policy_CapitalYieldModifiers>
        <Row>
            <PolicyType>POLICY_SPACE_PROCUREMENTS</PolicyType>
            <YieldType>YIELD_GOLD</YieldType>
            <Yield>25</Yield>
        </Row>
    </Policy_CapitalYieldModifiers>
    <!-- (Some commented-out stuff) -->
</GameData>


What am I missing here?
 
Check the log files (link in my sig) and if those don't reveal the issue, attach the actual mod (link also in my sig)
 
Thanks for the quick reply! Turns out the <Help> tags in the Korea/Babylon files were unnecessary and causing problems; additionally, for Babylon I was trying to update <TraitType> rather than <Trait>. After fixing those issues both traits now work as I want them to.

The changes to AI bonuses seem to be only partially working; on Immortal, the AI now starts without a worker (intended) and their military units start with only 10 XP (intended), but they still start with 2 military units instead of 1 (unintended) in addition to their settler and scout. I was unsure how to test the other changes and feel like I would probably have to play several full games to get a sense of whether they were working. I should note that upon first testing things I got a line in my logs that said something like "HandicapInfos.xml: Duplicate Set entries are not supported", but after fixing Korea and Babylon I no longer get this line even though I haven't made any changes to HandicapInfos.xml. I've attached my mod below; if you could help me locate the problem I would greatly appreciate it.
 

Attachments

  • Mini Balance Mod (v 5).zip
    6.5 KB · Views: 14
Last edited:
It's been a long time since I was heavily modding Civ 5 ... forgotten so much ... but pretty sure the AIStartingXyz values in HandicapInfos.xml are in addition to the standard 1 settler + 1 defender that players start with
 
You're correct, thanks! I should've looked more closely at the vanilla file.
 
Top Bottom