pcc 14 Posted September 4, 2011 Salvage trucks are not able to clear the wrecks fast enough. Is there a way to delete dead vehicles using the Init.sqf? I've tried ABANDONEDVEHICLETIME = 5; in Init_Common, but it doesn't work. Share this post Link to post Share on other sites
Gunter Severloh 4052 Posted September 4, 2011 DMZ Delete http://www.armaholic.com/page.php?id=14812 Share this post Link to post Share on other sites
KC Grimes 79 Posted September 4, 2011 Are you ediging a large, "commercial" map, such as Domination, Zargabad Life, or anything like that? If not, what is the mission you are editing? Give us some context. Your post really doesn't do much to help us solve the problem. Share this post Link to post Share on other sites
pcc 14 Posted September 4, 2011 I have just Arma 2. I made a warfare mission on Utes, using the warfare module. I found scripts that could get rid of dead bodies, but not vehicles. I have no vehicle units. The vehicles are spawned by vehicle factories. Share this post Link to post Share on other sites
Gunter Severloh 4052 Posted September 4, 2011 Delete Dead bodies and destroyed vehicles script Heres a script i personally use, works in Arma2, Arma2CO, and Arma3. Description (What it does) This will delete the dead bodies as well as vehicles. to set it up do the following: Trigger 1. In the editor place a circle trigger that will encompass the entire area that units and vehicles will be in. set the activation to anybody, and name the trigger wholeworld Scripts 2. create a script and name it: cleanup.sqf put the following in the script: /*private ["_delcode", "_currentworld", "_oldworld", "_newworld", "_notalive"]; _delcode = { private ["_crew"]; sleep 100; { if (not isNull _x) then { if (_x isKindOf "Ship" or _x isKindOf "Air" or _x isKindOf "LandVehicle") then { _crew = nearestObjects [_x, ["Man"], 20]; _crew = _crew + crew _x; deleteVehicle _x; { if (not alive _x) then {deleteVehicle _x}; } forEach _crew; } else { deleteVehicle _x; }; }; } forEach _this; }; _currentworld = []; while {true} do { sleep 3; _oldworld = _currentworld; _currentworld = + list wholeworld; _newworld = _oldworld - _currentworld; _notalive = []; { if (not alive _x) then {_notalive = _notalive + [_x]}; } forEach _newworld; if (count _notalive > 0) then {_notalive spawn _delcode}; };*/ while {true} do { sleep 10; { _sandGlass = _x getVariable "RYD_DeathTime"; if (isNil "_sandGlass") then { _x setVariable ["RYD_DeathTime",time] } else { if ((time - _sandGlass) > 60) then { deleteVehicle _x } } } foreach AllDead; }; Save the Script as Once you have posted the above code then save the script as: cleanup.sqf 3. Init script create an init script (use the same procedure as above as you did for the cleanup.sqf creating and naming) for this script name it: Init.sqf its already an SQF when you create a new SQF so just name it init. in the init script add this line: [] execVM "cleanup.sqf"; save. 4. Mission folder Place both cleanup.sqf and init scripts in your mission folder. =========================== Done. Now run your game and watch the dead bodies, and vehicles disappear. Note: in the cleanup script there is a timer which is the amount of time given before bodies delete, and vehicles disappear, look for this code: sleep 60; 60 means 60 seconds, so in 60 secs the bodies and vehicles will disappear you can make that a bigger number if you wish. hope that helps. Share this post Link to post Share on other sites
pcc 14 Posted September 4, 2011 Heres a script i personally use, works in Arma2 alone as well as OA and Arma2CO.this will delete the dead bodies as well as vehicles. to set it up do the following: trigger 1. in the editor place a circle trigger that will emcompass the entire area that units and vehilces will be in. set the activation to anybody, and name the trigger wholeworld scripts 2. create a script and name it: cleanup.sqf put the following in the script: private ["_delcode", "_currentworld", "_oldworld", "_newworld", "_notalive"]; _delcode = { private ["_crew"]; sleep 60; { if (not isNull _x) then { if (_x isKindOf "Ship" or _x isKindOf "Air" or _x isKindOf "LandVehicle") then { _crew = nearestObjects [_x, ["Man"], 20]; _crew = _crew + crew _x; deleteVehicle _x; { if (not alive _x) then {deleteVehicle _x}; } forEach _crew; } else { deleteVehicle _x; }; }; } forEach _this; }; _currentworld = []; while {true} do { sleep 3; _oldworld = _currentworld; _currentworld = + list wholeworld; _newworld = _oldworld - _currentworld; _notalive = []; { if (not alive _x) then {_notalive = _notalive + [_x]}; } forEach _newworld; if (count _notalive > 0) then {_notalive spawn _delcode}; }; 3. Init script create an init script and name it: init.sqf in this script add this line: [] execVM "cleanup.sqf"; done, now run your game and watch the dead bodies, and vehicles dissapear. note: in the cleanup script there is a timer which is the amount of time given before bodies delete, and vehicles dissapear, look for this code: sleep 60; 60 means 60 seconds, so in 60 secs the bodies and vehicles will disapear you can make that a bigger number if you wish. hope that helps, let me know if you have any questions. It works. Thank you, I really appreciate the help. Share this post Link to post Share on other sites
Gunter Severloh 4052 Posted September 4, 2011 Your welcome. Just some advice about posting in the forum here, when you are replying to a post such as mine it is not necessary to quote the entire post, if your responding to me and your the only one posting after then you can say what you need to say quotes arn't necessary. If however there was someone else posting after my post then all you would need to do is say @gunter and then put in what you wish to say. I dont mean to be picky about this sort of thing but quoting entire posts when your post is right after again isn't necessary, its not like I wont know that your responding to what I posted. outside of that there are other dead body, and vehicle deleting scripts you can use as well but the one I posted works pretty flawless. if however you wanted a body sinking into the ground effect, I do have another script that I use on occasion that can do that if you want. Share this post Link to post Share on other sites
pcc 14 Posted September 4, 2011 @gunter Is it possible to delete abandoned but not destroyed vehicles? Share this post Link to post Share on other sites
Gunter Severloh 4052 Posted September 4, 2011 Just post a reply, no need for @gunter. To answer your question, as far as I know if you have a script where a vehicle respawns somewhere then that script that does the respawn will remove the vehicle. I have such a script if you need it. Share this post Link to post Share on other sites
pcc 14 Posted September 4, 2011 I don't have the vehicles respawning. New vehicles are built from the vehicle factories. I was wondering how to add check if crew count = 0 and after some time vehicle gets deleted alone with the dead crew inside, to your cleanup script. I've noticed that dead bodies in vehicles are not deleted if the vehicle is not destroyed. Share this post Link to post Share on other sites
Gunter Severloh 4052 Posted September 4, 2011 Try it, as Idk for dead bodies in vehicles. Share this post Link to post Share on other sites
pcc 14 Posted September 5, 2011 if ((count crew _x == 0) and (damage _x > 0.1)) then { deleteVehicle _x ; } ; I've tried to integrate the above code into your code but still can't get rid of abandoned vehicles. :( Share this post Link to post Share on other sites
celery 8 Posted September 5, 2011 My Remove Dead script removes destroyed vehicles if you're playing OA or CO, link in sig. Share this post Link to post Share on other sites
pcc 14 Posted September 5, 2011 (edited) Thanks but I don't have OA. I'm trying to delete abandoned vehicles and dead crews now. Edit: I finally figured it out by adding the following code to init_common.sqf will delete abandoned vehicles. However if there are dead crews in the vehicle it won't work. //Time until an abandoned vehicle is removed. Set to 0 to never remove them. BIS_WF_Constants SetVariable["ABANDONEDVEHICLETIME",1]; Edited September 5, 2011 by pcc partial solution Share this post Link to post Share on other sites
Gunter Severloh 4052 Posted December 8, 2013 Code updated on post 6, it works for Arma3. I'll post it here: /*private ["_delcode", "_currentworld", "_oldworld", "_newworld", "_notalive"]; _delcode = { private ["_crew"]; sleep 100; { if (not isNull _x) then { if (_x isKindOf "Ship" or _x isKindOf "Air" or _x isKindOf "LandVehicle") then { _crew = nearestObjects [_x, ["Man"], 20]; _crew = _crew + crew _x; deleteVehicle _x; { if (not alive _x) then {deleteVehicle _x}; } forEach _crew; } else { deleteVehicle _x; }; }; } forEach _this; }; _currentworld = []; while {true} do { sleep 3; _oldworld = _currentworld; _currentworld = + list wholeworld; _newworld = _oldworld - _currentworld; _notalive = []; { if (not alive _x) then {_notalive = _notalive + [_x]}; } forEach _newworld; if (count _notalive > 0) then {_notalive spawn _delcode}; };*/ while {true} do { sleep 10; { _sandGlass = _x getVariable "RYD_DeathTime"; if (isNil "_sandGlass") then { _x setVariable ["RYD_DeathTime",time] } else { if ((time - _sandGlass) > 60) then { deleteVehicle _x } } } foreach AllDead; }; Thanks to Rydygier for his help in updating this. Share this post Link to post Share on other sites
eegore 11 Posted December 23, 2013 Is the above code supposed to have the slash / at the beginning? I call the script in the init file with the slash and without but all destroyed vehicles stay. Share this post Link to post Share on other sites
Gunter Severloh 4052 Posted December 23, 2013 Yes it is, make sure the cleanup.sqf is in your missions folder, and make sure you have a trigger covering the area that you want to cleanup, make sure it is named wholeworld, and set for anybody. Works for me np was just testing it this morning with a mission i was working on. Review post 6 to make sure you have everything setup correctly. Share this post Link to post Share on other sites
eegore 11 Posted December 23, 2013 Yeah it looks like I spelled the trigger name incorrectly. I thought since there was a slash rendering the text green in the script editor maybe it wasn't seeing that portion. Share this post Link to post Share on other sites
iceman77 18 Posted December 26, 2013 (edited) Here's probably the easiest method. Works in OA and arma3. init.sqf execVM "cleanup.sqf"; cleanup.sqf //delete any dead bodies and vehicles every 5 minutes. if (!isServer) exitWith {}; //Don't need clients to be running the script ... while {true} do { { deleteVehicle _x; } forEach allDead; sleep 60 * 5; }; Edited December 26, 2013 by Iceman77 Share this post Link to post Share on other sites
the_demongod 31 Posted February 25, 2014 I would like to execute the script all at once using a trigger instead of having it cycle repeatedly. Anybody know how I could do this? How could I make the script delete empty groups as well? I'm using Arma 3 btw. thanks, the_Demongod Share this post Link to post Share on other sites
st!gar 3 Posted March 15, 2016 Any way for the script to only delete the bodies of certain individuals? (ARMA 3). Share this post Link to post Share on other sites
sarogahtyp 1108 Posted March 18, 2016 For deleting dead bodies only I would assume to use allDeadMen instead off allDead. (Arma 3 only). "In Arma 3 when last unit leaves a group, the group gets auto deleted." as u can read here P.S.: Why not using Arma 3 scripting forum for Arma 3 questions? Share this post Link to post Share on other sites
That one Femboy 0 Posted June 8, 2022 On 9/4/2011 at 2:39 AM, Gunter Severloh said: Delete Dead bodies and destroyed vehicles script Heres a script i personally use, works in Arma2, Arma2CO, and Arma3. Description (What it does) This will delete the dead bodies as well as vehicles. to set it up do the following: Trigger 1. In the editor place a circle trigger that will encompass the entire area that units and vehicles will be in. set the activation to anybody, and name the trigger wholeworld Scripts 2. create a script and name it: cleanup.sqf TOOL A good tool for creating scripts: Armaedit http://www.armaholic.com/page.php?id=1455&highlight=ARMAEDIT With Armaedit, once you start it up, do the following to create a new script: a. Go to file (top left) b. choose new file c. choose Function File (SQF) once this is done a blank page is created, from here put the following in the script: /*private ["_delcode", "_currentworld", "_oldworld", "_newworld", "_notalive"]; _delcode = { private ["_crew"]; sleep 100; { if (not isNull _x) then { if (_x isKindOf "Ship" or _x isKindOf "Air" or _x isKindOf "LandVehicle") then { _crew = nearestObjects [_x, ["Man"], 20]; _crew = _crew + crew _x; deleteVehicle _x; { if (not alive _x) then {deleteVehicle _x}; } forEach _crew; } else { deleteVehicle _x; }; }; } forEach _this; }; _currentworld = []; while {true} do { sleep 3; _oldworld = _currentworld; _currentworld = + list wholeworld; _newworld = _oldworld - _currentworld; _notalive = []; { if (not alive _x) then {_notalive = _notalive + [_x]}; } forEach _newworld; if (count _notalive > 0) then {_notalive spawn _delcode}; };*/ while {true} do { sleep 10; { _sandGlass = _x getVariable "RYD_DeathTime"; if (isNil "_sandGlass") then { _x setVariable ["RYD_DeathTime",time] } else { if ((time - _sandGlass) > 60) then { deleteVehicle _x } } } foreach AllDead; }; Save the Script as Once you have posted the above code then save the script as: cleanup.sqf 3. Init script create an init script (use the same procedure as above as you did for the cleanup.sqf creating and naming) for this script name it: Init.sqf its already an SQF when you create a new SQF so just name it init. in the init script add this line: [] execVM "cleanup.sqf"; save. 4. Mission folder Place both cleanup.sqf and init scripts in your mission folder. =========================== Done. Now run your game and watch the dead bodies, and vehicles disappear. Note: in the cleanup script there is a timer which is the amount of time given before bodies delete, and vehicles disappear, look for this code: sleep 60; 60 means 60 seconds, so in 60 secs the bodies and vehicles will disappear you can make that a bigger number if you wish. hope that helps, let me know if you have any questions. I'm kinda dumb af and can't find "mission folder" unless you mean the folders named missions/mpmissions or its one of the currater_mission_f folders or idk.. to say I'm new to this.. is an understatement Share this post Link to post Share on other sites
Gunter Severloh 4052 Posted June 8, 2022 9 hours ago, That one Femboy said: can't find "mission folder" unless you mean the folders named missions/mpmissions or its one of the currater_mission_f folders or idk Welcome to BI forums! By mission folder i mean the folder that was created when you saved your mission in the editor. So basically the scripts need to be moved into your mission folder, for Arma 2OA that would be here C:\Users\your username\Documents\ArmA 2\missions Look for a folder with the name of your mission then move the scripts inside it. Share this post Link to post Share on other sites