Jump to content
Sign in to follow this  
celery

CLY Remove Dead script

Recommended Posts

Hi there! I'm trying this script but I can't seem to make it work. I did follow the instructions.

1. I made a cly_removedead.sqs file in my single player mission folder and pasted the script inside in the proper format.

2. In the game, I placed [1,1] exec "cly_removedead.sqs"; in one of the soldier's init boxes (I want them to disappear after 1 second).

2. I started the game, watched my soldiers kill some zombies, but their bodies won't disappear :(

Thanks in advance for any help!

Share this post


Link to post
Share on other sites

Did you put the script in Documents\Arma 2 other profiles\Adeno\missions\missionname?

Share this post


Link to post
Share on other sites

Hi, yes I did. It's the first thing I did :(

Additional: I also tried this to see if it would work but it didn't -> ["1","1"] exec "cly_removedead.sqs"; so I went back to using the normal one without quotes on the numbers.

I also placed it in a soldier first, then saved the game, reloaded the editor, then previewed. Still the same, bodies still stayed :(

Oh yeah I only have vanilla Arma 2, it works for that game right?

Oh uhm another question, how come your script is "SQS" when most of the other scripts are "SQF"? Do they have a difference?

Thanks again!

Edited by Adeno

Share this post


Link to post
Share on other sites

Rather than put this in a soldier's init line you need to put it into the init.sqf file. The original way you had it, i.e.

[120,240] exec "cly_removedead.sqs";

An sqs file is the older format of script, and sqf is the newer format. You can still use sqs files though.

Share this post


Link to post
Share on other sites

Are you using Undead mod zombies? Do me a favor and put hintSilent format ["%1",this isKindOf "Man"] in a zombie's init and say if it shows true or false. Also, have -showScriptErrors in your Arma 2 shortcut parameters and see if there is any error output.

Share this post


Link to post
Share on other sites

I don't mean to sound like a jerk, but I worked really hard on a mission and one day it started getting so laggy to the point where it was unplayable. For over a week I kept trying to figure out what was causing the problem and how to fix it. I lost a lot of sleep and was ready to just scrap the mission and all the work I put into it, then I tried to remember what things I last added to the mission before it became so laggy. I kept thinking that it couldn't be your remove body/vehicles script, because that is supposed to make the mission less laggy, but then I finally removed it from the mission and suddenly my mission was completely lag free. I don't know if anybody else has had this experience. Maybe there is something else in my mission that is conflicting with it. I don't know. Right now I am once again trying to find a good "remove dead bodies/vehicles" script and so far I haven't found a good one. I think my computer just hates sqs files, lol. I wish your script worked for me.

Share this post


Link to post
Share on other sites

Script updated

- Rewrote the script in sqf (exec "cly_removedead.sqs" -> execVM "cly_removedead.sqf")

- Added support for vanilla Arma 2

- Probably fixed some issues

Share this post


Link to post
Share on other sites

Works great. No sqs lag this time, lol. I set it to delete dead AI after 3 minutes and vehicles after 10 minutes (180 & 600). Thank you very much Celery. Now my mission won't look like a corpse ridden junkyard.

Share this post


Link to post
Share on other sites

Script updated!

  • An option to prevent the removal of units with any or specific gear has been added, instructions in script
  • hideBody is now used on units at all altitudes, leaking through floors is prevented by deleting the unit the moment it starts doing so

Share this post


Link to post
Share on other sites

Hey, i have a problem that might be up your alley:

I want a way to remove the debris left behind from chopper/aircraft crashes.

Not the vehicle itself (domination already takes care of that :)), but the heap of dirt that remains there forever.

Those really p*ss me off when they're on the runway (aswell my ai, who refuse to taxi over them).

I'm a beginner at scripting, but can probably figure it out, i just have no idea what the classnames are of that dirt. Could you please point me in the right direcetion?

And sorry for going slightly offtopic here :P

Share this post


Link to post
Share on other sites

The classname is "CraterLong". :)

You can probably do a crater removal thing by placing a trigger, setting condition as true and putting 0=thisTrigger spawn {while {true} do {sleep 10;{deleteVehicle _x} forEach (getPos _this nearObjects ["CraterLong",(triggerArea _this select 0) max (triggerArea _this select 1)])}} in its activation field and copying the trigger to everywhere you want to keep clean. The cleaned area is dependent on the trigger's, but only a perfect circle represents it.

Edited by Celery

Share this post


Link to post
Share on other sites

Hi, sorry for the massive bump but I'm in need of some help.

It appears that my script isn't working properly, I'm running this alongside DayZ and the problem is that dead bodies with excluded gear from removal still disappear.

This is my init.sqf

startLoadingScreen ["","DayZ_loadingScreen"];
enableSaving [false, false];

dayZ_instance = 1;	//The instance
hiveInUse	=	true;
initialized = false;
dayz_previousID = 0;
dayz_hiveVersionNo = 1;

[600,0,true] execVM "cly_removedead.sqf";


call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\variables.sqf";				//Initilize the Variables (IMPORTANT: Must happen very early)
progressLoadingScreen 0.1;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\publicEH.sqf";				//Initilize the publicVariable event handlers
progressLoadingScreen 0.2;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\medical\setup_functions_med.sqf";	//Functions used by CLIENT for medical
progressLoadingScreen 0.4;
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";				//Compile regular functions
progressLoadingScreen 1.0;

if (isServer) then {
hiveInUse = true;
_serverMonitor = [] execVM "\z\addons\dayz_server\system\server_monitor.sqf";
};
if (!isDedicated) then {
0 fadeSound 0;
0 cutText [(localize "STR_AUTHENTICATING"), "BLACK FADED",60];
_id = player addEventHandler ["Respawn", {_id = [] spawn player_death;}];
_playerMonitor = 	[] execVM "\z\addons\dayz_code\system\player_monitor.sqf";
_anticheat = [] spawn {execFSM "cdetect.fsm";};

// Create burn effect for each helicopter wreck
_helis = allMissionObjects "UH1Wreck_DZ";
{
	nul = [_x, 2, time, false, false] spawn BIS_Effects_Burn;
} forEach _helis;
};

// atv
//non-JIP player, someone who's went through role selection and briefing
if (!(isNull player)) then 
{
// =============================================================
// GeneralCarver Vehicle Flip Script v2 Init Scripting

gc_veh_flip_script_script_action_manager = execVM "scripts\gc_veh_flip\action_manager.sqf";

//
// =============================================================
};

//JIP player, role selection then right into mission.
if (!isServer && isNull player) then 
{
waitUntil {!isNull player};

// =============================================================
// GeneralCarver Vehicle Flip Script v2 Init Scripting

gc_veh_flip_script_script_action_manager = execVM "scripts\gc_veh_flip\action_manager.sqf";

//
// =============================================================
};

//server
if (isServer) then 
{
};

This is my cly_removedead.sqf

/*
CLY Remove Dead by Celery
Removes dead units and vehicles from the battlefield.
Version 2011.10.28

The script is less functional in plain Arma 2 because it lacks the allDead command. In plain Arma 2 the script...
- is probably a little heavier
- doesn't remove vehicles or animals
- lacks the hideBody transition due to its bugged nature in Arma 2 Free

Execute in init script:
[60,0,true] execVM "cly_removedead.sqf";
[wait time for men,wait time for vehicles,remove units with gear (optional, default true)] execVM "cly_removedead.sqf";
A wait time of 0 prevents that type from being removed.
Prevent an individual unit from being removed:  this setVariable ["CLY_removedead",false,true]
Remove an individual unit immediately upon death:  this setVariable ["CLY_removedead",true,true]

Use the CLY_ignoregear array to define gear classnames that don't prevent a unit's removal when only gearless bodies are removed.
Alternatively, use CLY_keepgear to define gear that prevents removal when geared unit removal is enabled.
Remember correct upper and lower case in classnames or it won't work! Check config browsers if not sure.
*/

if (!isServer) exitWith {};

CLY_ignoregear=[];
CLY_keepgear=["NVGoggles","DZ_Backpack_EP1","BAF_AS50_scoped","BAF_L85A2_RIS_CWS","ItemGPS","M107_DZ","DMR","M14_EP1","Binocular_Vector","SVD_Camo","M4A3_CCO_EP1","FN_FAL","FN_FAL_ANPVS4","M4A1_AIM_SD_camo","m16a4_acg","M4A1_HWS_GL_camo","Mk_48_DZ","M249_DZ","M24"];
CLY_noremovegear=["NVGoggles","DZ_Backpack_EP1","BAF_AS50_scoped","BAF_L85A2_RIS_CWS","ItemGPS","M107_DZ","DMR","M14_EP1","Binocular_Vector","SVD_Camo","M4A3_CCO_EP1","FN_FAL","FN_FAL_ANPVS4","M4A1_AIM_SD_camo","m16a4_acg","M4A1_HWS_GL_camo","Mk_48_DZ","M249_DZ","M24"];
_oa=isClass (configFile/"CfgPatches"/"CA_E");

_manwait=_this select 0;
_vehiclewait=if (count _this>1) then {_this select 1} else {_manwait};
CLY_removegeared=if (count _this>2) then {_this select 2} else {true};
CLY_removedeadpending=[];
CLY_dontremovedead=[];
CLY_dontremovedeadremove=[];
publicVariable "CLY_dontremovedeadremove";

//Spawnable script
_removedead={
_unit=_this select 0;
_wait=_this select 1;
sleep _wait;
waitUntil {isNull flag _unit};
_gear=if (_unit isKindOf "Man") then {(magazines _unit+weapons _unit)-CLY_ignoregear} else {[]};
if (isNull _unit or _unit in CLY_dontremovedead or (CLY_removegeared and {_x in CLY_keepgear} count _gear>0) or (!CLY_removegeared and count _gear>0)) exitWith {
	CLY_removedeadpending=CLY_removedeadpending-[_unit];
};
if (_unit isKindOf "Man" and isClass (configFile/"CfgPatches"/"CA_E")) then {
	hideBody _unit;
	_removetime=time+8;
	while {getPos _unit select 2<0.2 and time<_removetime} do {sleep 0.1};
};
CLY_removedeadpending=CLY_removedeadpending-[_unit];
deleteVehicle _unit;
};

//Loop
_allunits=[];
_alldead=[];
while {true} do {
if (!_oa) then {_allunits=allUnits};
sleep 1;
if (!_oa) then {
	{if (!alive _x) then {_alldead set [count _alldead,_x]}} forEach _allunits;
	{if (isNull _x) then {_alldead=_alldead-[_x]}} forEach _alldead;
} else {_alldead=allDead};
{
	if (isNil {_x getVariable "CLY_removedead"}) then {
		if !(_x in CLY_removedeadpending) then {
			_wait=if (_x isKindOf "Man") then {_manwait} else {_vehiclewait};
			_gear=if (_x isKindOf "Man") then {(magazines _x+weapons _x)-CLY_ignoregear} else {[]};
			if (_wait>0 and ((CLY_removegeared and {_x in CLY_keepgear} count _gear==0) or (!CLY_removegeared and count _gear==0))) then {
				[_x,_wait] spawn _removedead;
				CLY_removedeadpending set [count CLY_removedeadpending,_x];
			};
		};
	} else {
		if (_x getVariable "CLY_removedead") then {
			if (vehicle _x==_x) then {
				CLY_removedeadpending set [count CLY_removedeadpending,_x];
				[_x,0] spawn _removedead;
				_x setVariable ["CLY_removedead",nil];
			};
		} else {
			CLY_dontremovedead set [count CLY_dontremovedead,_x];
			_x setVariable ["CLY_removedead",nil];
		};
	};
} forEach _alldead-CLY_dontremovedead;
if (count CLY_dontremovedeadremove>0) then {
	CLY_dontremovedead=CLY_dontremovedead-CLY_dontremovedeadremove;
	CLY_dontremovedeadremove=[];
	publicVariable "CLY_dontremovedeadremove";
};
};

Any help appreciated.

Share this post


Link to post
Share on other sites
I'm running this alongside DayZ

That's your problem. Try asking on the DayZ forums since DayZ is not in any way compatible with ArmA2.

Share this post


Link to post
Share on other sites
That's your problem. Try asking on the DayZ forums since DayZ is not in any way compatible with ArmA2.

I beg to differ, it's still the same game, and it's still running the same scripts just a different mission.

I don't see how running it on DayZ would make it not work. As it's partly working.

Other scripts designed for ArmA2 work perfectly fine too.

Share this post


Link to post
Share on other sites

I've tried at least a dozen things that "work in ArmA2" that don't work in DayZ. Scripts and even items in the editor (well, when you finally get into the MP editor since they removed Singleplayer entirely) that just don't display in game or are entirely different items.

DayZ questions go on the DayZ forums. It's not ArmA2, it's DayZ.

Share this post


Link to post
Share on other sites

Seriously man, are you here just to give me a hard time about asking a question about this script, only because it happens so that I run it on a DayZ server?

All I'm hoping for is to get verification on the script from the OP or people that know this stuff, if it looks alright and if there's anything wrong with it.

Items argument isn't really valid since it is know for DayZ to block and or restrict a lot of those. I just don't see how DayZ would make this script not work. Perhaps instead of being on my case you could try and tell me..

Share this post


Link to post
Share on other sites

This is just like how ACE questions belong in the ACE thread and ACRE question in the ACRE thread. Since DayZ do not have a thread I think you'll have more people willing to help you over at the DayZ forums.

Share this post


Link to post
Share on other sites
Guest

@theblueone

Indeed, use the DayZ forums for DayZ related questions. If a script or mod does not work with DayZ but it works with the default game the problem is related to DayZ and as such your question belongs on the DayZ forums.

Nobody here is giving you a hard time, you simply seem to not want to be redirected to the right place to ask your question(s), while the redirect is perfectly fine and correct.

Share this post


Link to post
Share on other sites

Jesus Christ. This is NOT a DayZ related question. This is a question about this script, I just want someone to check if it's correct. I don't know if it works with the vanilla ArmaA2 because I haven't tried it and I have no means to try it. You don't know if it works with the default game yet you categorised this to be a DayZ problem.

Why do I have to go to DayZ forums, and why am I not allowed to ask for help in this script's topic since it's this script that I'm using? If I needed DayZ specific help I wouldn't be asking it here, it's help about this script that I'm looking for.

Do you seriously think anyone over at DayZ forums will be able to help me with this? They'll just tell me to go back to this topic. Me posting in this topic is my best bet.

Share this post


Link to post
Share on other sites
Guest

You have DayZ, if you have that you also have Arma 2 so yes you can try if it works without DayZ yourself instead of asking others to do that for you.

Once you have seen it works without DayZ without issues you can conclude the issues you have or want checked are caused by DayZ and as such you can go to the DayZ forums.

Now, keep your cool and post according to the forum rules which everyone here accepted during signup.

So, follow a moderators instructions, do not discuss our moderation in public and post in the correct forum section and/or thread (in this case the DayZ forums).

Share this post


Link to post
Share on other sites

I have a vehicle respawn script, and I don't want the removal script to delete vehicles as it may cause some problems regarding the vehicle respawn script. Is calling the script with only 1 parameter defined okay? >> [60] execVM "cly_removedead.sqf". Just to delete infantry. It works fine when I test it on my own machine. But idk about dedicated servers.

Edited by Iceman77

Share this post


Link to post
Share on other sites

I have the script working great, thanks heaps, but for some reason its not deleting vehicles

Share this post


Link to post
Share on other sites

Whats the time in your code you have set to delete vehicles?

As the script works fine for me.

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  

×