1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

Question about unit upgrades

Discussion in 'Civ5 - Creation & Customization' started by Hulfgar, Feb 27, 2012.

  1. Hulfgar

    Hulfgar Chieftain

    Joined:
    Mar 31, 2008
    Messages:
    1,792
    Gender:
    Male
    Location:
    France
    Hello all,

    is it possible to give a unit more than 1 upgrade option ?

    more important : how can I adjust the cost of an upgrade ?

    thanks
     
  2. PawelS

    PawelS Ancient Druid

    Joined:
    Dec 11, 2003
    Messages:
    2,802
    Location:
    Poland
    1. AFAIK it's not possible. You can add more upgrades in the XML, but it won't work.

    2. BASE_UNIT_UPGRADE_COST and UNIT_UPGRADE_COST_PER_PRODUCTION (in GlobalDefines.xml)

    (Also UNIT_UPGRADE_COST_MULTIPLIER_PER_ERA*, UNIT_UPGRADE_COST_EXPONENT*, UNIT_UPGRADE_COST_VISIBLE_DIVISOR, UNIT_UPGRADE_COST_DISCOUNT_MAX)

    * I don't know if/how these 2 defines work.

    For adjusting upgrade cost of individual units, you can try using a promotion with UpgradeDiscount, but I haven't checked if it works.
     
  3. Hulfgar

    Hulfgar Chieftain

    Joined:
    Mar 31, 2008
    Messages:
    1,792
    Gender:
    Male
    Location:
    France
  4. Spatzimaus

    Spatzimaus Mad Scientist

    Joined:
    Sep 21, 2005
    Messages:
    3,063
    Location:
    Los Angeles, CA
    If you modify the UnitPanel Lua/xml then it should be possible to intercept the player's upgrade command and add a new UI window that allows the player to pick which unit type to upgrade to. You wouldn't need anything in the XML for that, unless you wanted to for bookkeeping purposes, and your only real headache would be ensuring the promotions of the old unit are compatible with the new unit type. (Not that the existing game has any of that, of course.)

    However, this wouldn't help the AI, which'd still use the old linear upgrade methods unless you also added some sort of "sideways" upgrade mechanism (not difficult with Lua, except for ensuring that type-specific promotions of the other unit type aren't transferred over) and code up an AI logic on when to use it (much harder). In theory it could be done, but in practice it probably wouldn't be worth the headaches unless your mod was entirely designed around the idea of branching upgrade chains.
     
  5. Hulfgar

    Hulfgar Chieftain

    Joined:
    Mar 31, 2008
    Messages:
    1,792
    Gender:
    Male
    Location:
    France
    Thanks as well Spatzimaus.

    I will drop the idea of multiple upgrades, as you say it's not worth the headache, especially if the AI has to learn how to use it!
     

Share This Page