OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: SpawnFodder on 31 May 2005, 10:01:38

Title: how to get the nearest unit to the player?
Post by: SpawnFodder on 31 May 2005, 10:01:38
i have been trying to find a way to get a script to detect the nearest enemy unit to the player, and ideally the nearest unit of a certain type.  does anyone know of a command to do this.  the nearest i have found was the nearestobject command, but that doesnt seem to work on units.
Title: Re:how to get the nearest unit to the player?
Post by: voodzia on 31 May 2005, 11:14:32
You need command distance for that. Check official command reference for more info.
Title: Re:how to get the nearest unit to the player?
Post by: General Barron on 31 May 2005, 12:32:12
Try this function here:

http://ofpec.com/editors/funcref.php?filter_func=48
Title: Re:how to get the nearest unit to the player?
Post by: SpawnFodder on 31 May 2005, 18:01:26
that function was the kind of thing i was looking for

thanks