Hi all! I'm working on the script to make this work. I'm borrowing heavily from the numerous existing scripts and examples but this is going in a slightly different direction. I'm at a stoppage right now. Whatever I do, I can't get the trigger to attach to the object. I've tried several different ways to do it and nothing is working like others have reported it should be working. I spent several hours last night tweaking the script. I think the correct way to do this is to use the "isKindOf" filter like others have posted:
this && ({_x isKindOf "SHIP"} count thisList) > 0
However I can't make this work at all. I have set it to "> 1". The reason I think "> 1" should work is that the water mine is a ship object so it behaves properly in water. Setting this line to the original "> 0" means the instant the mine is spawned the trigger is activated. It seems no matter how I configure it, it simply doesn't work so I am guessing there is a syntax error in how I'm trying to interrogate "thisList". Currently I can make the trigger activate with a simple "countType" so isKindOf may not be necessary. I have gotten it to work with _count > 0 but it doesn't seem to like when I add "this &&" as per the isKindOf example. The point of the _count usage is simple - only set off the mine if more than 1 ship object is in the trigger area. Mine = 1 ship; "any target ship" = 2 ship. That, from my understanding, should make the water mine behave properly.
The CURRENT problem is that the attachTo doesn't work with a trigger, although several posts say it should. I have added a marker to it so I can see where it is on the map. I'm setting it at 0,0,0 because I can't get it to accept the _pos variable no matter how I set it. Always get the "only one parameter was passed but there should be three" prompts in the RPT. So setting it at 0,0,0 and then attachTo the mine vehicle seems to be the logical solution. Thinking maybe it is sinking to the ground (below water level) I have tried setPosASL and it makes no difference.
Here's what I have right now after some more tweaking and trying different iterations - anyone smarter than me see what is probably an obvious script problem?
Code:
_mine = this select 0;
_count= "SHIP" countType thisList;
_pos = [(position _mine select 0), (position _mine select 1), (position _mine select 2)];
_trg = createTrigger ["EmptyDetector", [0, 0, 0]];
_trg setTriggerArea [1, 1, 0, false];
_trg setTriggerActivation ["ANY", "PRESENT", false];
_trg setTriggerStatements ["this && (_count > 1)", "hint 'trigger on'; _ammo = 'ARTY_Sh_82_HE' camCreate (getPos _mine); _mine setDamage 1; deleteVehicle _trg", ""];
//_trg attachTo [_mine,[0,0,0]]; // this didn't work either
_trg setPosASL [_mine, [0,0,0]];
sleep 3;
hint 'marker time';
_MINEMARKER = createMarker ['Water_Mine', [(position _trg select 0), (position _trg select 1)]];
_MINEMARKER setMarkerShape "ICON";
"Water_Mine" setMarkerType "Marker";
"Water_Mine" setMarkerText "Water Mine";