OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Kundich on 03 Jun 2005, 01:53:03
-
I'd like to write a script that can identify the nearestObject in the typeOf CIVILIAN cars. I really want it to be able to identify the whole class of vehicles, rather than each vehicle type individually, but I think I must work with an array, like:
_veh = ["RAPID","TRABANT","MINI","SKODA","SKODARED","SKODAGREEN","SKODABLUE","RAPIDY","TruckV3SCivil","JAWA"]
My problem is: I don't quite know where to take it from here and I've pulled out my last strands of hair. I know that I need to use PLAYER Distance _veh (not quite with that syntax, but you get the idea), but I am not sure how to call the nearest vehicle in the _veh array. Any thoughts?
Thanks,
ADM
-
This function should do exactly what you want:
http://ofpec.com/editors/funcref.php?filter_func=43
Alternatively, you could add each individual car (object, not class) to an array, and use this function to find it:
http://ofpec.com/editors/funcref.php?filter_func=48
-
Excellent. Took me a second to understand the dynamics, because I don't often use the SQF files, but I think I've got it.
Thanks for the help.
Thanks,
ADM