Jump to content
Sign in to follow this  
kerozen

Deleting every object with the same class name

Recommended Posts

I have a firing range with water ballons and a sign that can replace them, them problem is that it doesn't delete the remaining ballons so when you press the sign to replace it spawns new ballons on top of the old ones and both break.

 

How can i delete the old one so the new ones don't break?

 

ballons.sqf

private ["_objects","_object","_data"];
_data = [
	["Land_Balloon_01_water_F", [14310.3,15772.7,18.7783], [[0.252609,0.967568,0],[0,0,1]]],
	["Land_Balloon_01_water_F", [14310.8,15772.1,18.7786], [[0.252609,0.967568,0],[0,0,1]]],
	["Land_Balloon_01_water_F", [14311.4,15771.5,18.7786], [[0.252609,0.967568,0],[0,0,1]]],
	
	["Land_Balloon_01_water_F", [14380.1,15845.7,18.7786], [[0.252609,0.967568,0],[0,0,1]]],
	["Land_Balloon_01_water_F", [14380.7,15845.1,18.7786], [[0.252609,0.967568,0],[0,0,1]]],
	["Land_Balloon_01_water_F", [14381.2,15844.5,18.7786], [[0.252609,0.967568,0],[0,0,1]]],
	
	["Land_Balloon_01_water_F", [14448.2,15918.8,18.7786], [[0.252609,0.967568,0],[0,0,1]]],
	["Land_Balloon_01_water_F", [14448.8,15918.2,18.7786], [[0.252609,0.967568,0],[0,0,1]]],
	["Land_Balloon_01_water_F", [14449.3,15917.6,18.7786], [[0.252609,0.967568,0],[0,0,1]]],
	
	["Land_Balloon_01_water_F", [14517.5,15993.9,18.7753], [[0.252609,0.967568,0],[0,0,1]]],
	["Land_Balloon_01_water_F", [14516.9,15994.4,18.7745], [[0.252609,0.967568,0],[0,0,1]]],
	["Land_Balloon_01_water_F", [14518,15993.2,18.776], [[0.252609,0.967568,0],[0,0,1]]],
	
	["Land_Balloon_01_water_F", [14583.9,16070.4,18.7786], [[0.252609,0.967568,0],[0,0,1]]],
	["Land_Balloon_01_water_F", [14584.5,16069.8,18.7786], [[0.252609,0.967568,0],[0,0,1]]],
	["Land_Balloon_01_water_F", [14585,16069.2,18.7786], [[0.252609,0.967568,0],[0,0,1]]],
	
	["Land_Balloon_01_water_F", [14648.1,16146.1,18.8893], [[0.252609,0.967568,0],[0,0,1]]],
	["Land_Balloon_01_water_F", [14648.6,16145.6,18.8793], [[0.252609,0.967568,0],[0,0,1]]],
	["Land_Balloon_01_water_F", [14649.2,16144.9,18.8689], [[0.252609,0.967568,0],[0,0,1]]],
	
	["Land_Balloon_01_water_F", [14712.2,16220.6,18.7149], [[0.252609,0.967568,0],[0,0,1]]],
	["Land_Balloon_01_water_F", [14712.7,16220,18.715], [[0.252609,0.967568,0],[0,0,1]]],
	["Land_Balloon_01_water_F", [14713.3,16219.4,18.7152], [[0.252609,0.967568,0],[0,0,1]]]
];
_objects = [];
{
	_object = (_x select 0) createVehicle (ASLToAGL(_x select 1));
	_object setVectorDirAndUp (_x select 2);
	_object setPosASL (_x select 1);
	_object enableSimulationGlobal true;
	_objects pushBack _object;
} forEach _data;
_objects;

 

Share this post


Link to post
Share on other sites

Found a solution:

 

_delete = nearestObjects [player, ["Land_Balloon_01_water_F"], 1000];
{deleteVehicle _x;}foreach _delete;

 

  • Like 2

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  

×