Jump to content
Sign in to follow this  
thedubl

Detach test_EmptyObjectForSmoke

Recommended Posts

Hello, Why can't I detach the smoke effect? I saw some post about particle effects and that in a later update it could be done. These posts were 2013. Any ideas?

 

//creates my crashed plane

_veh = createVehicle ["Land_Wreck_Plane_Transport_01_F",_arrPos, [], 0, "NONE"];     
_smoke1= "test_EmptyObjectForSmoke" createVehicle position _veh; _smoke1 attachTo[_veh,[0,1.5,-1]];
_veh setVehicleVarName "crashedPlane"; crashedPlane = _veh;

 

deleteVehicle CrashedPlane;

detach _smoke1; //this does not work...meh!

 

thanks,

dubl

 

 

Share this post


Link to post
Share on other sites

Thanks, this is what was done.

 

//creates my crashed plane

_veh = createVehicle ["Land_Wreck_Plane_Transport_01_F",_arrPos, [], 0, "NONE"];     
_smoke1= "test_EmptyObjectForSmoke" createVehicle position _veh; _smoke1 attachTo[_veh,[0,1.5,-1]];
_veh setVehicleVarName "crashedPlane"; crashedPlane = _veh;

 

_emitterArray = _smoke1 getVariable "effects";
{deleteVehicle _x} forEach _emitterArray;
deleteVehicle _smoke1;

 

deleteVehicle CrashedPlane;

Share this post


Link to post
Share on other sites

Worked great in the editor and sample mission, not on the server though. So, I guess I will try using the actual example in the link provided.

 

Thanks,

dubl

 

Here is the sample/test.

recovery.sqf

 

/*************************************************************
Recovery

Setup (Place in the initserver): null = [] execVM "scripts\recovery.sqf"

fire = test_EmptyObjectForFireBig
smoke = test_EmptyObjectForSmoke

trigger condition:
{[thistrigger,_x] call bis_fnc_intrigger and (getposatl _x select 2 <1)} count [box1,box2,box3,box4] == 4
*************************************************************/

"Crash Site Start" remoteExec ["hint", -2];
sleep 2;

//array position pool...Currently spawns next to player.
//_arrPos = position player;

_arrPos =[[11555.5,11738.3]]call BIS_fnc_selectRandom; // find some intertesting spots


//Crashed Plane
_veh = createVehicle ["Land_Wreck_Plane_Transport_01_F",_arrPos, [], 0, "NONE"];

_smoke1 = "test_EmptyObjectForSmoke" createVehicle position _veh; _smoke1 attachTo[_veh,[0,1.5,-1]]; //old
_veh setVehicleVarName "crashedPlane"; crashedPlane = _veh;


//Burning hunter
_pos = [(getpos _veh select 0) + 10, (getpos _veh select 1) + 60, 0]; //offset spwan based off crashed plane
_veh1 = createVehicle ["Land_Wreck_Hunter_F", _pos , [], 0, "NONE"];
_smoke2 = "test_EmptyObjectForSmoke" createVehicle position _veh1; _smoke2 attachTo[_veh1,[0,1.5,-1]];//old
_veh1 setVehicleVarName "crashedHunter"; crashedHunter = _veh1;



//create some objects to collect

_pos1 = [(getpos _veh select 0) + 25, (getpos _veh select 1) + 50, 0];
_b1 = createVehicle ["B_CargoNet_01_ammo_F", _pos1 , [], 0, "NONE"];
_b1 setVehicleVarName "box1"; box1 = _b1; //give the object a name...might need names later

_pos2 = [(getpos _veh select 0) + 40, (getpos _veh select 1) + 30, 0];
_b2 = createVehicle ["B_CargoNet_01_ammo_F", _pos2 , [], 0, "NONE"];
_b2 setVehicleVarName "box2"; box2 = _b2;

_pos3 = [(getpos _veh select 0) + 25, (getpos _veh select 1) + 75, 0];
_b3 = createVehicle ["B_CargoNet_01_ammo_F", _pos3 , [], 0, "NONE"];
_b3 setVehicleVarName "box3"; box3 = _b3;

_pos4 = [(getpos _veh select 0) + 5, (getpos _veh select 1) + 20, 0];
_b4 = createVehicle ["B_CargoNet_01_ammo_F", _pos4 , [], 0, "NONE"];
_b4 setVehicleVarName "box4"; box4 = _b4;

//set the mission global variables so we can use the object name
_missionVar1 = missionNamespace setVariable ["box1",_b1];
_missionVar2 = missionNamespace setVariable ["box2",_b2];
_missionVar3 = missionNamespace setVariable ["box3",_b3];
_missionVar4 = missionNamespace setVariable ["box4",_b4];

//creates marker
_markercrash = createMarker ["crashSite", _arrPos];
_markercrash setMarkerShape "ELLIPSE";
_markercrash setMarkerSize [550,550];
_markercrash setMarkertype "mil_unknown";
_markercrash setMarkerText "Crash Site";
_markercrash setMarkerColor "ColorUNKNOWN";



waitUntil { (!alive _b1) && (!alive _b2)&& (!alive _b3)&& (!alive _b4)}; //waits until the boxes are removed. then removes the the crash site and markers.

_emitterArray = _smoke1 getVariable "effects";
{deleteVehicle _x} forEach _emitterArray;
deleteVehicle _smoke1;


_emitterArray = _smoke2 getVariable "effects";
{deleteVehicle _x} forEach _emitterArray;
deleteVehicle _smoke2;


deleteVehicle CrashedPlane;
deleteVehicle CrashedHunter;

deleteMarker "crashSite";

 

On Act in the trigger calls this script to remove the collect ammo crates.


sleep 10;

//remove boxes

_bo1 = missionNamespace getVariable ["box1", objNull];
_bo2 = missionNamespace getVariable ["box2", objNull];
_bo3 = missionNamespace getVariable ["box3", objNull];
_bo4 = missionNamespace getVariable ["box4", objNull];



deleteVehicle _bo1;
deleteVehicle _bo2;
deleteVehicle _bo3;
deleteVehicle _bo4;


Share this post


Link to post
Share on other sites

Using example three did work as expect on the server. Thanks!

 

dubl

Share this post


Link to post
Share on other sites

I guess I spoke to soon. This in the drone script. When player approaches there is a action. At the end of the script called with the action I set the damage to 1 blowing it up. Do I need to attach the smoke or effect with in the spawn?

 

 

_veh setVehicleVarName "drone";drone = _veh;//give the vehicle a name
_drone1 = missionNamespace setVariable ["drone",_veh];

_smoke = "test_EmptyObjectForSmoke" createVehicle position _veh; _smoke attachTo[_veh,[0,1.5,-1]];

/****************************************************************
function to delete smoke
****************************************************************/
fnc_deleteObj = {
_this addMPEventHandler ["MPKilled", {
_this = _this select 0;
{
deleteVehicle _x;
} forEach (_this getVariable ["effects", []]);
if (isServer) then {
deleteVehicle _this;
};
}];
_this setDamage 1;
};


/******Call the function*********/
[] spawn {

_smoke call fnc_deleteObj;

};

Share this post


Link to post
Share on other sites

Thanks for pointing out that in my face issue.Clearly wasn't my shining moment. Ok, this is where my knowledge is reaching its limit. Since i want to pass the _smoke to the function will the bit below from the wiki still apply?

 

https://community.bistudio.com/wiki/Function

Spawn

Functions may also be executed using spawn, but then the function result is not accessible, making it behave more like a procedure. Spawned functions will run asynchronously or alongside the executing instance. This helps prevent large CPU intensive functions from seizing up the game.

Example (Armed Assault):

_param spawn myFunction1;

 

 

Since these needs to be running along side, but I really do not want to define _smoke and for that matter everything else needed to get the smoke attach to the vehicle in the [] spawn. I was thinking of using _smoke spawn fnc_deleteObj; .  In example 3 ( https://community.bi...i/deleteVehicle)

the spawn is using call. Seems to me that they both achieve the same thing with keeping the processing to a minimum. I haven't tried it yet, but I will tonight. I just happen to think about it and figured I would post it up and maybe someone else might have more to add or educate the ignorant.

 

Thanks,

dubl

Share this post


Link to post
Share on other sites

_smoke1= "test_EmptyObjectForSmoke" createVehicle position _veh; 

 

then

 

_smoke1 spawn {

sleep 1;

_this call fnc_deleteObj;

};

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  

×