Contents |
Overview
Each unit can be assigned zero or more categories using the "category" tag. A category is a single UPPERCASE word. Simply put down all the categories you want the unit to belong to as a string, separating the categories by spaces.
You can have a maximum of 32 categories. You do not need to list them in any special file; you only need to put them in the category tags for your units.
Weapon Targeting
The primary purpose of categories is weapon targeting. Do not use categories for anything else if you can avoid it. The relevant tags are noChaseCategory for units, and onlyTargetCategory and badTargetCategory for weapons. Note that, like the category tag, you can specify multiple categories for these tags.
noChaseCategory
onlyTargetCategory
If you omit this tag for a weapon, it will target all units (other than only waterWeapons being able to target underwater units). Otherwise, the weapon will target any units that belong to at least one of the categories that you list for this tag.
badTargetCategory
If you omit this tag for a weapon, it will treat all targets without regard for their categories. Otherwise, the weapon will prefer to target units that do not have any of the categories that you list for this tag.
Quirks
Currently there are two categories with engine-hardcoded effects: COMMANDER and VTOL. COMMANDER determines whether the unit is selected by Ctrl-C. VTOL determines whether the unit is selected as an aircraft using selection keys. Also, if you give a weapon the toAirWeapon tag, its onlyTargetCategory becomes "VTOL".
In addition, custom selection keys can select by explicit categories.
Suggested Use
First, come up with a set of categories that forms an exact cover for all of your units. That is, each unit belongs to exactly one of these categories. One example would be VTOL, HOVER, FLOAT, SINK. To make a weapon target only air units, you would then say onlyTargetCategory = "VTOL". To make a weapon target only non-air units, you would then say onlyTargetCategory = "HOVER FLOAT SINK".
Then, add other categories as needed. For example, if you have EMP-resistant units, then you might want to have EMP weapons prefer not to target those units. You might then put in a category "ANTIEMP" for those units, and give badTargetCategory = "ANTIEMP" to EMP weapons.
