Home   Help Search Login Register  

Author Topic: Help: TypeOf To Select Nearest Unit in Class...  (Read 502 times)

0 Members and 3 Guests are viewing this topic.

Offline Kundich

  • Members
  • *
  • "Habit is the daily battleground of character."
Help: TypeOf To Select Nearest Unit in Class...
« 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

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Help: TypeOf To Select Nearest Unit in Class...
« Reply #1 on: 03 Jun 2005, 02:03:38 »
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
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

Offline Kundich

  • Members
  • *
  • "Habit is the daily battleground of character."
Re:Help: TypeOf To Select Nearest Unit in Class...
« Reply #2 on: 03 Jun 2005, 03:17:26 »
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