object - commandobject - platoon


unit FindTarget(int nUnit, int nTargetType, int nSideSelection, int nKindSelection, int nDestinationSelection)

Scope: private

Parameters
nUnit - unit number
nTargetType - combination of following values:
findTargetWaterUnit - ship,
findTargetFlyingUnit - flying unit,
findTargetNormalUnit - land unit,
findTargetBuildingUnit - building,
findTargetAnyUnit - any of aboves,
findTargetWall - wall ED or UCS,
findTargetBuildingRuin - building ruin.
nSideSelection - one of following values:
findEnemyUnit - enemy unit,
findAllyUnit - ally unit,
findNeutralUnit - neutral unit,
findOurUnit - our unit.
nKindSelection - one of following values:
findNearestUnit - nearest unit,
findWeakestUnit - weakest unit,
findStrongestUnit - strongest unit,
findDisabledUnit - disabled unit,
findSickestUnit - unit which have lowest relative (by MaxHP) HP value.
nDestinationSelection - combination of following values:
findDestinationCivilUnit - civil unit,
findDestinationArmedUnit - armored unit,
findDestinationRepairerUnit - Repairer,
findDestinationSupplyUnit - Supplier,
findDestinationAnyUnit - any of aboves.

Return values
Found object or null if not found.

Description
This function is used for finding objects in units range of view by conditions put in parameters.
Function returns object which is closest to condition from parameter nKindSelection.

See also