Jump to content
Sign in to follow this  
ryansoper

Detecting when a Vehicle is destroyed?

Recommended Posts

How can i detect when a specific vehicle is destroyed?

I want to be able deduct cash from the relevant player for the destruction of their vehicle.

Thanks,

Ryan

Share this post


Link to post
Share on other sites

depending on the situation, this condition may also come in handy:

({alive _x} count crew [i]vehiclename[/i] == 0) 

sometimes AI dismount from a vehicle that was damaged, but not fully destroyed, so this condition is met if there's no alive unit in the given vehicle.

Share this post


Link to post
Share on other sites
depending on the situation, this condition may also come in handy:

({alive _x} count crew [i]vehiclename[/i] == 0) 

sometimes AI dismount from a vehicle that was damaged, but not fully destroyed, so this condition is met if there's no alive unit in the given vehicle.

I'm still pretty new to SQF, how exactly would I use that bit of script? In a trigger Activation?

Share this post


Link to post
Share on other sites

you can put that line in the condition field of a trigger. This is the easier option if you are not so comfortable with .sqf yet.

if you want to use this in a .sqf script (-> would have to be checked in a loop), it will have to look like this:

if ({alive _x} count crew [i]vehiclename[/i] == 0) then {[i]code to deduct cash from the player[/i]};

i would recommend you use the trigger option for starters, as the sqf version would need some further adjustments, like making sure the player's cash is only deducted once etc.

Edited by Mad_Cheese

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  

×