Question about unit upgrades

Hulfgar

Emperor
Joined
Mar 31, 2008
Messages
1,798
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
 
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.
 
1. AFAIK it's not possible. You can add more upgrades in the XML, but it won't work.

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.
 
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!
 
Top Bottom