Home   Help Search Login Register  

Author Topic: Detecting Mine Defusal  (Read 2647 times)

0 Members and 1 Guest are viewing this topic.

Offline greg147

  • Contributing Member
  • **
    • Royal Air Assault Battalion
Detecting Mine Defusal
« 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
Royal Air Assault Battalion - [L/Cpl] Greg
RAAB

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Detecting Mine Defusal
« Reply #1 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];
};

Offline greg147

  • Contributing Member
  • **
    • Royal Air Assault Battalion
Re: Detecting Mine Defusal
« Reply #2 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.
Royal Air Assault Battalion - [L/Cpl] Greg
RAAB

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Detecting Mine Defusal
« Reply #3 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]
« Last Edit: 08 Aug 2007, 19:44:39 by Mandoble »

Offline greg147

  • Contributing Member
  • **
    • Royal Air Assault Battalion
Re: Detecting Mine Defusal
« Reply #4 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
Royal Air Assault Battalion - [L/Cpl] Greg
RAAB

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Detecting Mine Defusal
« Reply #5 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.

Offline greg147

  • Contributing Member
  • **
    • Royal Air Assault Battalion
Re: Detecting Mine Defusal
« Reply #6 on: 09 Aug 2007, 17:25:55 »
Thanks, that works nicely.  :D
Royal Air Assault Battalion - [L/Cpl] Greg
RAAB

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Detecting Mine Defusal
« Reply #7 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.

Offline zwobot

  • Members
  • *
Re: Detecting Mine Defusal
« Reply #8 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.
"Executing tactics in real combat is the hardest thing one can ever do...well I've never given birth but..well whatever."