Jump to content
Sign in to follow this  
toxim

Crater cleaner and a bomb remover scripts

Recommended Posts

Ill post these here, maybe somebody can find these useful :)

Script that cleans up craters from the given area, left behind by blown up helicopters and planes.

Ever had to avoid craters at airfield during takeoff/landing? Those pesky craters have ruined my day several times..

/*
Author: -=XTRA=- tox1m

Description:
Cleans up craters from the given area.

Parameter(s):
1. Area size
2. Marker name

Example;
_cratercleaner = [1000, "my_airport"] execVM "cratercleaner.sqf"

*/

private ["_basemarker","_craters","_areasize","_base"];

_areasize 	= _this select 0;
_basemarker	= _this select 1;

_base = getMarkerPos _basemarker;

while {true} do 
{
_craters = nearestObjects [_base, ["CraterLong"], _areasize];
sleep 0.1;

if (count _craters > 0) then
{
	for "_i" from 0 to ((count _craters) - 1) do
	{
		private ["_crater"];
		_crater = _craters select _i;
		deleteVehicle _crater;
	};
};
sleep 10;
};

Script that cleans up certain type of bombs from the given area.

Might be useful against players who try to destroy your base.

/*
Author: -=XTRA=- tox1m

Description:
Cleans up bombs from the given area.
Uses nearObjects, since nearestObjects doesnt seem to work with bombs

Parameter(s):
1. Area size
2. Marker name

Example;
_bombdisposal = [1000, "my_airport"] execVM "bombdisposal.sqf"

*/

private ["_base","_bombs","_areasize","_basemarker","_bomb1","_bomb2","_bomb3"];

_areasize 	= _this select 0;
_basemarker	= _this select 1;

_base = getMarkerPos _basemarker;

while {true} do
{
_bomb1 = _base nearObjects ["Bo_GBU12_LGB", _areasize];
_bomb2 = _base nearObjects ["PipeBomb", _areasize];
_bomb3 = _base nearObjects ["Bo_FAB_250", _areasize];
_bombs = _bomb1 + _bomb2 + _bomb3; // Workaround since nearObjects doesnt seem to work with arrays

if (count _bombs > 0) then
{
	{deleteVehicle _x} foreach _bombs;
};
sleep 0.5; // Short sleep for catching all the bombs before damage occurs.
};

Edited by Toxim
typos

Share this post


Link to post
Share on other sites

Isn't a crater just an object? You could then 'sink' the object (z axis) into the ground slowly to pretend that it is getting filled in etc?

Good job though.

Share this post


Link to post
Share on other sites

Great job! Very usefull for perpetual missions.

Share this post


Link to post
Share on other sites

Just a quick question where does this line go

_bombdisposal = [1000, "my_airport"] execVM "bombdisposal.sqf"

Share this post


Link to post
Share on other sites
Isn't a crater just an object? You could then 'sink' the object (z axis) into the ground slowly to pretend that it is getting filled in etc?

Good job though.

Heh yeah that sinking would have been ideal - i just got lazy with the script :)

Just a quick question where does this line go

_bombdisposal = [1000, "my_airport"] execVM "bombdisposal.sqf"

Well you can put that in init.sqf, or into a trigger that activates at mission start. Propably with a condition for checking that it only runs on the server.

if (isServer) then {_bombdisposal = [1000, "my_airport"] execVM "bombdisposal.sqf"};

Edited by Toxim

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  

×