Jump to content

Recommended Posts

gf-cleanup-script-version-10-1_4.png

GF Cleanup Script

by

 

GEORGE FLOROS [GR]


Description:

GF Cleanup Script , configurable script.
You are free to do anything but i would like to give me Credits for this!
Simple and easy to use and adapt .
Have Fun !

 


Installation / Usage:

For usage instructions and information of how to use the GF Cleanup Script please refer to the included documentation and/or example mission.

Place in your mission the files . There is everything included , in the init.sqf , to copy paste in your mission .

https://community.bistudio.com/wiki/SQF_syntax
Don't try to open this with the simple notepad.

For everything that is with comment // in front or between /*
means that it is disabled , so there is no need to delete the extra lines.

You can open this ex:
with notepad++
https://notepad-plus-plus.org/

and also use the extra pluggins
(this way will be better , it will give also some certain colours to be able to detect ex. problems )
http://www.armaholic.com/page.php?id=8680

or use any other program for editing .

For the Compilation List of my GF Scripts , you can search in:

https://forums.bohemia.net/forums/topic/215850-compilation-list-of-my-gf-scripts/

 

 

Notes:

Configurable Script.
You can select to delete :
Particlesource,Dead,Mines,Ruins,Craters,
Dropped Items,Static Weapon,Empty Groups,
Empty Vehicles,emptyDetector MP triggers.

 

You can exclude certain objects , by adding in the init of the object , in the editor or include in the scripted spawn :
this setVariable ["GF_Excude_from_cleanup",true];

 

It is possible to create an Exclude Zone , by creating a marker.
There are already 5 created in the editor as a working example , that you can just copy paste them in your mission.

 

 

Credits & Thanks:

 

Thanks to All script contributors
Thanks to everyone who tries to do the best for this game!
Thanks to BIS for such a great platform .
Thanks to BIS Community and BIS Community Forums .
Thanks to Armaholic Community and Forums .

 


 

Changelog:

 

v4.0
A lot of code is reedited ,
added option to exclude certain objects , by setting a variable,
added option to create an Exclude Zone , by creating a marker,
for more information check the Notes + see ex. mission.
Code Performance and optimisation and minor fixes.

 

v3.0
Code Performance and optimisation and minor fixes.

 

v2.0
    Added distance parameter
    added more options and
    minor changes.

 

v1.0

 

 

Forum topic:
- Armaholic forums http://www.armaholic.com/forums.php?m=posts&q=39927

 


 

Armaholic

download

GF Cleanup Script

 

On 4/10/2018 at 6:15 PM, GEORGE FLOROS GR said:

The cleanup script , for the example purpose is set to 1 , but i would suggest to run the script every 45 min to 2 hours top depending the mission and the players.

 

3 minutes ago, MuRaZorWitchKING said:

Those of you having trouble with the GF_Cleanup_script and performance, in order to fix your performance drop you need to disable "debugging" and notifications, debugging runs OnEachFrame and can really tear up FPS it is mainly to show you that the script is working, and it does, I recommend it for custom spawning loot and any other spawner you would like to clean up. :) 

  • Like 10
  • Thanks 2

Share this post


Link to post
Share on other sites

hello!
a cleaning script is always welcome, but i noticed many problems with it, like using "alldead" as you did, removes also the dead needed to make ZEUS work , for example.
i also suggest a viariable to exclude some things from being deleted!
bye!
 

  • Thanks 1

Share this post


Link to post
Share on other sites

Hello there dlegion !

 

1 hour ago, dlegion said:

to exclude some things from being deleted!

 

You can select in the script where it says true or false , to delete or not the certain selection.

 

 

Can you tell me more please about this? because really,  i don't get it.

1 hour ago, dlegion said:

removes also the dead needed to make ZEUS work

In the example mission there is also Zeus available.

 

Thanks !

Share this post


Link to post
Share on other sites

hello!
you can exclude whole kinds, while i mean exclude specific objects, for example you may want to clean all "weaponHolder" except one needed for mission.

about the zeus, i discovered by trial-and-error that if as normal player i use zeus on my map, it creates a dead corpse of the same kind of the player class using zeus, so when i was deleting "alldead" or "alldeadmen" it was deleting also this corpse, disabling zeus for the rest of the mission! i also discovered that this corpse is always generated in the 000,000 coordinates of the map, so just exclude things there and you're safe.

there are many other problems with the cleaning, for example i suggest put a "limit number" on every catergory, and remove by the oldest and only if not near to a player (its horrible see things disappear under your eyes).
good luck with your script!

EDIT: for example thats my script:

Spoiler

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

uiSleep 9;          // DEBUG

if (isServer) then {
{_x setVariable ["NOT_remove",true,false];} forEach (allMissionObjects "");                          // EXCLUDE EVERYTHING PRESENT AT MISSION START
   while {true} do {

//"CLEANING STARTED" remoteExecCall ["hint"];      //DEBUG

_nS = 99;   // max number of ///// DEAD CORPSES // ZEUS USE A DEAD SAME KIND OF UNIT AS PLAYER USING IT, AND PLACE IT IN MAP COORDINATES 0,0.MUST NOT DELETE IT.
_DeadN = count alldeadmen;
if (_Deadn > _nS) then {{if !(_x distance server > 17000) then {deletevehicle _x}} foreach alldeadmen;" DEAD CORPSES DELETED" remoteExecCall ["hint"];};
_DeadN = nil;

_nS = 48;   // max number of ///// weaponHolderSimulated ///// (weapons dropped by corpses)
if ((count (allMissionObjects "weaponHolderSimulated")) > _nS) then {uiSleep 0.5;{if ((_x isKindOf "weaponHolderSimulated") && (isNil {_x getVariable "NOT_remove"})) then {uiSleep 0.5;deleteVehicle _x}} foreach (allMissionObjects "");" WEAPON HOLDER SIMULATED DELETED" remoteExecCall ["hint"];};
uiSleep 1;
if ((count (allMissionObjects "GroundweaponHolder")) > _nS) then {uiSleep 0.5;{if ((_x isKindOf "GroundweaponHolder") && (isNil {_x getVariable "NOT_remove"})) then {uiSleep 0.5;deleteVehicle _x}} foreach (allMissionObjects "");" GROUND WEAPON HOLDER DELETED" remoteExecCall ["hint"];};
uiSleep 1;
if ((count (allMissionObjects "weaponHolder")) > _nS) then {uiSleep 0.5;{if ((_x isKindOf "weaponHolder") && (isNil {_x getVariable "NOT_remove"})) then {uiSleep 0.5;deleteVehicle _x}} foreach (allMissionObjects "");" WEAPON HOLDER DELETED" remoteExecCall ["hint"];};
uiSleep 1;

_nS = 12;   // max number of ///// CANOPY and EJECTION SEATS ///// (weapons dropped by corpses)
if ((count (entities [["Plane_Canopy_Base_F"],[]])) > _nS) then {{deleteVehicle _x} forEach entities [["Plane_Canopy_Base_F","Ejection_Seat_Base_F"],[]];"CANOPYS AND EJECTION SEATS DELETED" remoteExecCall ["hint"];};
uiSleep 1;

_nS = 32;   // max number of ///// EMPTY VEHICLES (AIR, LAND ,SHIP) ///// 14 are possible default vehicles already in map
_Dveh = [];
{uiSleep 0.2;if ((count crew _x == 0) && (alive _x) && (isNil {_x getVariable "NOT_remove"}) && ((_x isKindOf "air") || (_x isKindOf "landVehicle") || (_x isKindOf "ship"))) then {_Dveh append [_x]};} forEach vehicles;
uiSleep 1;
_Dn = count _Dveh;
if (_Dn > _nS) then {{uiSleep 0.5;_x setdamage 1} forEach _Dveh;str (_Dn) + " EMPTY VEHICLES DESTROYED" remoteExecCall ["hint"];};
_Dn = nil;
uiSleep 1;

_nS = 64;   // max number of ///// EXPLOSIVES MINES ///// 155mm apers = 24 mines, 155mm AT = 12 mines
_Dveh = [];
{if (isNil {_x getVariable "NOT_remove"}) then {_Dveh append [_x]};} forEach allmines;
_Dn = count _Dveh;
if (_Dn > _nS) then {{uiSleep 0.2;deleteVehicle _x;str (_Dn) + " MINES DELETED" remoteExecCall ["hint"];} forEach _Dveh;};
_Dn = nil;
uiSleep 1;

_nS = 32;   // max number of ///// THINGS-X (like ammobox, barrels, ecc)  /////
if ((count (allMissionObjects "thingX")) > _nS) then {uiSleep 0.5;{if ((_x isKindOf "thingX") && (isNil {_x getVariable "NOT_remove"})) then {uiSleep 0.5;deleteVehicle _x}} foreach (allMissionObjects "thingX");" THINGS DELETED" remoteExecCall ["hint"];};
uiSleep 1;

_nS = 48;   // max number of ///// BUILDINGS (like house, walls, ruins, craters (EXCLUDED), weapon holders,  ecc..)  /////
_Dveh = [];
{if ((isNil {_x getVariable "NOT_remove"}) && (_x isKindOf "building") && !(_x isKindOf "#crater")) then {_Dveh append [_x]};} forEach (allMissionObjects "");
_Dn = count _Dveh;
if (_Dn > _nS) then {{uiSleep 0.2;deleteVehicle _x;str (_Dn) + " BUILDINGS DELETED" remoteExecCall ["hint"];} forEach _Dveh;};
_Dn = nil;
uiSleep 1;

_nS = 16;   // max number of ///// UAV drones  /////
if ((count allUnitsUAV) > _nS) then {uiSleep 0.5;{if (isNil {_x getVariable "NOT_remove"}) then {uiSleep 0.2;deleteVehicle _x}} foreach allUnitsUAV;" UAVS DESTROYED" remoteExecCall ["hint"];};
uiSleep 1;


//"CLEANING ENDED" remoteExecCall ["hint"];    // DEBUG

uiSleep 3;
   };
};

 

 

Share this post


Link to post
Share on other sites
7 hours ago, dlegion said:

good luck with your script!

 

Thank you very much dlegion for your pointers , i will have this in mind , in the next update.

 

What matters as number one issue for any kind of script is generally the performance .

So thanks and i 'll check about it.

Share this post


Link to post
Share on other sites

another problem with "alldead" or "alldeadmen" :

 

  • Like 1

Share this post


Link to post
Share on other sites

"Personally , i don't have any idea of this issue"

 

1 hour ago, dlegion said:

another problem with "alldead" or "alldeadmen" :

 

 

This Question is for Everyone :

 

Does anyone has a solution about the comment above?

https://forums.bohemia.net/forums/topic/208893-increasing-alldead-and-alldeadmen-collections-during-game-cant-deletevehicle/

 

Share this post


Link to post
Share on other sites

Yes, i suggest workaround the bug !

Example...check for

!alive && kindof camanbase 

To get all dead men units...

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, redarmy said:

@GEORGE FLOROS GR

 

wow mate youve been busy! This collection is awesome..

 

I just used your cleanup script,best put together cleanup script iv seen out there...i had a few questions..

 

Does cleaning up of particles and blood really help performance long term in a scenario?

I ran a scenario with a respawn script,starts fine but really bogs down after a while(i was using alternative dead body/vehicle remover script) so as i saw your extra features to remove i gave it a try...highly impressed.

 

And one more question...is there any variable i can write to exclude certain vehicles(empty) from being removed in mission?

 

also deleting empty groups,what exactly is this? and will it interfere with a respawn script?  Cheers!

Share this post


Link to post
Share on other sites
2 minutes ago, GEORGE FLOROS GR said:
3 hours ago, redarmy said:

wow mate youve been busy!

 

Hello there redarmy !

 

Thank you very much for everything !

 

This cleanup script was created , as i was working with this GF Blood Stains Script , so this is why you will see inside that is including some classnames for BIS blood of the orange dlc  .

You can use that place and change this , to other objects , that you want to delete for ex:  "Plane_Canopy_Base_F"

 

For cleaning particles , there is just also this kind of option ex: spawned particles that you want to delete (anything )

 

I haven't add something to exclude certain vehicles,

but in the same code you can use this code and add your exclude list :

 


		if (_10_Empty_Vehicles) then { 
	
		hint"_10_Empty_Vehicles";		
		_vehicles = nearestObjects [player, ["Car","Tank","Air","Ship"], 9999];				
		
		_exclude_list = [
		"B_MRAP_01_F",
		"B_Heli_Light_01_dynamicLoadout_F"
		]; 
		
		{
		if ((count crew vehicle _x == 0) && (!((typeOf _x) in _exclude_list)))then {deleteVehicle _x};
		} forEach _vehicles;
		sleep 1;
		};

 

 

3 hours ago, redarmy said:

also deleting empty groups,

https://community.bistudio.com/wiki/deleteGroupWhenEmpty

 

It would be good , to ask the cerain question to the cleanup script topic , for the others to get benefit from.

 

Thanks again and for anything you want feel free to ask.!

 

See you redarmy !

Share this post


Link to post
Share on other sites

@GEORGE FLOROS GR can you tell me if it possible to run our script "Gf cleanup" with a addaction ?  can you help me please ?  thank you

  • Like 1

Share this post


Link to post
Share on other sites
2 minutes ago, praetis said:

 can you tell me if it possible to run this script with a addaction ?

 

Hello there praetis !

 

Yes of course , give me one sec to write two different ways !

Share this post


Link to post
Share on other sites
22 hours ago, praetis said:

run this script with a addaction ?

 

 

You can run this Script with a Radio trigger.

Hit in game ,  0,0,1 or with an add action.

 

Copy this in the init.sqf

//	GF Cleanup script , Call with radio alpha , hit in game 0,0,1 
_radio_1 = createTrigger["EmptyDetector",[0,0]];
_radio_1 setTriggerActivation["Alpha","PRESENT",true];
_radio_1 setTriggerStatements["this","execVM 'GF_Cleanup\GF_Cleanup.sqf'",""];
1 setRadioMsg "GF Cleanup script";

//	OR

//	GF Cleanup script , add an action to player
player addAction ["GF Cleanup script", "GF_Cleanup\GF_Cleanup.sqf"];

 

If you want to run this script one time only and not in continuous ,

then you need to change this Script with the following:

 




//________________  Author : [GR]GEORGE F ___________ 08.05.18 _____________

/*
________________ GF Cleanup Script ________________

https://forums.bohemia.net/forums/topic/216359-gf-cleanup-script/

Please keep the Credits or add them to your Diary

https://community.bistudio.com/wiki/SQF_syntax
Don't try to open this with the simple notepad.
For everything that is with comment  //  in front  or between /* 
means that it is disabled , so there is no need to delete the extra lines. 

You can open this ex:
with notepad++
https://notepad-plus-plus.org/

and also use the extra pluggins
(this way will be better , it will give also some certain collours to be able to detect ex. problems )
http://www.armaholic.com/page.php?id=8680

or use any other program for editing .

For the Compilation List of my GF Scripts , you can search in:
https://forums.bohemia.net/forums/topic/215850-compilation-list-of-my-gf-scripts/
*/


if (!isServer) exitWith {};

diag_log "//________________ GF Cleanup Script _____________";


//________________ GF Cleanup Script _____________

//	For continuous run use :
//	while {true} do {

[]spawn	{	

//________________ Settings _____________
//________________ Set true to delete or false  _____________

_1_Blood_Stains					= true; 
_2_particlesource  				= true; 
_3_Dead 					 	= true;            
_4_Mines 						= true;           
_5_Ruins 						= true;           
_6_Craters 						= true; 		  
_7_Dropped_Items 				= true;
_8_Static_Weapon				= true;
_9_Empty_Groups 				= true;             
_10_Empty_Vehicles				= true;
_11_emptyDetector_MP_triggers 	= true;


		sleep 1;	//set the time , in how many second to delete again , if you select to be on continuous
		hint"Start delete";
		
	
		if (_1_Blood_Stains) then {
		
		// This is for my new upcoming script Blood Stains , you can add here any item that you want to be deleted
		
		hint"_1_Blood_Stains";
		{deleteVehicle _x} count ((allMissionObjects "BloodSplatter_01_Large_New_F")+
		(allMissionObjects "BloodSplatter_01_Medium_New_F")+
		(allMissionObjects "BloodSplatter_01_Small_New_F")+
		(allMissionObjects "BloodSpray_01_New_F")+
		(allMissionObjects "BloodPool_01_Large_New_F")+
		(allMissionObjects "BloodPool_01_Medium_New_F")+
		(allMissionObjects "BloodTrail_01_New_F")+
		(allMissionObjects "UserTexture1m_F")+
		(allMissionObjects "UserTexture_1x2_F"));
		sleep 1;
		};
	 
		
		if (_2_particlesource) then {
	
		hint"_2_particlesource";
		{deleteVehicle _x;} forEach(allMissionObjects "#particlesource"); 
		sleep 1;
		};
	 
		
		if (_3_Dead) then { 
	
		hint"_3_Dead";
		{deleteVehicle _x;} count allDead;	//allDeadMen
		sleep 1;
		};
	 
	 
		if (_4_Mines) then { 
	
		hint"_4_Mines";
		{ deleteVehicle _x } forEach allMines;
		sleep 1;
		};
	
	
		if (_5_Ruins) then { 
	
		hint"_5_Ruins";
		{ deleteVehicle _x } forEach (allMissionObjects "ruins");
		sleep 1;
		};
	
	
		if (_6_Craters) then {
	
		hint"_6_Craters";
		{deleteVehicle _x } forEach ((allMissionObjects "Crater")+
		(allMissionObjects "CraterLong")+
		(allMissionObjects "CraterLong_small"));
		sleep 1;
		};
	
	
		if (_7_Dropped_Items) then { 
	
		hint"_7_Dropped_Items";
		{deleteVehicle _x } forEach (allMissionObjects "WeaponHolder");
		//"groundWeaponHolder" 	"WeaponHolderSimulated"
		sleep 1;
		};
	
	
		if (_8_Static_Weapon) then { 
	
		hint"_8_Static_Weapon";
		{ deleteVehicle _x } forEach (allMissionObjects "staticWeapon");
		sleep 1;
		};
	
	
		if (_9_Empty_Groups) then { 
	
		hint"_9_Empty_Groups";
		{if ((count units _x) isEqualTo 0) then {deleteGroup _x}} count allGroups;
		sleep 1;
		};
	
	
		if (_10_Empty_Vehicles) then { 
	
		hint"_10_Empty_Vehicles";		
		_vehicles = nearestObjects [player, ["Car","Tank","Air","Ship"], 99999];				
		
		_exclude_list = [
		"B_MRAP_01_F",
		"B_Heli_Light_01_dynamicLoadout_F"
		]; 
		
		{
		if ((count crew vehicle _x == 0) && (!((typeOf _x) in _exclude_list)))then {deleteVehicle _x};
		} forEach _vehicles;
		sleep 1;
		};
	
	
		if (_11_emptyDetector_MP_triggers) then { 
	
		hint"_11_emptyDetector_MP_triggers";
		{ deleteVehicle _x } forEach (allMissionObjects "emptyDetector");
		sleep 1;
 		};
	
	 
		hint"Cleanup C O M P L E T E";
};

This is how it will be in the next update.

this is also including an exclude list , for empty vehicles .

 

Thanks !

 

  • Like 1

Share this post


Link to post
Share on other sites
Just now, praetis said:

Woah ! thank you very much ! :f:

 

No problem , if it's anything feel free to ask !

 

See you praetis !

Share this post


Link to post
Share on other sites

Hello there to everyone !

 

This is a more optimised Script before the actual update:

 

Changelog:

added a distance option to delete the object,

script optimisation,

minor fixes.

 

 




//________________  Author : [GR]GEORGE F ___________ 20.05.18 _____________

/*
________________ GF Cleanup Script ________________

https://forums.bohemia.net/forums/topic/216359-gf-cleanup-script/

Please keep the Credits or add them to your Diary

https://community.bistudio.com/wiki/SQF_syntax
Don't try to open this with the simple notepad.
For everything that is with comment  //  in front  or between /* 
means that it is disabled , so there is no need to delete the extra lines. 

You can open this ex:
with notepad++
https://notepad-plus-plus.org/

and also use the extra pluggins
(this way will be better , it will give also some certain collours to be able to detect ex. problems )
http://www.armaholic.com/page.php?id=8680

or use any other program for editing .

For the Compilation List of my GF Scripts , you can search in:
https://forums.bohemia.net/forums/topic/215850-compilation-list-of-my-gf-scripts/
*/


if (!isServer) exitWith {};

diag_log "//________________ GF Cleanup Script _____________";


//________________ GF Cleanup Script _____________

//	For continuous run use :
	while {true} do {

//	For one run only , with a radio trigger or addaction use :
//	[]spawn	{	

//________________ Settings _____________
//________________ Set true to delete or false  _____________

_Delete_distance				= 20;		//	Meters distance to delete the items

_1_Blood_Stains					= true; 	// This is for my Blood Stains script 
_2_Particlesource  				= true; 
_3_Dead_Men	 					= true;            
_4_Mines 						= true;           
_5_Ruins 						= true;           
_6_Craters 						= true; 		  
_7_Dropped_Items 				= true;
_8_Static_Weapon				= true;
_9_Empty_Groups 				= true;             
_10_Empty_Vehicles				= true;
_11_Destructed_Vehicles			= true;
_12_EmptyDetector_MP_triggers 	= true;
_13_Plane_Parts					= true; 
_14_Destruction_Crater			= true; 



_Player_Position = position (vehicle player);
//_players = allUnits select {isPlayer _x && {!(_x isKindOf "HeadlessClient_F")}};

	//________________ set the time _____________
	sleep 1;	//	set the time , in how many second to delete again , if you select to be on continuous
	hint"Start delete";
		

	//________________ _1_Blood_Stains _____________		
	if (_1_Blood_Stains) then {
		
	//	This is for my Blood Stains script , you can add here any item that you want to be deleted
		
	hint"_1_Blood_Stains";
	
	_BloodSplatter = nearestObjects [player, [
	"BloodSplatter_01_Large_New_F",
	"BloodSplatter_01_Medium_New_F",
	"BloodSplatter_01_Small_New_F",
	"BloodSpray_01_New_F",
	"BloodPool_01_Large_New_F",
	"BloodPool_01_Medium_New_F",
	"BloodTrail_01_New_F",
	"UserTexture1m_F",
	"UserTexture_1x2_F"
	], 99999];
	
	{
	if (_x distance2D _Player_Position >= _Delete_distance) then {			
	_BloodSplatter = _BloodSplatter - [_x];  		
	deleteVehicle _x};
	} forEach _BloodSplatter;
	sleep 0.5;
	};
	

	//________________ _2_Particlesource _____________	
	if (_2_Particlesource) then {
	
	hint"_2_Particlesource";
	
	_Particlesource	= nearestObjects [player, [
	"#particlesource"
	]
	, 99999];
	
	{
	if (_x distance2D _Player_Position >= _Delete_distance) then {			
	_Particlesource = _Particlesource - [_x];  		
	deleteVehicle _x};
	} forEach _Particlesource;
	sleep 0.5;
	};
	

	//________________ _3_Dead_Men _____________				
	if (_3_Dead_Men) then { 
	
	hint"_3_Dead_Men";
	
	_Dead_Men = nearestObjects [player, [
	"CAManBase"
	], 99999];
	
	{
	if ((_x distance2D _Player_Position >= _Delete_distance) && (!(alive _x))) then {			
	_Dead_Men = _Dead_Men - [_x];  		
	deleteVehicle _x};
	} forEach _Dead_Men;
	sleep 0.5;
	};
	 
	
	//________________ _4_Mines _____________	
	if (_4_Mines) then { 
	
	hint"_4_Mines";
	
	//	https://forums.bohemia.net/forums/topic/186418-returning-nearest-mine-reliably-around-player/?tab=comments#comment-2946819
	
	_Mines = nearestObjects [player, [
	"timebombcore",
	"mineBase",
	"MineGeneric"
	], 99999];
	
	{
	if (_x distance2D _Player_Position >= _Delete_distance) then {
	_Mines = _Mines - [_x];  		
	deleteVehicle _x};
	} forEach _Mines;
	sleep 0.5;
	};
	
	
	//________________ _5_Ruins _____________	
	if (_5_Ruins) then { 
	
	hint"_5_Ruins";
	
	_Ruins	= nearestObjects [player, [
	"ruins"
	], 99999];
	
	{
	if (_x distance2D _Player_Position >= _Delete_distance) then {			
	_Ruins = _Ruins - [_x];  		
	deleteVehicle _x};
	} forEach _Ruins;
	sleep 0.5;
	};
	
	
	//________________ _6_Craters _____________	
	if (_6_Craters) then {
	
	hint"_6_Craters";
	
	_Craters	= nearestObjects [player, [
	"Crater",
	"CraterLong",
	"CraterLong_small"
	], 99999];
	
	{
	if (_x distance2D _Player_Position >= _Delete_distance) then {			
	_Craters = _Craters - [_x];  		
	deleteVehicle _x};
	} forEach _Craters;
	sleep 0.5;
	};
	
	
	//________________ _7_Dropped_Items _____________		
	if (_7_Dropped_Items) then { 
	
	hint"_7_Dropped_Items";
	
	_Dropped_Items	= nearestObjects [player, [
	"WeaponHolder"
	//	"groundWeaponHolder",
	//	"WeaponHolderSimulated"
	], 99999];
	
	{
	if (_x distance2D _Player_Position >= _Delete_distance) then {			
	_Dropped_Items = _Dropped_Items - [_x];  		
	deleteVehicle _x};
	} forEach _Dropped_Items;
	sleep 0.5;
	};
	
	
	//________________ _8_Static_Weapon _____________		
	if (_8_Static_Weapon) then { 
	
	hint"_8_Static_Weapon";
	
	_Static_Weapon	= nearestObjects [player, [
	"staticWeapon"
	], 99999];
	
	{
	if (_x distance2D _Player_Position >= _Delete_distance) then {			
	_Static_Weapon = _Static_Weapon - [_x];  		
	deleteVehicle _x};
	} forEach _Static_Weapon;
	sleep 0.5;
	};
	
	
	//________________ _9_Empty_Groups _____________	
	if (_9_Empty_Groups) then { 
	
	hint"_9_Empty_Groups";
	
	{if ((count units _x) isEqualTo 0) then {deleteGroup _x}} forEach allGroups;
	sleep 0.5;
	};
	
	
	//________________ _10_Empty_Vehicles _____________	
	if (_10_Empty_Vehicles) then { 
	
	hint"_10_Empty_Vehicles";		
	
	_vehicles = nearestObjects [player, ["Car","Tank","Air","Ship"], 99999];				
		
	_Exclude_Vehicles_List = [
	"B_MRAP_01_F",
	"B_Heli_Light_01_dynamicLoadout_F"
	]; 
		
			
	{
	if  ( (_x distance2D _Player_Position >= _Delete_distance) && (count crew vehicle _x == 0) && (!((typeOf _x) in _Exclude_Vehicles_List)) ) then {
		  
	_vehicles = _vehicles - [_x];   
	deleteVehicle _x};
	} forEach _vehicles;
	sleep 0.5;
	};
	
	
	//________________ _11_Destructed_Vehicles _____________	
	if (_11_Destructed_Vehicles) then { 
	
	hint"_11_Destructed_Vehicles";		
	
	_Destructed_Vehicles = nearestObjects [player, ["Car","Tank","Air","Ship"], 99999];				
		
	_Exclude_Destructed_Vehicles_List = [
	"B_MRAP_01_F",
	"B_Heli_Light_01_dynamicLoadout_F"
	]; 
		
	//	(damage _x == 1 || {!canMove _x}
	
	{
	if  ( (_x distance2D _Player_Position >= _Delete_distance) && (!((typeOf _x) in _Exclude_Destructed_Vehicles_List)) && (damage _x == 1 || {!canMove _x})  ) then {
		
	_Destructed_Vehicles = _Destructed_Vehicles - [_x];   
	deleteVehicle _x};
	} forEach _Destructed_Vehicles;
	sleep 0.5;
	};
	
	
	//________________ _12_EmptyDetector_MP_triggers _____________	
	if (_12_EmptyDetector_MP_triggers) then { 
	
	hint"_12_EmptyDetector_MP_triggers";
	
	_EmptyDetector_MP_triggers	= nearestObjects [player, [
	"emptyDetector"
	], 99999];
	
	{
	if (_x distance2D _Player_Position >= _Delete_distance) then {			
	_EmptyDetector_MP_triggers = _EmptyDetector_MP_triggers - [_x];  		
	deleteVehicle _x};
	} forEach _EmptyDetector_MP_triggers;
	sleep 0.5;
	};
			
	
	//________________ _13_Plane_Parts _____________	
	if (_13_Plane_Parts) then {
				
	hint"_13_Plane_Parts";
	
	_Plane_Parts	= nearestObjects [player, [
	"I_Ejection_Seat_Plane_Fighter_03_F",
	"B_Ejection_Seat_Plane_CAS_01_F",
	"O_Ejection_Seat_Plane_CAS_02_F",
	"O_Ejection_Seat_Plane_Fighter_02_F",
	"I_Ejection_Seat_Plane_Fighter_04_F",
	"B_Ejection_Seat_Plane_Fighter_01_F",
	"Plane_Canopy_Base_F",
	"Ejection_Seat_Base_F"
	], 99999];
	
	{
	if (_x distance2D _Player_Position >= _Delete_distance) then {			
	_Plane_Parts = _Plane_Parts - [_x];  		
	deleteVehicle _x};
	} forEach _Plane_Parts;
	sleep 0.5;
	};
	
	
	//________________ _14_Destruction_Crater _____________	
	if (_14_Destruction_Crater) then { 
	
	hint"_14_Destruction_Crater";
	
	_Destruction_Crater	= nearestObjects [player, [
	"#explosion"
	], 99999];
	
	{
	if (_x distance2D _Player_Position >= _Delete_distance) then {			
	_Destruction_Crater = _Destruction_Crater - [_x];  		
	deleteVehicle _x};
	} forEach _Destruction_Crater;
	sleep 0.5;
	};
		
		



	hint"Cleanup C O M P L E T E";
};

 

 

Does anyone know how to delete this?

any  help , would be much appreciated!

ejHoU6y4RBqUl8OrFDidVQ.png

QplfjTV.jpg

 

 

Thanks !

 

Share this post


Link to post
Share on other sites

Updated



Changelog:
v2.0
Added distance parameter
added more options and
minor changes.

Share this post


Link to post
Share on other sites

Does this works with dedicated server? since it uses vehicle player and it only runs on server...

  • Like 1

Share this post


Link to post
Share on other sites
19 hours ago, fycj said:

Does this works with dedicated server?

 

You are right and it's not tested.

I will check this though.!

Share this post


Link to post
Share on other sites

Updating:

 

Changelog:

v.3.0
    Code Performance and optimisation
    and minor fixes.

 

 

*** If there is anyone with a help , to work correctly on Dedicated server , feel free to correct this.!

Share this post


Link to post
Share on other sites

Hello there to everyone !

 

I'm pasting below the new updated version before the actual update .

If there is anyone who can test this in a Dedicated Server i would be glad to tell me if it's ok !

(because for the time being ,  i cant!)

 

Thanks !

 

 

Spoiler




//________________  Author : [GR]GEORGE F ___________ 29.07.18 _____________

/*
________________ GF Cleanup Script ________________

https://forums.bohemia.net/forums/topic/216359-gf-cleanup-script/

Please keep the Credits or add them to your Diary

https://community.bistudio.com/wiki/SQF_syntax
Don't try to open this with the simple notepad.
For everything that is with comment  //  in front  or between /* 
means that it is disabled , so there is no need to delete the extra lines. 

You can open this ex:
with notepad++
https://notepad-plus-plus.org/

and also use the extra pluggins
(this way will be better , it will give also some certain colours to be able to detect ex. problems )
http://www.armaholic.com/page.php?id=8680

or use any other program for editing .

For the Compilation List of my GF Scripts , you can search in:
https://forums.bohemia.net/forums/topic/215850-compilation-list-of-my-gf-scripts/
*/



//	If you want the script to run only in the server use the code below
if(!isServer) exitWith {};

diag_log "//________________ GF Cleanup Script _____________";

systemchat "GF Cleanup Script    I n i t i a l i z e d";

//________________ GF Cleanup Script _____________


//	For continuous run (loop the script) use :
	while {true} do {

//	For one run only , with a radio trigger or addaction use :
//	[]spawn	{	

//________________ Settings _____________
//________________ Set true to delete or false  _____________

_Systemchat_Enabled				= true;	//	Show show notifications

_Delete_distance				= 20;	//	Meters distance from Players to delete the items

_1_Blood_Stains					= false; //	This is for my Blood Stains script  https://forums.bohemia.net/forums/topic/217136-gf-blood-stains-and-sfx-script/
_2_Particlesource  				= true; 
_3_Dead_Men	 					= true;            
_4_Mines 						= true;           
_5_Ruins 						= true;           
_6_Craters 						= true; 		  
_7_Dropped_Items 				= true;
_8_Static_Weapon				= true;
_9_Empty_Groups 				= true;             
_10_Empty_Vehicles				= true;
_11_Destructed_Vehicles			= true;
_12_EmptyDetector_MP_triggers 	= true;
_13_Plane_Parts					= true; 
_14_Destruction_Crater			= true; 

//________________ set the time to run / loop _____________

sleep 1;	//	set the time , in how many second to delete again , if you select to be on continuous



//________________ Cleanup Start ________________

_allPlayers = allUnits select {isPlayer _x && {!(_x isKindOf "HeadlessClient_F")}};
_centerPosition = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition");


if (_Systemchat_Enabled) then {
systemchat "Cleanup Start";
};	
	
//________________ _1_Blood_Stains _____________		
if (_1_Blood_Stains) then {
		
//	This is for my Blood Stains script , you can add here any item that you want to be deleted

if (_Systemchat_Enabled) then {
systemchat "_1_Blood_Stains";
};	
	
	_BloodSplatter = nearestObjects [_centerPosition, [
	"BloodSplatter_01_Large_New_F",
	"BloodSplatter_01_Medium_New_F",
	"BloodSplatter_01_Small_New_F",
	"BloodSpray_01_New_F",
	"BloodPool_01_Large_New_F",
	"BloodPool_01_Medium_New_F",
	"BloodTrail_01_New_F",
	"UserTexture1m_F",
	"UserTexture_1x2_F"
	], worldSize];
	
	{
	_Delete_this = _x;
    if ((isNull (attachedTo _Delete_this)) && {(({((_x distance _Delete_this) <= _Delete_distance)} count _allPlayers) isEqualTo 0)}) then {		
	_BloodSplatter = _BloodSplatter - [_x];  		
	deleteVehicle _x};
	} forEach _BloodSplatter;
	sleep 0.5;
};
	

//________________ _2_Particlesource _____________	
if (_2_Particlesource) then {

if (_Systemchat_Enabled) then {
systemchat "_2_Particlesource";
};		
	
	_Particlesource	= nearestObjects [_centerPosition, [
	"#particlesource"
	]
	, worldSize];
	
	{
	_Delete_this = _x;
    if ((isNull (attachedTo _Delete_this)) && {(({((_x distance _Delete_this) <= _Delete_distance)} count _allPlayers) isEqualTo 0)}) then {	
	_Particlesource = _Particlesource - [_x];  		
	deleteVehicle _x};
	} forEach _Particlesource;
	sleep 0.5;
};
	

//________________ _3_Dead_Men _____________				
if (_3_Dead_Men) then { 

if (_Systemchat_Enabled) then {
systemchat "_3_Dead_Men";
};		
	
	_Dead_Men = nearestObjects [_centerPosition, [
	"CAManBase"
	], worldSize];
	
	{
	_Delete_this = _x;
    if ((isNull (attachedTo _Delete_this)) && (!(alive _x)) && {(({((_x distance _Delete_this) <= _Delete_distance)} count _allPlayers) isEqualTo 0)}) then {	
	_Dead_Men = _Dead_Men - [_x];  		
	deleteVehicle _x};
	} forEach _Dead_Men;
	sleep 0.5;
};
	 
	
//________________ _4_Mines _____________	
if (_4_Mines) then { 

if (_Systemchat_Enabled) then {
systemchat "_4_Mines";
};		
	
	//	https://forums.bohemia.net/forums/topic/186418-returning-nearest-mine-reliably-around-player/?tab=comments#comment-2946819
	
	_Mines = nearestObjects [_centerPosition, [
	"timebombcore",
	"mineBase",
	"MineGeneric"
	], worldSize];
	
	{
	_Delete_this = _x;
    if ((isNull (attachedTo _Delete_this)) && {(({((_x distance _Delete_this) <= _Delete_distance)} count _allPlayers) isEqualTo 0)}) then {	
	_Mines = _Mines - [_x];  		
	deleteVehicle _x};
	} forEach _Mines;
	sleep 0.5;
};
	
	
//________________ _5_Ruins _____________	
if (_5_Ruins) then { 

if (_Systemchat_Enabled) then {
systemchat "_5_Ruins";
};		
	
	_Ruins	= nearestObjects [_centerPosition, [
	"ruins"
	], worldSize];
	
	{
	_Delete_this = _x;
    if ((isNull (attachedTo _Delete_this)) && {(({((_x distance _Delete_this) <= _Delete_distance)} count _allPlayers) isEqualTo 0)}) then {			
	_Ruins = _Ruins - [_x];  		
	deleteVehicle _x};
	} forEach _Ruins;
	sleep 0.5;
};
	
	
//________________ _6_Craters _____________	
if (_6_Craters) then {

if (_Systemchat_Enabled) then {
systemchat "_6_Craters";
};		
	
	_Craters	= nearestObjects [_centerPosition, [
	"Crater",
	"CraterLong",
	"CraterLong_small"
	], worldSize];
	
	{
	_Delete_this = _x;
    if ((isNull (attachedTo _Delete_this)) && {(({((_x distance _Delete_this) <= _Delete_distance)} count _allPlayers) isEqualTo 0)}) then {	
	_Craters = _Craters - [_x];  		
	deleteVehicle _x};
	} forEach _Craters;
	sleep 0.5;
};
	
	
//________________ _7_Dropped_Items _____________		
if (_7_Dropped_Items) then { 

if (_Systemchat_Enabled) then {
systemchat "_7_Dropped_Items";
};		
	
	_Dropped_Items	= nearestObjects [_centerPosition, [
	"WeaponHolder"
	//	"groundWeaponHolder",
	//	"WeaponHolderSimulated"
	], worldSize];
	
	{
	_Delete_this = _x;
    if ((isNull (attachedTo _Delete_this)) && {(({((_x distance _Delete_this) <= _Delete_distance)} count _allPlayers) isEqualTo 0)}) then {				
	_Dropped_Items = _Dropped_Items - [_x];  		
	deleteVehicle _x};
	} forEach _Dropped_Items;
	sleep 0.5;
};
	
	
//________________ _8_Static_Weapon _____________		
if (_8_Static_Weapon) then { 

if (_Systemchat_Enabled) then {
systemchat "_8_Static_Weapon";
};	
	
	_Static_Weapon	= nearestObjects [_centerPosition, [
	"staticWeapon"
	], worldSize];
	
	{
	_Delete_this = _x;
    if ((isNull (attachedTo _Delete_this)) && {(({((_x distance _Delete_this) <= _Delete_distance)} count _allPlayers) isEqualTo 0)}) then {		
	_Static_Weapon = _Static_Weapon - [_x];  		
	deleteVehicle _x};
	} forEach _Static_Weapon;
	sleep 0.5;
};
	
	
//________________ _9_Empty_Groups _____________	
if (_9_Empty_Groups) then { 

if (_Systemchat_Enabled) then {
systemchat "_9_Empty_Groups";
};	
	
	{if ((count units _x) isEqualTo 0) then {deleteGroup _x}} forEach allGroups;
	sleep 0.5;
};
	
	
//________________ _10_Empty_Vehicles _____________	
if (_10_Empty_Vehicles) then { 

if (_Systemchat_Enabled) then {
systemchat "_10_Empty_Vehicles";
};			
	
	_vehicles = nearestObjects [_centerPosition, ["Car","Tank","Air","Ship"], worldSize];				
		
	_Exclude_Vehicles_List = [
	"B_MRAP_01_F",
	"B_Heli_Light_01_dynamicLoadout_F"
	]; 
		
	{	
	_Delete_this = _x;
    if ((isNull (attachedTo _Delete_this)) && (!((typeOf _x) in _Exclude_Vehicles_List)) && {(({((_x distance _Delete_this) <= _Delete_distance)} count _allPlayers) isEqualTo 0)}) then {
	_vehicles = _vehicles - [_x];   
	deleteVehicle _x};
	} forEach _vehicles;
	sleep 0.5;
};


//________________ _11_Destructed_Vehicles _____________	
if (_11_Destructed_Vehicles) then { 

if (_Systemchat_Enabled) then {
systemchat "_11_Destructed_Vehicles";
};			
	
	_Destructed_Vehicles = nearestObjects [_centerPosition, ["Car","Tank","Air","Ship"], worldSize];				
		
	_Exclude_Destructed_Vehicles_List = [
	"B_MRAP_01_F",
	"B_Heli_Light_01_dynamicLoadout_F"
	]; 
	
	{
	_Delete_this = _x;
    if ((isNull (attachedTo _Delete_this)) && (!((typeOf _x) in _Exclude_Destructed_Vehicles_List)) && (damage _x == 1 || {!canMove _x}) && {(({((_x distance _Delete_this) <= _Delete_distance)} count _allPlayers) isEqualTo 0)}) then {	
	_Destructed_Vehicles = _Destructed_Vehicles - [_x];   
	deleteVehicle _x};
	} forEach _Destructed_Vehicles;
	sleep 0.5;
};
	
	
//________________ _12_EmptyDetector_MP_triggers _____________	
if (_12_EmptyDetector_MP_triggers) then { 

if (_Systemchat_Enabled) then {
systemchat "_12_EmptyDetector_MP_triggers";
};		

	_EmptyDetector_MP_triggers	= nearestObjects [_centerPosition, [
	"emptyDetector"
	], worldSize];
	
	{
	_Delete_this = _x;
    if ((isNull (attachedTo _Delete_this)) && {(({((_x distance _Delete_this) <= _Delete_distance)} count _allPlayers) isEqualTo 0)}) then {		
	_EmptyDetector_MP_triggers = _EmptyDetector_MP_triggers - [_x];  		
	deleteVehicle _x};
	} forEach _EmptyDetector_MP_triggers;
	sleep 0.5;
};
			
	
//________________ _13_Plane_Parts _____________	
if (_13_Plane_Parts) then {

if (_Systemchat_Enabled) then {
systemchat "_13_Plane_Parts";
};				
	
	_Plane_Parts	= nearestObjects [_centerPosition, [
	"I_Ejection_Seat_Plane_Fighter_03_F",
	"B_Ejection_Seat_Plane_CAS_01_F",
	"O_Ejection_Seat_Plane_CAS_02_F",
	"O_Ejection_Seat_Plane_Fighter_02_F",
	"I_Ejection_Seat_Plane_Fighter_04_F",
	"B_Ejection_Seat_Plane_Fighter_01_F",
	"Plane_Canopy_Base_F",
	"Ejection_Seat_Base_F"
	], worldSize];
	
	{
	_Delete_this = _x;
    if ((isNull (attachedTo _Delete_this)) && {(({((_x distance _Delete_this) <= _Delete_distance)} count _allPlayers) isEqualTo 0)}) then {	
	_Plane_Parts = _Plane_Parts - [_x];  		
	deleteVehicle _x};
	} forEach _Plane_Parts;
	sleep 0.5;
};
	
	
//________________ _14_Destruction_Crater _____________	it's not working!
if (_14_Destruction_Crater) then { 

if (_Systemchat_Enabled) then {
systemchat "_14_Destruction_Crater";
};		
	
	_Destruction_Crater	= nearestObjects [_centerPosition, [
	"explosion",
	"Crater"
	], worldSize];
	
	{
	_Delete_this = _x;
    if ((isNull (attachedTo _Delete_this)) && {(({((_x distance _Delete_this) <= _Delete_distance)} count _allPlayers) isEqualTo 0)}) then {			
	_Destruction_Crater = _Destruction_Crater - [_x];  		
	deleteVehicle _x};
	} forEach _Destruction_Crater;
	sleep 0.5;
};
	
	
if (_Systemchat_Enabled) then {
systemchat "Cleanup C O M P L E T E";
};			

};

 

 

Share this post


Link to post
Share on other sites

will try to test it in this days...

Will let you know

  • Thanks 1

Share this post


Link to post
Share on other sites

hello GF!
well...i tested it on both SP and dedicated, and here are the results:
the script itself works, but has some concept-problems, at least for me, dont take it wrong, i try to help and be consctructive:

1) is performance-heavy, my test mission usually runs stable at 40+ fps on SP editor and 50+ on dedicated, here it bouce from 20 to 30 fps, but with huge freezes, making it totally unplayable on SP, and barely playable on dedicated.
2) there is no way to exclude something, i strongly suggest to use a check on a variable like "NOTremove" on each catergory, so people can selectively disable cleaning of some objects!
3) as i told you sometimes ago, removing dead also removes ZEUS, so you have to exclude the deads in the left-down corner of the map, or zeus will be deleted forever!
4) from my experience, people hate to drive up to a point, disembark, make 10 meters, turn around and discover that cleanup script has deleted theyr vehicle!
i personally found a good "balance" using togheter a "soft cleaning" deleting all too far from players (5+km) and an "aggressive cleaning" deleting all objects of that kind (lets say empty vehicles)
but only after a certain critical amount has been reached, so if players play wisely and not spamming, theyr vehicle will never be deleted!
 

  • Like 1

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

×