Welcome to the Iron Front Fan Forums!
Sign up Latest Topics

  Author   Comment  
Gunter Severloh

Avatar / Picture

Posts: 2,759
Reply with quote  #1 
Delete Dead bodies and destroyed vehicles

Delete Dead bodies and destroyed vehicles script

Heres a script i personally use, works in Arma2 alone as well as OA and Arma2CO, and Iron Front.

Description (What it does)
This will delete the dead bodies as well as vehicles.
to set it up do the following:

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

2. create a text document and name it:


Copy and paste the following code 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};

Save the Script as
Once you have posted the above code then make sure to save the script as:

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:

in the init script add this line:
[] execVM "cleanup.sqf";

4. Mission folder
Place both cleanup.sqf and init scripts in your mission folder.

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.

Gunter Severloh

Avatar / Picture

Posts: 2,759
Reply with quote  #2 
Script is hosted on the MR, comes with readme, link added to the first post for download.
Previous Topic | Next Topic

Quick Navigation:

Easily create a Forum Website with Website Toolbox.