Jump to content
Sign in to follow this  
alleycat

Add evenhandlers to vehicles?

Recommended Posts

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

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
{
       (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

Oh right, totally forgot about that one. :)

Larrows solution should work just fine.

Share this post


Link to post
Share on other sites

What does vehicles contain if not actual vehicles? :Oo:

Share this post


Link to post
Share on other sites
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 by kylania

Share this post


Link to post
Share on other sites

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×