Jump to content
Stormmy1950

Minefield not deleting

Recommended Posts

Ok so the problem is next:

I have created minefield that spawns in the area that i want with Alias Minefield Script and that works perfect but i want that same minefield to be deleted so i can spawn it and delete it again and again.

here is my try of deleting the minefield:

_Mines = nearestObjects [player, [
	"timebombcore",
	"mineBase",
	"MineGeneric",
	"APERSBoundingMine",
	"APERSMine"
	], 100];
{ 		
	deleteVehicle _x;
	_x setDamage _Mines;
} forEach _Mines;

systemChat "Minefield has been deleted";

 

Share this post


Link to post
Share on other sites

_x setDamage _mines doesn't make any sense

Share this post


Link to post
Share on other sites

You don't need to set damage if you delete the object. If that doesn't work check the class names.

Share this post


Link to post
Share on other sites

i was just trying to make it eather it delet or explode  just so they are deleted.

but that dosent work and the class name of the mine is APERSMine so i know its right

 

Share this post


Link to post
Share on other sites

Yeah but for explosives the class name is not the cfgMagazines but ammo  try with APERSMine_Range_Ammo

Share this post


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

APERSMine is CfgVehicles

 

My bad! 

Share this post


Link to post
Share on other sites
10 minutes ago, Mr H. said:

My bad! 

nope I was right: just checked and placed a mine next to me
typeOf((nearestObjects [player, [], 200]) select 1);
returns
APERSMine_Range_Ammo

  • Like 1

Share this post


Link to post
Share on other sites
9 minutes ago, Mr H. said:

nope I was right

/*
    INCLUDE INHERITED ENTRIES: false
    SHOW CLASSES ONLY: false
    CONFIG PATH: bin\config.bin/CfgVehicles/APERSMine
    SOURCE ADD-ON(S): A3_Weapons_F_Explosives
*/

class APERSMine: MineBase
{
    author = "Bohemia Interactive";
    mapSize = 0.09;
    editorPreview = "\A3\EditorPreviews_F\Data\CfgVehicles\APERSMine.jpg";
    _generalMacro = "APERSMine";
    scope = 2;
    ammo = "APERSMine_Range_Ammo";
    displayName = "APERS Mine";
    icon = "iconExplosiveAP";
    picture = "\A3\Weapons_F\Data\clear_empty.paa";
    model = "\A3\Weapons_F\explosives\mine_ap";
    descriptionShort = "Type: Anti-personnel  mine<br />Rounds: 1<br />Used on: Ground";
    class Library
    {
        libTextDesc = "A classic pressure-activated anti-personnel mine is still widely used despite being prohibited by international conventions. When dug-in, they are very hard to detect without the help of a mine detector.";
    };
};

check it yourself

Share this post


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

check it yourself

As I said, I did. Once on the ground the object placed is class APERSMine_Range_Ammo so for the snippet @Stormmy1950 posted "APERSMine" doesn't work while "APERSMine_Range_Ammo" should

Share this post


Link to post
Share on other sites
4 minutes ago, Mr H. said:

So this is what i have right now but still the Mines are not deleting

_Mines = nearestObjects [player, [
	"APERSBoundingMine",
	"APERSMine",
	"APERSMine_Range_Ammo",
	"APERSMine_Range_Mag"
	], 100];
{ 		
	deleteVehicle _x;
} forEach _Mines;

systemChat "Minefield has been deleted";

And this is how i spawn them:

 

test_action7 = ["mcn_explosive","Spawn Minefield","",{null = ["marker_center",25,"APERSMine",25,false,false] execVM "Scirpts\Explosives\alias_mines.sqf";},{true}] call ace_interact_menu_fnc_createAction;   
[MineLaptop,0,["ACE_MainActions"],test_action7] call ace_interact_menu_fnc_addActionToObject; 

 

Share this post


Link to post
Share on other sites

ok after checking the other way around neither work my bad again

Share this post


Link to post
Share on other sites

Someone in the comments of nearestObjects says it doesn't work for grenades and that you should use nearobjects instead so maybe use that instead but use your original class names in the end I think @killzone_kid has it right not me

Share this post


Link to post
Share on other sites

BUT I used nearObjects recently to detect a grenade and had to check for the ammo. So just try and see.

Share this post


Link to post
Share on other sites

@killzone_kid Well i have  minefiled script that alias Created. that is just a funcion like addaction witch gives me the interaction on laptop with ace so i can spawn minefield But my delete mine script is not working for deleting mines

 

this is alias Script for minefield:

// nul = [] execVM "ambient\alias_mines.sqf";

private ["_al_ied_trigger","_al_show","_al_mine","_IED_blow_trigger","_mark_current","_array_temp","_field_center","_field_radius","_nclass_mines","_number_mines","_marker_mines","_debugs_mines","_nm","_markern","_pos_mine","_markerstr","_count_mark","_array_markers"];

if (!isServer) exitwith {};

_field_center = _this select 0;
_field_radius = _this select 1;
_nclass_mines = _this select 2;
_number_mines = _this select 3;
_marker_mines = _this select 4;
_debugs_mines = _this select 5;

_IED_blow_trigger = false;

_store_mine_array = false; // make this true if you want to store mines in array for later use

if ((_nclass_mines=="IEDLandBig_F") or (_nclass_mines=="IEDUrbanBig_F") or (_nclass_mines=="IEDUrbanSmall_F") or (_nclass_mines=="IEDLandSmall_F")) then {
_IED_blow_trigger = true; //_IED_blow_trigger = "APERSBoundingMine";
};

if (_marker_mines) then {

_array_markers = [];

{
	if ((markerType _x == "Empty") and (_x != _field_center) and (((getMarkerPos _x) distance (getMarkerPos _field_center))<=_field_radius)) then {
	_array_markers pushback _x;
	};
} forEach allMapMarkers;
//hint str _array_markers;
_count_mark = count _array_markers;
// ptr plasare precisa pe markere
if (_count_mark < _number_mines) then {hint "You need the number of markers to be equal or bigger for this to work as supposed to!!!"}
else {
	_array_temp = [];
	if (_count_mark >_number_mines) then {
		_nm =0;
//		if (_store_mine_array) then {_al_show = []};
		_al_show = [];		
		while {_nm<_number_mines} do {		
		_mark_current = _array_markers call BIS_fnc_selectRandom;
		_al_mine=createMine [_nclass_mines, getMarkerPos _mark_current, [], 0];
		if (_IED_blow_trigger) then {_al_ied_trigger = createMine ["APERSMine", getMarkerPos _mark_current, [], 0]};
		if ((_store_mine_array)and(_IED_blow_trigger)) then {_al_show pushBack [_al_mine,_al_ied_trigger]} else {_al_show pushBack _al_mine};
		_array_temp pushback _mark_current;
		_array_markers = _array_markers - _array_temp;
		if (_debugs_mines) then {_markern = format[ "markern_%1", str (_nm+1)];	_markerstr = createMarker [_markern,getMarkerPos _mark_current]; _markerstr setMarkerShape "ICON"; _markerstr setMarkerType "hd_dot"; _markerstr setMarkerColor "ColorRed"; hint str (_nm+1);};
		_nm=_nm+1;
		sleep 0.01;
		};		
		} else {
// ptr plasare aleator pe markere
		_nm =0;
		_jeton_marker = 0;
		//if (_store_mine_array) then {_al_show = []};
		_al_show = [];
		while {_nm<_number_mines} do {		
		_mark_current = _array_markers select _jeton_marker;
		_al_mine=createMine [_nclass_mines, getMarkerPos _mark_current, [], 0];
		if (_IED_blow_trigger) then {_al_ied_trigger = createMine ["APERSMine", getMarkerPos _mark_current, [], 0]};
		if ((_store_mine_array)and(_IED_blow_trigger)) then {_al_show pushBack [_al_mine,_al_ied_trigger]} else {_al_show pushBack _al_mine};
		if (_debugs_mines) then {_markern = format[ "markern_%1", str (_nm+1)];	_markerstr = createMarker [_markern,getMarkerPos _mark_current]; _markerstr setMarkerShape "ICON"; _markerstr setMarkerType "hd_dot"; _markerstr setMarkerColor "ColorRed"; hint str (_nm+1);};
		_nm=_nm+1;
		_jeton_marker=_jeton_marker+1;
		sleep 0.01;	
		};
	};
};
} else {
// ptr plasare aleator in zona
	_nm =0;
//	if (_store_mine_array) then {_al_show =[]};
	_al_show = [];	
	while {_nm<_number_mines} do {
	_pos_mine= [getMarkerPos _field_center,random _field_radius, random 360] call BIS_fnc_relPos;
	_al_mine = createMine [_nclass_mines, _pos_mine, [], 0];
	if (_IED_blow_trigger) then {_al_ied_trigger = createMine ["APERSMine", _pos_mine, [], 0]};
	if ((_store_mine_array)and(_IED_blow_trigger)) then {_al_show pushBack [_al_mine,_al_ied_trigger]} else {_al_show pushBack _al_mine};
	if (_debugs_mines) then {_markern = format[ "markern_%1", str (_nm+1)];	_markerstr = createMarker [_markern,_pos_mine];	_markerstr setMarkerShape "ICON"; _markerstr setMarkerType "hd_dot"; _markerstr setMarkerColor "ColorRed"; hint str (_nm+1);};
	_nm=_nm+1;
	sleep 0.01;
	};
};

systemChat "Minefield Created!";

/* in order to manipulate the mines stored in array you need to place your script that does that here like i did below,
if you want to use the array in another script you have to make _al_show global or public variable and of course to the array manipulation there
*/

//hint str _al_show;


/*
sleep 5;

for "_ii" from 0 to 40 do
{
	if (_IED_blow_trigger) then {((_al_show select _ii) select 0) setDamage 100} 
	else {(_al_show select _ii) setDamage 100};
	sleep 0.1+random 1;
};

 

and this is how i call it on laptop like addaction:

test_action7 = ["mcn_explosive","Spawn Minefield","",{null = ["marker_center",50,"APERSMine",25,false,true] execVM "Scirpts\Explosives\alias_mines.sqf";},{true}] call ace_interact_menu_fnc_createAction;  
[MineLaptop,0,["ACE_MainActions"],test_action7] call ace_interact_menu_fnc_addActionToObject;

and that all works but i cant delete the mines after i have created them

 

Share this post


Link to post
Share on other sites

The only way I could get the mine was with (player nearObjects ["MineBase", 200])
"APERSMine" didn't work, neither did "APERSMine_Range_Ammo"

Share this post


Link to post
Share on other sites

i have this now but this dosent work neither:

 

_list = player nearObjects ["MineBase", 100];
{
 deleteVehicle _x;
}forEach _list;

 

Share this post


Link to post
Share on other sites

My test mine was placed in editor so not created by script. Spawn the minefield and watch player nearObjects ["MineBase", 100]; see what it returns

  • Thanks 1

Share this post


Link to post
Share on other sites
1 hour ago, Stormmy1950 said:

nstead of "MineBase" i have used "mineBase

This should make 0 difference

Share this post


Link to post
Share on other sites

@killzone_kid yet somehow made diffrence.

 

so this works:

_list = player nearObjects ["mineBase", 100];
{
 _x setDamage 1;
 //deleteVehicle _x;
}forEach _list;

and this dosent work:

_list = player nearObjects ["MineBase", 100];
{
 _x setDamage 1;
 //deleteVehicle _x;
}forEach _list;

 

Share this post


Link to post
Share on other sites
2 hours ago, Stormmy1950 said:

and this dosent work

Sorry but you talk utter nonsense. The command is case insensitive
 

createMine ["APERSMine", position player, [], 0];
player nearObjects ["MineBase", 10];

result is [8: mine_ap.p3d] 

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

×