[BTS] Overriding unit upgrade

Discussion in 'Civ4 - Creation & Customization' started by Hoffs, May 14, 2017.

  1. Hoffs

    Hoffs Chieftain

    Joined:
    Sep 5, 2011
    Messages:
    11
    Hi,

    Is there any way to override the upgrade set for a unit without modifying the original unit file?

    For example, let's say the original unit has this:

    <UnitClassUpgrades>
    <UnitClassUpgrade>
    <UnitClassUpgradeType>UNITCLASS_WHATEVER</UnitClassUpgradeType>
    <bUnitClassUpgrade>1</bUnitClassUpgrade>
    </UnitClassUpgrade>
    </UnitClassUpgrades>


    I can obviously stop the upgrade by removing this from the original file or changing the boolean to zero, but I want to know if there is a way to change it in a modular loaded file that alters the unit's properties. If I add the following to my file it does not seem stop the upgrade although all other changed properties are working:

    <UnitClassUpgrades>
    <UnitClassUpgrade>
    <UnitClassUpgradeType>UNITCLASS_WHATEVER</UnitClassUpgradeType>
    <bUnitClassUpgrade>0</bUnitClassUpgrade>
    </UnitClassUpgrade>
    </UnitClassUpgrades>


    So does anyone know of a way to override the upgrade?
     
  2. Nightinggale

    Nightinggale Deity

    Joined:
    Feb 2, 2009
    Messages:
    4,934
    The way the game loads DLL files is that it allocates a new entry in memory, then reads the contents of the entry in the file (in this case UnitInfo) into that blank memory. If Type is already in use, it replaces that entry, otherwise it adds it to the end of the list.

    Doing what you want is technically possible but it would require some work in the DLL.
     
  3. Hoffs

    Hoffs Chieftain

    Joined:
    Sep 5, 2011
    Messages:
    11
    Aw, okay. Thanks very much for the fast response.
     

Share This Page