OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: greg147 on 08 Aug 2007, 18:00:45

Title: Detecting Mine Defusal
Post by: greg147 on 08 Aug 2007, 18:00:45
Hi all,

Is there a way to detect whether a group of editor-placed mines have been defused? I seem to remember seeing it in OFP, but couldn't find anything on the forums (or comref)

Thanks
Title: Re: Detecting Mine Defusal
Post by: Mandoble on 08 Aug 2007, 18:21:18
Code: [Select]
_mines = [mine1, mine2 ...];

_defused = {(isNull _x) || ((vectorUp _x select 2) < 1) ) } count _mines;
if (_defused > 0) then
{
   hint format["%1 mines defused", _defused];
};
Title: Re: Detecting Mine Defusal
Post by: greg147 on 08 Aug 2007, 18:35:00
Ah thanks. How would I call that? Tried acouple of ways but got 'type string, expected code' errors.
Title: Re: Detecting Mine Defusal
Post by: Mandoble on 08 Aug 2007, 18:37:22
If you prefer SQS:

Code: [Select]
;Defusedmines.sqs
_mines = [mine1, mine2 ...]

_defused = {(isNull _x) || ((vectorUp _x select 2) < 1)} count _mines
? _defused > 0:   hint format["%1 mines defused", _defused]
Title: Re: Detecting Mine Defusal
Post by: greg147 on 08 Aug 2007, 18:50:52
Ah, OK, thanks (I havn't worked out SQF yet, I tend to stick with SQS)


I get this error when I try to use the sqs version

Code: [Select]
'..._x) || ((vectorUP _x select 2) < 1) ) } |#|count _mines'
Error count: Type String, expected code

I must be calling the script up wrong. Where would you put [] exec "defusedmines,sqs" for this particular script?

Thanks
Title: Re: Detecting Mine Defusal
Post by: Mandoble on 08 Aug 2007, 19:47:01
Sorry, there was an extra ) there (fixed above).

Here is an example mission with the script in SQF format and using a position and radius instead of a list of mines.
Title: Re: Detecting Mine Defusal
Post by: greg147 on 09 Aug 2007, 17:25:55
Thanks, that works nicely.  :D
Title: Re: Detecting Mine Defusal
Post by: Mandoble on 15 Aug 2007, 16:32:44
Lee, your question has no relation at all with the current topic:defused mines, please open a new thread about the satchels.
Title: Re: Detecting Mine Defusal
Post by: zwobot on 20 Jan 2011, 20:58:16
I found this topic after a long search and tried out Mando's code in Arma2 OA to no avail.

Code: [Select]
vectorUP _x select 2returns any and
Code: [Select]
isNull mine1returns bool however putting this into a condition line of a trigger does not fire the trigger when the mine is active or deactivated.