An Introduction to Upgrades [ZH]
January 06, 2009 - 02:48
This isn't exactly a tutiorial, but if you are new to this, I suggest you read my other tutorials first.

Upgrades are pretty much all of those buttons which niether give the order to build something or to affect unit behavior (stop, attack move etc).  They have alot of interesting uses, and once you get to know their intricities, you can make your mod more indepth.  Some examples of upgrades are unit upgrades:  Increasing armor, attack damage.  While others more subtle: the button that switches between machine gun and flash grenades, and the button that switches between fake and real buildings for the GLA Worker.

If you want to add a new upgrade, the first step is to get the INI for the upgrades.  It is located in the INIZH .big.  Extract it and open it up.  Upgrade entries are surprisingly short.  And contain none of what you'd expect them to.  Lets take a look at one, shall we?

Upgrade Upgrade_AmericaAdvancedControlRods
 DisplayName        = UPGRADE:ControlRods
 Type               = OBJECT
 BuildTime          = 30.0
 BuildCost          = 500
 ButtonImage        = SSControlRods
End

This is the upgrade for the american powerplant which gives it more power.  But you know what?  You ca't see anything there that even mentions adding more power.  Confusing I know, but that lesson is for the future.  Upgrade enteries basically controll how much and how long an upgrade takes to complete.  (Thus the BuildTime and BuildCost).  The image is the one that appears when the owner of the upgrade is building it.  Perhaps the most important line in it is the "type" line.  As you can see, it is set to "OBJECT".  The only other option is "PLAYER".  These two dictate if the upgrade affect only the single individual object that buys it in the first place (for example buying a battle drone) or if the upgrade affects everything that the player owns for the rest of the game (TOW missiles for example).  And thats it for this entry.  How much, how long, and who gets it.

The next step to implementing an upgrade is the button.  Which is basically like any other button you may have made, but with two exceptions.  Commnad = UNIT_BUILD is replaced with OBJECT_UPGRADE
and Object = is replaced with Upgrade =.  Simple enough right?  Once you have made the button for your upgrade, you simply add it to the commandset of whatever builds it, save, and the subject of upgrades in themselves is basically done.  "How how do my upgrades actually WORK?" you ask, well as I mentioned before, thats for a later time and date.  They are actually controlled by "modules" which are in the affected unit's entry themselves.  I'll talk about modules later Wink

BIG EDIT: You are limited to a total of 128 Upgrades!