Mod unit experience after upgrade so they retain XP points

civangel

Chieftain
Joined
Nov 10, 2018
Messages
6
I'm playing BTS. I hate that my experienced units lose basically all their XP points when I upgrade them, going back to a max of 10XP points.

I modified MAX_EXPERIENCE_AFTER_UPGRADE in GlobalDefines.xml

ORIGINAL:

<Define>
<DefineName>MAX_EXPERIENCE_AFTER_UPGRADE</DefineName>
<iDefineIntVal>10</iDefineIntVal>
</Define>

MY MODIFICATION:

<Define>
<DefineName>MAX_EXPERIENCE_AFTER_UPGRADE</DefineName>
<iDefineIntVal>150</iDefineIntVal>
</Define>

However, this doesn't seem to have any effect. I tried my Steam version and also my own version installed from my DVD. Loading is always uncached.

I tested on saved and new games, different settings, maps, etc. Nothing works, the units always retain a max of 10 XP after upgrade.

Is this controlled by any other file?
 
Moderator Action: Moved to C&C forum for better assistance. Cheers - lymond
 
Looks like it's the right value. The DLL reads it in CvUnit::upgrade, and that function gets called by CvUnit::doCommand, which handles human commands. Edit: And you could always try changing something more conspicuous in GlobalDefines.xml, e.g. the START_YEAR. MIN_VERSION 320 should prevent the game from launching ...

Sounds like you might be modifying the base game version of GlobalDefines.xml. The path of the file should contain "Beyond the Sword\Assets", in the case of Steam perhaps two times "Beyond the Sword". This can't be the issue if you're loading a mod that contains a copy of GlobalDefines.xml or have copied and modified GlobalDefines.xml to CustomAssets. That said, in these cases, the base game and BtS also have their separate Mods and CustomAssets folders. (Changing the original files risks losing track of what you changed, maybe having to re-install at some point or getting frequent out-of-sync errors in multiplayer.)
 
Last edited:
Looks like it's the right value. The DLL reads it in CvUnit::upgrade, and that function gets called by CvUnit::doCommand, which handles human commands. Edit: And you could always try changing something more conspicuous in GlobalDefines.xml, e.g. the START_YEAR. MIN_VERSION 320 should prevent the game from launching ...

Sounds like you might be modifying the base game version of GlobalDefines.xml. The path of the file should contain "Beyond the Sword\Assets", in the case of Steam perhaps two times "Beyond the Sword". This can't be the issue if you're loading a mod that contains a copy of GlobalDefines.xml or have copied and modified GlobalDefines.xml to CustomAssets. That said, in these cases, the base game and BtS also have their separate Mods and CustomAssets folders. (Changing the original files risks losing track of what you changed, maybe having to re-install at some point or getting frequent out-of-sync errors in multiplayer.)

Thanks for the reply! I tried using my own MOD, which has many other changes and they all work fine, but the upgraded units were still retaining a max of 10 XP points.

Then I edited the original game file just to see if it would take effect. It didn't. I also edited other things in the same file just to make sure that what I was doing was in effect and it was. Every other change works fine, except for the MAX XP points. I tried the Steam version and also my DVD version and this change doesn't work at all on either, while all other edits work. That's why I thought this may be controlled by a different file that is overriding my changes on GlobalDefines.xml
 
Oh, I see. My psychic abilities fail me. 😉
I've tried it myself now, and raising the limit to 12 works as expected for me. I'm attaching a mini mod and savegame. Upgrading the 15-XP Archer to Longbowman should leave it with 12 XP. I've changed the variable through GlobalDefinesAlt.xml because that seems like the cleanest way to do it in a small mod like this. But, given your reply, I much doubt that doing it that way - rather than through GlobalDefines.xml - will make a difference. At first, it didn't seem to work, but I had just forgotten to load the mod before World-Buildering the game state. Not to suggest that that's your issue either, just goes to show that there's room for silly errors.
 

Attachments

  • 12XPMod.zip
    1.3 KB · Views: 6
  • 12XPTest.CivBeyondSwordSave
    38.9 KB · Views: 14
Oh, thanks @f1rpo !!! You're awesome!

I realized I was actually making a mistake with my MOD and it wasn't loading at all! It's all working fine now!
 
Top Bottom