Unit Production and Upgrades

Temrek

Chieftain
Joined
Jun 19, 2008
Messages
28
Is there anyway to create a unit that other can be upgraded to but it cannot be produced normally?

This is to force a player to spend gold on specific types of unit upgrades, and these upgrades cannot really be represented with promotions.
 
I haven't tried it but the Great People are treated as units so it should be possible. Try setting iCost to -1 and setting up the upgrade xml as usual. I'm not sure how upgrade cost is calculated so that part might require some research.
 
setting iCost to -1 would be a problem.

Upgrade cost is 20+3*((cost up upgraded unit)-(cost of old unit))

Upgrading from a 60 hammer unit to a -1 Hammer unit would 'cost' 20+3*(-61)=-163 gold... you would gain money from upgrading.

That is assuming the game would even let you (which I doubt).
 
Setting I cost to -1 seems to do it, it costs a fixed 20 gold. Now to see if there is away to increase the upgrade cost...
 
I just tried it out and was able to mod warrior to upgrade to a Great Prophet. It cost 20 gold so it must default negative sums to 0.

Might not work that great but I can't see any other way to do it. The integer entry, bUnitClassUpgrade, inside each UnitClassUpgrade tag might have something to do with the upgrade cost but none of the references I've found says what the integer does.
 
You can override upgrade costs in python, more precisely the CvGameutils.py file. Look at Final Frontier for an example.
 
You are correct, I never noticed that. I was hoping I could do it with XML but scripting it for each unit will have to do. Thanks a lot for your help.
 
Well in Global Defines you can change the basic upgrade cost (20) and the upgrade cost per extra hammr (3), but that affects all units, so I guess that's not what you're looking for.
 
What if you made the cost a normal one but made the tech prereq some unreachable tech you added? Ought to work then I think.
 
You can override upgrade costs in python, more precisely the CvGameutils.py file. Look at Final Frontier for an example.
Wow thanks... that helped on one of my own matters in my own mod.

(I had a non-purchasable [-1 cost] gift unit that could be upgraded to normal units, but the upgrade cost was crazy because it had a -1 cost... this tip fixed it).
 
Back
Top Bottom