Free Unit upgrading

thebigticket

Chieftain
Joined
Jan 20, 2009
Messages
19
Hi, I'm not really sure if this is the right thread, just dont know where else to go...
My problem is that I hate seeing cities defended by riflemen next to longbowman or similar such unrealistic things. So I would like to invent free unit upgrading always and for every civ.
I play the Rhye's and Fall of Civilizations Mod and there for example Germany gets free unit upgrading with the industrialisation tech.
I hope its just a minor change in the code and that you can help me finding it. :king:
 
I think there's a value you can set to 0 in the GlobalDefines.xml file, but don't change it there. Instead, copy it (BTS/Assets/XML) to "My Games/Beyond the Sword/CustomAssets/XML" and edit that copy using Notepad. Search for upgrade. IIRC it's a multiplier that is applied to the :hammers: difference between the two unit types. If you set it to 0, the cost for all upgrades will be 0:gold:. It won't auto-upgrade for you, but the AI's will probably do it without concern for losing XP.
 
Thanks for the quick answer and the quick solution, it just worked :goodjob:
Just one question occured...
I searched for "upgrade" and there were 3 lines found:

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


<Define>
<DefineName>BASE_UNIT_UPGRADE_COST</DefineName>
<!-- Rhye -->
<iDefineIntVal>10</iDefineIntVal>
</Define>


<Define>
<DefineName>UNIT_UPGRADE_COST_PER_PRODUCTION</DefineName>
<!-- Rhye -->
<iDefineIntVal>2</iDefineIntVal>
</Define>

(I used the xml from assets in the mod folder, actually the same code just different values)

Obviously the first lines have something to do with experience so I didnt touch it.
But free unit upgrade did only work if I changed for both "BASE_UNIT_UPGRADE_COST" and "UNIT_UPGRADE_COST_PER_PRODUCTION" the iDefineIntVal to 0. What is the difference between those two unit upgrade types?

And thanks again :)
 
The cost of the upgrade is defined by this formula (guessing from the names of the XML values):

price = base-unit-upgrade:gold: + (new:hammers: - old:hammers:) x unit-upgrade:gold:/:hammers:

So the first value (10) is a straight cost for each upgrade while the second value scales with the production cost difference between the two unit types. To upgrade from a 60:hammers: unit to a 100:hammers: unit would normally cost

10 + (100 - 60) * 2 = 90:gold:
 
Top Bottom