pick Target
Generic target picker Will always fall back on the closest target if none are found within the search parameters.
ShipAPI target = MagicTargeting.pickTarget(
missile,
MagicTargeting.targetSeeking..NO_RANDOM,
(int)missile.getWeapon().getRange(),
360,
0,
1,
2,
4,
4,
false
);
Return
ShipAPI target
Parameters
The CombatEntity concerned. Can only be a ship or a missile.
Does the missile find a random target or tries to hit the ship's one?
NO_RANDOM, If the launching ship has a valid target within arc, the missile will pursue it. If there is no target, it will check for an unselected cursor target within arc. If there is none, it will pursue its closest valid threat within arc.
LOCAL_RANDOM, If the ship has a target, the missile will pick a random valid threat around that one. If the ship has none, the missile will pursue a random valid threat around the cursor, or itself. Can produce strange behavior if used with a limited search cone.
FULL_RANDOM, The missile will always seek a random valid threat within arc around itself.
IGNORE_SOURCE, The missile will pick the closest target of interest. Useful for custom MIRVs.
Range in which the missile seek a target in game units.
Angle in which the missile will seek the target. Set to 360 or more to ignore.
Target priority, set to 0 to ignore that class. Other values only used for random targeting.
Target priority, set to 0 to ignore that class. Other values only used for random targeting.
Target priority, set to 0 to ignore that class. Other values only used for random targeting.
Target priority, set to 0 to ignore that class. Other values only used for random targeting.
Target priority, set to 0 to ignore that class. Other values only used for random targeting.
fallback option: if no suitable target is found within the search cone and distance the script will pick the closest possible target as long as it is within twice the max range.