IRONFRONT FANS FORUM
Register Latest Topics
 
 
 


Reply
  Author   Comment  
Gunter Severloh

Avatar / Picture

Admin
Registered:
Posts: 2,749
Reply with quote  #1 
Download:
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:

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...light=ARMAEDIT
note you can use notepad too but dont save the notepad til you have added the
code and named it with the script name.

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:
Code:
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 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:
 
Code:
[] execVM "cleanup.sqf";

save.

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.

__________________
0
Gunter Severloh

Avatar / Picture

Admin
Registered:
Posts: 2,749
Reply with quote  #2 
Script is now hosted on the MR, comes with readme, link added to the first post for download.
__________________
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.