OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: JasonO on 16 May 2007, 19:52:08
-
Hey
I have a part of a mission where I must approach a few vehicles, and I need to check the vehicle's type from an array (well it's all land vehicles like cars, trucks and tanks etc) and if i'm at a certain distance I can continue.
Is there an easy way to check if the vehicle is a land vehicle without having each type in an array? If not then I'll just write an array myself. But after that how would I do a simple check to see if a vehicle of a type in that array is within say 25 meters.
Thanks for your help :)
-
myCar isKindOf "LandVehicle"
You will need an array with all the other vehicles in it to use this:
({(myCar distance _x) < dist} count vehicleArray) > 0
You can make the vehicleArray in your init.sqf or you can place a trigger that covers all the vehicles in question, set it to side present once. In the On Activation:
vehicleArray = [] ; {if (_x isKindOf "LandVehicle") then {vehicleArray = vehicleArray + [_x]}} forEach thislist ; if (myCar in vehicleArray) then {vehicleArray = vehicleArray - [myCar]}