Target categories

Target categories

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Target categories

Post by krogothe »

To get KAI to work properly i need to know what things make units/weapons unable/able to target certain unit types, such as anti-air/anti-sub only weapons etc. I hear there are many ways to control what a unit/weapon can target or not and so i need help. If you know of one, and where its located please post here!

Example:
OnlyTargetCategory1=AIR; makes a unit only target air, it is located in the unit FBI and used in EE.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

The primary method the engine uses that is accessible tot he AI which holds the vast majority is unfortunately a bitfield of dynamically allocated values making ti useless for the AI.

I believe there are lists fo tags available, and you may find looking at unitloader/handler.cpp useful
Archangel of Death
Posts: 854
Joined: 28 Jan 2005, 18:15

Post by Archangel of Death »

In the weapon tdf's, you have the "toairweapon" tag, where 1 makes it only able to fire at flying units and 0 able to fire at everything, and with a default value of 0 if undefined.

Then you have the fbi tag "OnlyTargetCategory#", where the number corresponds to the weapon number. The values it uses are the categories found in the fbi tag "Category" in all units.

And thats everything that controls what weapons can shoot at what units. I'm not sure how "toairweapon=1;" would work in conjunction with a "OnlyTargetCategory=AIR;", or anything like that. I'd say just throw up a modder error warning and ignore it.

And on a side note, I've never really thought much about OnlyTargetCategory, but it is extremely flexible and powerful.
User avatar
krogothe
AI Developer
Posts: 1050
Joined: 14 Nov 2005, 17:07

Post by krogothe »

thanks a bunch ;)
User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Post by Caydr »

These worked in TA, so I can't say for certain they'll work in Spring, but I think they do.

1) badtargetcategoryX=air; (where X is a number of a weapon) This can have one of two effects. Firstly, if this is put on a unit, and it is attacked by 2 units, one with an AIR category tag and one without an AIR category tag, it will attack the one without the tag.

However, this also has another interesting possibility. If the weapon is DESIGNED to attack air, for instance it's a toairweapon, it will make it switch between targets more quickly rather than "locking on" to a target while it remains out of its firing range and waiting a little bit for it to return before it selects a new target.

Another use might be badtargetcategoryX=all; ... this makes it so that it'll switch between targets the same as above, but for all units (assuming, like most mods, every unit has been assigned the ALL category).

These last two uses were commonly done in order to compensate for OTA's locking on system (which many considered an engine flaw, or at the very least an inconvenience at times). Because this is widely considered a flaw, the SYs may have corrected it in Spring by default. That's up to you to figure out.

2) there's also nochasecategory... this one is very handy if you don't want, for instance, a bulldog running off to chase down a retreating gunship swarm. In GEM, I have starships set to not chase fighters, for instance, while chasing larger ships.

The length to which a unit will chase its target from its starting position or differing from its patrol route is defined by the maneuverleashlength. Though, as the name suggests, I'm pretty sure it only applies when the unit is set to Maneuver.
Post Reply

Return to “Game Development”