Jump to content
aeroson

Repetitive Cleanup

Recommended Posts

Sorry. For now, iam no longer willing to support this (no time, no money). Though i will gladly accept any pull requests on github.


Summary / info

Can delete everything that is not really needed:
dead bodies, dropped items, smokes, chemlights, explosives, times and classes can be specified
Beware: if weapons on ground is intentional e.g. fancy weapons stack, it will delete them too.
Beware: if dead bodies are intentional it will delete them too.
Beware: if destroyed vehicles intentional it will delete them too.
Uses allMissionObjects "" to iterate over all objects.
Adds objects for deletion only if players are specified distance away from them.
If you want something to withstand the clean up, paste this into it's init:
this setVariable["persistent",true];


License, legal stuff
You are free to use Repetitve Cleanup script as you wish. Though it would be nice of you to put my name into credits (thanks to you who already did)

Usage

paste into init.sqf
[] execVM 'repetitive_cleanup.sqf';
then open repetitive_cleanup.sqf and adjust values in CNFIGURATION section


For those struggling with file hierarchy
0JKVbYA.png




download_button.png
download repetitive_cleanup.sqf




Changelog

v2.0

 - Almost complete rewrite of the script. Uses different method to iterate over all mission objects. Probably performs better. Can now specify time and which classes to delete in this time.

 

v1.9
- Fixed: Mobile vehicles or vehicles with alive crew are now removed from cleanup list



Credits
DIS gaming community for testing
1MSOB for original idea

Willing to participate ? github.com/aeroson/a3-misc

Edited by aeroson
  • Like 1

Share this post


Link to post
Share on other sites

Thanks a bunch Aeroson. This is just as efficient and simple just like your other great functions (gear, map markers etc)

Share this post


Link to post
Share on other sites

Just a warning: In the current 0.77 development build, there are serious performance issues using nearObjects on Altis.

Share this post


Link to post
Share on other sites

I know, i've fixed that by using nearObjects for allUnits only with 100m range, and saving those object into array along with timestamp.

Share this post


Link to post
Share on other sites

I've been trying to add a body cleanup script to a mission I'm making for about 6 hours now. I've tried nearly 20 different scripts and none of them had any effect. I know I'm not doing anything wrong, because most of them just require that you add the script to the init file. I don't understand what's going wrong. I know this one is intended for servers but I figured it would work just as well if I used it for my mission but still, nothing.

Share this post


Link to post
Share on other sites
I've been trying to add a body cleanup script to a mission I'm making for about 6 hours now. I've tried nearly 20 different scripts and none of them had any effect. I know I'm not doing anything wrong, because most of them just require that you add the script to the init file. I don't understand what's going wrong. I know this one is intended for servers but I figured it would work just as well if I used it for my mission but still, nothing.

Did you try the one I made for Arma 2? It's only for bodies and not for everything like the topic's script.

SHK_GraveDigger

Share this post


Link to post
Share on other sites
I've been trying to add a body cleanup script to a mission I'm making for about 6 hours now. I've tried nearly 20 different scripts and none of them had any effect. I know I'm not doing anything wrong, because most of them just require that you add the script to the init file. I don't understand what's going wrong. I know this one is intended for servers but I figured it would work just as well if I used it for my mission but still, nothing.

If none of the 20 scripts worked you might have been doing something wrong.

In every game there is a "server", it is merely a computer that is in control of everything. So your computer can be called "server" even if you are running singleplayer.

You gotta execute the script in init.sqf.

But the script has to be present in your mission folder:

0JKVbYA.png

Use -showScriptErrors to see the actual error.

Edited by aeroson

Share this post


Link to post
Share on other sites

Anyone know if there is a way to 'protect' items from getting removed with this script? Say for example you have some bodies you don't want to disappear, is there a way to protect them?

Share this post


Link to post
Share on other sites

Nice code, thanks for releasing it. BTW, the minimum delay is 10 seconds right? Since there's a sleep 10 on the top of the while loop.

Share this post


Link to post
Share on other sites

Updated repetitive_cleanup.sqf v1.8

@Meatball: If you want something to withstand the clean up, paste this into it's init:

this setVariable["persistent",true];

@wok: Yes if the delay is 3 seconds the time until removal will be between 3 and 10 seconds.

Share this post


Link to post
Share on other sites

Hi Aeroson,

Firstly, great script, using it in my mission and it works wonders on the carrier. Say I wanted to use this on remote airfields that are purely manned by enemy ai and are unlikely to have a human player within 100m, how would i get it to function at that airfield?

CHeers

Share this post


Link to post
Share on other sites

Thank you.

It eats items which are 100m from all units. All units include both player and AI.

Share this post


Link to post
Share on other sites

Random question on this script that I've been finding. I've got things setup to cleanup immobile vehicles after 15 minutes, but what I've found is if a vehicle gets 'wrecked', but you then repair it, it still gets cleaned up after 15 minutes, regardless of whether you're in it and driving :) There a way to reset the 'immobile' timer every time it's repaired or starts moving again?

Share this post


Link to post
Share on other sites

Anyone know how the script figures out what vehicles are immobile (_ttdVehiclesImmobile I think)? I believe that's the root of my issue with vehicles that are immobile and then repaired still get deleted after the immobile vehicle timeout even if they're currently functional.

Share this post


Link to post
Share on other sites

Yeah, I'm digging in the code a little bit and it looks like it parses through every vehicle in game looking to see if it's actually a player or if it can move:

if (_ttdVehiclesImmobile>0) then {		
	{
		if(!isPlayer _x && !canMove _x) then { 	 
			[_x, _ttdVehiclesImmobile] call _delete;
		}; 
	} forEach vehicles;
};

So, it looks like it looks at every vehicle every so often and if it's immobile/!player it throws it in an array called _objects. I'm just having trouble following the actual deletion of the object. If I can't figure out how to reset the flag on a vehicle once it's repaired, maybe I can at least figure out how to set immobile vehicles to blow up (setdamage 1) after a really short period of time so they're not lying around forever for people to repair.

---------- Post added at 04:03 ---------- Previous post was at 03:56 ----------

Think I'll try that, I'm going to set immobile vehicles to get 'deleted' after a relatively short period of time (120 seconds) and then change the actual delete block in the script to this:

{        
	if(isNull(_x)) then {
		_objects set[_forEachIndex, 0];
		_times set[_forEachIndex, 0];
	} else {
		if(_times select _forEachIndex < time) then {
			if(!isPlayer _x && !canMove _x) then {
			_x setDamage 1;
			} else {
			deleteVehicle _x;
			};
			_objects set[_forEachIndex, 0];
			_times set[_forEachIndex, 0];			 	
		};
	};	
} forEach _objects;

Assuming I'm doing this right, what should happen is every 2 minutes, any immobile vehicles around blow up. Which hopefully will keep players from finding them. Of course...if they do find them and happen to be in them... <BOOM>

Wish I could think of a better way to do it, but it's really goofy when players are driving a repaired vehicle around and then suddenly it disappears out from under them and the drop to the ground.

Share this post


Link to post
Share on other sites

I would simply run a canMove & crew count check after the timer but right before the vehicle is to be deleted. If the vehicle still can't move and has no crew, then delete it. I haven't taken a look at repetitive cleanup, but just throwing some ideas out there.

Share this post


Link to post
Share on other sites

Yeah, I'm finding the setDamage doesn't work well. Often as soon as you wreck a vehicle enough to make canMove true it blows up. I'll test with the crew count.

Only downside I can think of doing the crew count is the vehicle will still probably get nuked as soon as everyone gets out.

Edited by Meatball

Share this post


Link to post
Share on other sites

Updated repetitive_cleanup.sqf v1.9

v1.9

- Fixed: Mobile vehicles or vehicles with alive crew are now removed from cleanup list

Thank you all for excellent collaboration and ideas.

Share this post


Link to post
Share on other sites

Aeroson, that's awesome, thanks! Really appreciate this awesome script!

Quick question, is there any way that it's possible for vehicles that are repaired to be removed from the list awaiting cleanup? That crew check definitely fixes the problem of repaired vehicles disappearing with people in them, but what about a repaired vehicle that you drive somewhere and then get out? Really don't want that to get deleted as soon as everyone hops out either.

I also noticed that the 100m check doesn't seem to apply to the vehicle/body checks. That by design?

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

×