Jump to content
Sign in to follow this  
doomanchu

Delete Vehicle When Destroyed

Recommended Posts

Wanting to clean up specific vehicles by running a script in their int line. I'm trying to use the following, but don't think I'm executing it correctly (or maybe the script itself is wrong?).

Vehicle int line:

[] execVM "delete.sqf";

delete.sqf

_vehicle = _this select 0;

waitUntil {!alive _vehicle};
sleep 30;
deleteVehicle _vehicle;

EDIT:

Maybe I need to use an event handler?

delete = this addEventHandler ["Dammaged", {_this execvm 'delete.sqf'}]

or

delete = this addEventHandler ["Killed", {_this execvm 'delete.sqf'}]

Edited by doomanchu

Share this post


Link to post
Share on other sites

you dont even need a script for this. into the vehicle's init line goes:

this addEventHandler ["Killed",{(_this select 0) spawn {sleep 30; deleteVehicle _this}}]

However, what went wrong with your try is the call of the script in the init line, must be:

_nul = [this] execVM "delete.sqf"

Share this post


Link to post
Share on other sites
you dont even need a script for this. into the vehicle's init line goes:

this addEventHandler ["Killed",{(_this select 0) spawn {sleep 30; deleteVehicle _this}}]

HI.. i try it but this code wont be accepted. Editor say missing )......

However, what went wrong with your try is the call of the script in the init line, must be:

_nul = [this] execVM "delete.sqf"

I tryed this too with the DeleteVehicle.sqf from above but it dont work too

Can somebody help?

Thx

Claus

Share this post


Link to post
Share on other sites

Hey mate.... Bon's code is fine...you should have no problem with that.

There is a little test here to show that it does work.

I added a bit to it to delete the crew as well if they are left in the vehicle either fried or frying!

Share this post


Link to post
Share on other sites
Hey mate.... Bon's code is fine...you should have no problem with that.

There is a little test here to show that it does work.

I added a bit to it to delete the crew as well if they are left in the vehicle either fried or frying!

Yes, this solved my problem!

this addEventHandler ["Killed",{(_this select 0) spawn {sleep 30; deleteVehicle _this}}]

Share this post


Link to post
Share on other sites
Yes, this solved my problem!

this addEventHandler ["Killed",{(_this select 0) spawn {sleep 30; deleteVehicle _this}}]

AH.. THX alot... now i found the failure... i typed in this "()" Letters instead of this {}

Thanks to U all....

Oh by the way.. is this Function also usable on Bots who patroling in our Base ???

Claus

EDIT: i ve checked it in my map.. the Botavengers who patrolling in base only the first time will be deleted.. after respawming the wreck is present and dont be deleted anymore... how can i solve this ?

Edited by weroedv

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  

×