Discuss this page on this pages TalkPage

From API 34 on Ministry

objCalcBestTarget

Syntax (objCalcBestTarget obj [objList])
Arguments obj: The object to calculate the target for
[objList]: A list of objects to check
Returns With one argument, returns the nearest visible target (non-friendly) to obj. With a list, returns the nearest visible target in the list. Returns nil if unsuccessful.
Category spaceObject functions
Description Useful for finding the nearest target to an object, or if an object/order giver is closer and therefore a better target.

Example

 (objCalcBestTarget gSource) 

Finds the nearest visible target to the source object.

 (objCalcBestTarget gSource (list aOrderGiver aAttacker)) 

Finds the nearest visible target between an attacker and subordinates, eg. a player or their auton, to gSource.

Return to Space Object functions list

Return to functions list