alleycat 28 Posted October 9, 2013 I would like to attach an event handler to all vehicles on the map (empty or crewed). However when doing this { _x addMPEventHandler ["MPHit",{_this execVM "server\vehicle_hit.sqf";}]; } forEach vehicles; it only fires if the vehicle has units in it and all damage or other stats relate to the unit and not the vehicle itself. Share this post Link to post Share on other sites
Tajin 349 Posted October 9, 2013 Would be interesting to see what that "vehicles" Array contains, or how you build it. Share this post Link to post Share on other sites
kylania 568 Posted October 9, 2013 It's a core command: vehicles Share this post Link to post Share on other sites
Larrow 2822 Posted October 9, 2013 { (vehicle _x) addMPEventHandler ["MPHit",{_this execVM "server\vehicle_hit.sqf";}]; } forEach vehicles; The actual vehicle of _x, seems to work ok from a quick test Share this post Link to post Share on other sites
kylania 568 Posted October 9, 2013 Yo dawg, I herd you lik vehicles! Share this post Link to post Share on other sites
Tajin 349 Posted October 9, 2013 Oh right, totally forgot about that one. :) Larrows solution should work just fine. Share this post Link to post Share on other sites
cuel 25 Posted October 9, 2013 What does vehicles contain if not actual vehicles? :Oo: Share this post Link to post Share on other sites
kylania 568 Posted October 9, 2013 (edited) What does vehicles contain if not actual vehicles? :Oo: [b Alpha 1-1:2,3504d600# 163948: truck_01_covered_f.p3d,34ff8100# 163949: offroad_01_unarmed_f.p3d] (vehicles select 2) setdamage 1 blows up the offroad. The first entry was a Hunter manned. This worked for both manned and unmanned vehicles: {_x addAction ["Dump Fuel", {_this select 0 setFuel 0}];} forEach vehicles; Edited October 9, 2013 by kylania Share this post Link to post Share on other sites
blackmamb 2 Posted October 9, 2013 Looks like it returns the same kind of stuff as triggers. Which are actually kinda tricky when it comes to vehicles. Reminds me of this. Share this post Link to post Share on other sites