Jump to content
AdirB

deleteVehicle won't working

Recommended Posts

Hello,

I made fire and black smoke effect script and the creation is perfect but when I trying to delete it after 30 (sleep 30;) it's not working.

 

The fire and the smoke starts with a trigger that has this code in its init;

nul = [this] execVM "tiresignal\create_bridge.sqf"

The creation codes are:

 

create_bridge.sqf:

 ["tiresignal\createfire.sqf","BIS_fnc_execVM",true,true] spawn BIS_fnc_MP;

 

createfire.sqf:

hint "Fire and smoke has been started.";
sleep 5;
hint "";

fireb1 = "test_EmptyObjectForFireBig" createVehiclelocal position fire1;
fireb2 = "test_EmptyObjectForFireBig" createVehiclelocal position fire2;
fireb3 = "test_EmptyObjectForFireBig" createVehiclelocal position fire3;
fireb4 = "test_EmptyObjectForFireBig" createVehiclelocal position fire4;

sleep 30;
nul = [this] execVM "tiresignal\delete_bridge.sqf";

I'm using the hints for the knowledge if the script is working and it's working.

The problem is with the destruction.

 

Destruction codes are:

 

delete_bridge.sqf:

["tiresignal\deletefire.sqf","BIS_fnc_execVM",true,true] spawn BIS_fnc_MP;

 

deletefire.sqf:

hint "Fire and smoke has been stopped.";
sleep 5;
hint "";

deleteVehicle fireb1;
deleteVehicle fireb2;
deleteVehicle fireb3;
deleteVehicle fireb4;

 

Why can't I delete the fire? Please help.

Thanks :)

Share this post


Link to post
Share on other sites

When you create a "test_EmptyObjectForFireBig" an empty object is created as well as several objects for the effects (fire particle, smoke particle, some lights etc).

These effect objects are stored on the "test_EmptyObjectForFireBig" in a variable called "effects".

When you delete the "test_EmptyObjectForFireBig" all you are deleting is the empty object but you are leaving the effect objects behind.

To delete them you need to query the "effects" variable on the "test_EmptyObjectForFireBig" and delete them along with "test_EmptyObjectForFireBig". e.g

deletefire.sqf

hint "Fire and smoke has been stopped.";
sleep 5;
hint "";

{
	{
		//delete each effect
		deleteVehicle _x;
	}forEach ( _x getVariable [ "effects", [] ] ) + [ _x ]; //effects plus "test_EmptyObjectForFireBig"
}forEach [ fireb1, fireb2, fireb3, fireb4 ];

Share this post


Link to post
Share on other sites

When you create a "test_EmptyObjectForFireBig" an empty object is created as well as several objects for the effects (fire particle, smoke particle, some lights etc).

These effect objects are stored on the "test_EmptyObjectForFireBig" in a variable called "effects".

When you delete the "test_EmptyObjectForFireBig" all you are deleting is the empty object but you are leaving the effect objects behind.

To delete them you need to query the "effects" variable on the "test_EmptyObjectForFireBig" and delete them along with "test_EmptyObjectForFireBig". e.g

deletefire.sqf

hint "Fire and smoke has been stopped.";
sleep 5;
hint "";

{
	{
		//delete each effect
		deleteVehicle _x;
	}forEach ( _x getVariable [ "effects", [] ] ) + [ _x ]; //effects plus "test_EmptyObjectForFireBig"
}forEach [ fireb1, fireb2, fireb3, fireb4 ];

Thank you, It worked! :)

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

×