Jump to content
Sign in to follow this  
celery

CLY Remove Dead script

Recommended Posts

it doesnt seem to matter what time i attach to the vehicle timer, it just doesnt remove the wreck. I tried it with 5 to 120 seconds and empty and manned vehicles, but no difference. im using arma 3 alpha.

Share this post


Link to post
Share on other sites

Hi, thanks celery for this script it looks good and I look forward to trying it out. only thing is when I put the init line in, the game responds with "type script, nothing expected"

Share this post


Link to post
Share on other sites

@typ9 - possibly a syntax error like a missing ";" at the end of the line. Post your init.sqf in a spoiler.

Share this post


Link to post
Share on other sites

Hi, script does not remove the group to fix this problem should be written

 {if (count units _x == 0) then {deletegroup _x}} foreach allgroups;

if (!isServer) exitWith {};

CLY_ignoregear=["ItemRadio","ItemCompass","ItemWatch","ItemMap","ItemGPS"];
CLY_keepgear=[];
CLY_noremovegear=[];
_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";
};

       {if (count units _x == 0) then {deletegroup _x}} foreach allgroups;
};

Share this post


Link to post
Share on other sites

Thanks for this one.

There is a problem in Arma 3 however: I encountered it in combination with spunFIN's AI Spawn Script (heliParadrop) - it let's the spawned helis crash (tested on dedicated host).

I have not searched for the details yet, but the helis fly as intended without this one...

Share this post


Link to post
Share on other sites

The script was not made for Arma 3. If you want an Arma 3 removal script, open one of my deathmatch missions.

Share this post


Link to post
Share on other sites
The script was not made for Arma 3. If you want an Arma 3 removal script, open one of my deathmatch missions.

Sorry for asking you in a very old thread like this. First thank you for your removedead script, it's very useful for me, but I have a problem with removing damaged or abandoned vehicle. The vehicle is just damaged, not destroyed so the script not work for this one. In my game the (Arma 2-CO) it's very laggy after a while when my ally USA tank after abandoned or damaged is not removed. I tried other script but it's not work. Could you please update your script to fix this? I know nothing about coding, I just know how to apply it according to your guide, if you could help I'll be very appreciate :). And sorry for my English, I'm asian :P.

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  

×