FindTarget(float)

Finds the next target for a guard to attack.

object FindTarget(
    float fMaxDistance
);

Parameters

fMaxDistance

Maximum range to check.


Description

This function will return the nearest viable target within the given range. If none are available, it will return OBJECT_INVALID.



Remarks

Found in nw_c3_waypoint3.nss on line 16.

Note that nw_c3_waypoint3 is not an include file – you cannot include that file and then call FakeRestore from your script, because nw_c3_waypoint3 already has a void main() function.

Also, it does not return the nearest viable target, just the first valid target found within a sphere with the radius of fMaxDistance around the caller. All creatures that are enemies and not dead are considered valid targets.

The way Bioware uses this function is, that if no valid target is found after a previous target is killed, the guard (ie the caller of the script) will resume walking waypoints.

I have been unable to find any instances of this on any creatures (it is probably only used in the official campaign). A logical place for the nw_c3_waypoint3 script to go might be the OnCombatRoundEnd event.


Version

1.28

See Also

categories: Private Functions Functions


 author: Lilac Soul, editor: Charles Feduke, additional contributor(s): Lilac Soul