Jump to content

Photo
- - - - -

Need help making a new mine type


  • Please log in to reply
16 replies to this topic
Thread Starter
hcpookie
hcpookie

    Master Gunnery Sergeant

  • Members
  • 1023 posts

Posted 01 April 2012 - 02:51 #1

I am working on a water mine (or nautical mine, if you prefer) in anticipation of the underwater diving module. I'm stumped.

It seems that making a new mine that inherits from the default mines (Minemine and MineMineE) doesn't work. Arma complains with all the "no entry..." errors. The issue APPEARS to be that the MineGeneric vehicle - which is the (private) parent of the mines in the cfgVehicles section - is a "root" object. It doesn't inherit from default; it is simply "class MineGeneric". So I tried adding the mine as a Buoy - no problems. It is a mine-shaped buoy! :) This is it ingame as a mean-looking buoy:

Posted Image

Anything I do trying to get the mine to appear in-game either generates the "no entry" errors or causes an access violation. I looked at other mine addons, and no one has done what I am trying to do... inherit from the default mine configs. For example, JTD Mines uses a nonstrategic "Thing" object, and scripts. The SC9 naval buoy (from Arma) used a trigger in the init to damage nearby vehicles. If there's a mine object that inherits from defaults I've overlooked it. So it seems to me that the default BIS mines are hard-coded in such a way that hinders the addition of more mines.

Here is my config - as you can see, it is copied/pasted from the default mine configs. I've tried several different iterations (including changes to the inheritance as per the weapons_e config) and nothing changes the behavior. The issue is always a problem with the Vehicle section.

Thoughts?

Spoiler


abs
abs

    Warrant Officer

  • Members
  • 2427 posts

Posted 01 April 2012 - 03:23 #2

I don't see why BIS would do that.

Can you put in the exact error messages you're getting, please? :)

Abs
My Projects:
Posted Image
RHS Contributor | Former ONS Member | Former W'39 Member
I will not be taking part in the contest, but I support it 100%! Great idea, BIS!

Thread Starter
hcpookie
hcpookie

    Master Gunnery Sergeant

  • Members
  • 1023 posts

Posted 02 April 2012 - 14:41 #3

I think something is hard-coded and it only looks for those two entries (but I'm hoping not!) so I think it is accidental. Something to do with the thoughts that a mine is technically a vehicle (like static guns) that is activated by another vehicle.

If I borrow a page from the JTD Mines playbook and make the mine inherit from "Thing", it becomes a static object that does nothing.

If I make the mine inherit from the "BuoySmall" object, it becomes a mine-shaped buoy and has no explosive interaction with anything.

If I add the "vehicleClass = "Mines";" to the config and it doesn't inherit from the "MineGeneric" weapon vehicle, it will AV with nothing in the report. >>> This is what leads me to guess there is something hard-coded or otherwise a non-config issue.

EDIT: As I'm typing this I thought of a hack that might work as a suitable workaround - using an init script to "attachto" a default mine to it. I'm not sure if it needs the "put" action to arm it but that should be scriptable.

Here's the RPT from my config that inherits directly from the MineMine vehicle. Same AV whether it inherits from "MineMine", "MineMineE", or "MineGeneric". It allows you to place it in the editor, then AV's to desktop when you try to preview. The first few "no entry" is perhaps the most telling - note that it says "no entry" for the MineMine vehicle, which I copied directly out of the BIS config.


Warning Message: No entry 'bin\config.bin/CfgVehicles/pook_watermine.simulation'.
Warning Message: '/' is not a value
Unrecognized CfgVehicles simulation in bin\config.bin/CfgVehicles/pook_watermine/
Warning Message: No entry 'bin\config.bin/CfgVehicles/pook_watermine.simulation'.
Warning Message: '/' is not a value
Warning Message: No entry 'bin\config.bin/CfgVehicles/MineMine.simulation'.
Warning Message: '/' is not a value

I removed the AV details from the dump:
Spoiler

Edited by hcpookie, 02 April 2012 - 14:44.


Thread Starter
hcpookie
hcpookie

    Master Gunnery Sergeant

  • Members
  • 1023 posts

Posted 09 April 2012 - 16:38 #4

Well no matter what, I can't get the mine to behave like I want it to. Regardless of how it is configured, or what model it uses, it will still only react to ARMOR class vehicles. So if a non-armor class vehicle approaches it, it simply won't do anything. So the mine inheritance question seems to be a hard-coded config that is intended to make the anti-tank mines work ONLY as anti-tank mines, which makes sense when you think about it like that. SO... unless I find something else, I think I'm forced to use an event handler solution to make the mine trigger against SHIP class vehicles.

Thread Starter
hcpookie
hcpookie

    Master Gunnery Sergeant

  • Members
  • 1023 posts

Posted 10 April 2012 - 14:40 #5

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?

_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";


Sealife
Sealife

    Banned

  • 1362 posts

Posted 10 April 2012 - 17:22 #6

Hmm
Maybe you can make a buoy class item and give it very low armour but big destruction value
Thi is just idea , I know it's possible but wether the ability to destroy a near object is possible without script would need investigation .

Thread Starter
hcpookie
hcpookie

    Master Gunnery Sergeant

  • Members
  • 1023 posts

Posted 10 April 2012 - 17:51 #7

I'm really close... I cna manually make a trigger that activates when a ship comes near it and blows up the ship. So I'm certain this will work. the problem is my script-fu is weak :)

I've been looking over some script examples and I'm going to try a few more things I haven't attempted yet. I'm guessing that my script is incorrectly written and so no info is getting passed along to the trigger.

Thread Starter
hcpookie
hcpookie

    Master Gunnery Sergeant

  • Members
  • 1023 posts

Posted 11 April 2012 - 19:35 #8

Making progress! Sat down with a cup of coffee and worked through my problem. I wasn't properly passing "this" and now it is partially working. I found a new problem of course LOL

// if (isDedicated) exitWith {};

_mine = _this;
_pos = getPos _mine;

_trg = createTrigger ["EmptyDetector", _pos];
_trg setTriggerArea [5, 5, 0, false];
_trg setTriggerActivation ["ANY", "PRESENT", false];
_trg setTriggerStatements ["{_x in thislist && _x iskindof 'SHIP'} count vehicles > 1", "hint 'trigger on'; _ammo = 'ARTY_Sh_82_HE' camCreate (getPos _trg); _mine setDamage 1; deleteVehicle _trg; deleteMarker _minemarker", ""];
_trg attachTo [_mine,[0,0,0]];

_minemarker = createMarker ['naval_mine', position _mine];
_minemarker setMarkerShape "ICON";
"naval_mine" setMarkerType "Warning";
"naval_mine" setMarkerText "Naval Mine";

This works for everything EXCEPT creating the bomb! This is the line:

_trg setTriggerStatements ["{_x in thislist && _x iskindof 'SHIP'} count vehicles > 1", "hint 'trigger on'; _ammo = 'ARTY_Sh_82_HE' camCreate _pos; _mine setDamage 1;

... where:

"{_x in thislist && _x iskindof 'SHIP'} count vehicles > 1",

= the condition,

"hint 'trigger on'; _ammo = 'ARTY_Sh_82_HE' camCreate _pos; _mine setDamage 1; deleteVehicle _trg; deleteMarker _minemarker",

= On Activation.

All I get is the hint. Nothing else will activate. Now, when I manually create a trigger in the editor, I can make it work fine with this:

_ammo = 'ARTY_Sh_82_HE' createVehicleLocal (position mine)


... and in the mine's INIT:
scr = this execVM "mines.sqf";


Unfortunately it seems that the use of "_mine" is not equal to "mine" in the editor (named object). I've tried several different methods including an array with getpos select 0, getpos select 1, etc. and it complains with "type any, expected number". So what I think is happening is I'm telling it to create the object at the variable location, not at the OBJECT location. I think. So what I need to do is have the camcreate happen "at" the trigger. I'm just not sure how to do that. In the editor it is easy - the named object "mine" is the focus of the commands and it works like a charm.

If I use "hint str(position _trg);" or "hint str(position _mine);" in the script, I get a valid location.

So I think I'm asking how to pass an unnamed object's identity to the trigger? I expected "_mine" to have been correct since "_mine = this" (the mine object).

_William
_William

    Staff Sergeant

  • Members
  • 262 posts

Posted 12 April 2012 - 19:56 #9

How about trying to retrieve the trigger's 'attachedObject' in the trigger statements instead of passing the _mine in? (Haven't tested this).
www.plannedassault.com - your web based mission generator for large scale combined arms battles

Thread Starter
hcpookie
hcpookie

    Master Gunnery Sergeant

  • Members
  • 1023 posts

Posted 17 April 2012 - 14:19 #10

I tried that and didn't get anything back. In fact it seems the only thing I'm not doing properly is passing the right information in the "on activation" part of the trigger. I had an idea last night to have the trigger exec a 2nd script, so I will try to do all the "getpos" stuff in the 2nd script by using "_this" which should be the trigger. I will try that tonight or tomorrow.

FallujahMedic(FM)
FallujahMedic(FM)

    Staff Sergeant

  • Members
  • 292 posts

Posted 17 April 2012 - 15:06 #11

Damn, you beat me to the Naval Mine idea. Since the default mines only react to Armor class (and not boats/ships) maybe mies wouldnt be the best idea. Could you attach-to a Satchel or IED and do like you said above with the trigger for watercraft?

Thread Starter
hcpookie
hcpookie

    Master Gunnery Sergeant

  • Members
  • 1023 posts

Posted 18 April 2012 - 23:34 #12

Making progress. Unsure as to why this fails. It works GREAT if I add this to the INIT in the editor:

[COLOR="#FF0000"]str = this execVM "\pook_water\data\scripts\init_watermine.sqf";[/COLOR]

Here's my working script:

if (isDedicated) exitWith {};

_mine = _this;
_pos = [(getPos _mine select 0), (getPos _mine select 1), 0];

activated = false;

hint str(_pos);

_minemarker = createMarker ['naval_mine', _pos];
_minemarker setMarkerShape "ICON";
"naval_mine" setMarkerType "Warning";
"naval_mine" setMarkerText "Naval Mine";


_trg = createTrigger ["EmptyDetector", _pos];
_trg setTriggerArea [5, 5, 0, false];
_trg setTriggerActivation ["ANY", "PRESENT", false];
_trg setTriggerStatements ["{_x in thislist && _x iskindof 'SHIP'} count vehicles > 1;", "activated = true", ""];
_trg attachTo [_mine,[0,0,0]];

waitUntil {activated};
_mineammo = "ARTY_Sh_82_HE" createVehicleLocal _pos;

And the config that calls it:

class pook_watermine: BuoySmall {
		scope = 2;
		model = "\pook_water\pook_watermine.p3d";
		displayName = "Naval Mine (medium)";
		icon = "\pook_water\data\mapicon.paa";
		mapSize = 2;
		armor = 1;
		camouflage = 0.03; // sniper 0.6, man 1.0, buoy 0.001
		accuracy = 2000; // difficult to detect, default - 0.2, sniper 3.5, man 1000

		class DefaultEventhandlers;
		class EventHandlers: DefaultEventhandlers {
			[COLOR="#FF0000"]init = "scr = this execVM ""\pook_water\data\scripts\init_watermine.sqf""; ";[/COLOR]
		};




The INIT is the same. So... why doesn't it work in the addon without adding it to the INIT of the editor? :confused:

FallujahMedic(FM)
FallujahMedic(FM)

    Staff Sergeant

  • Members
  • 292 posts

Posted 20 April 2012 - 19:32 #13

Any luck yet?
Posted Image

Sealife
Sealife

    Banned

  • 1362 posts

Posted 20 April 2012 - 20:36 #14

Probably because. This in the init is not anything known or defined , try [] or ( this select 0) or may even require _. Been too long to recall but it's one of them

Thread Starter
hcpookie
hcpookie

    Master Gunnery Sergeant

  • Members
  • 1023 posts

Posted 27 April 2012 - 02:59 #15

Thromp that helped immensely! I can get a single mine to work now! :) I'm using a variable to keep it simple, so now I know it works. Next step - get this to work with the conditions within the trigger:

Spoiler


The "activated" trigger is of course global so more than 1 mine in the mission doesn't work too well. SO - what I think needs to happen is the createVehicle part needs to happen in the trigger init. The issue I have is passing the _pos to the trigger, so I need to figure a way to set that for the trigger. Again, works fine in the editor if I create a trigger and everything is named.

EDIT - forgot to document what worked in the config:

init = "scr = [(_this select 0)] execVM ""\pook_water\data\scripts\init_watermine.sqf""; ";




Also, "thisTrigger" does the job! Still need to figure why the mine doesn't die when the trigger fires but overall it is working! :cool:

Edited by hcpookie, 27 April 2012 - 03:27.


Thread Starter
hcpookie
hcpookie

    Master Gunnery Sergeant

  • Members
  • 1023 posts

Posted 27 April 2012 - 14:47 #16

Finished!

_William, the attachedObject command only returns a LOCATION! It seems that is useful for things like city centers, etc. but didn't work in this case. Had to use nearestObject to make it work correctly.

The 'pook_minemed' weapon is a new bomb ammo with a large enough indirectHit value to make the mines effective even when you are going at top speed through the mines. You can substitute a Mk82 or anything really. You'll have to deal with the fact that the bomb model appears at the instant it fires. The 'pook_minemed' bomb ammo uses the granat 3D object to minimize the 'look'.

I don't know if the trigger NEEDS to be deleted after it fires, but it can't hurt, right?



Still using the previous mentioned INIT:

// medium mine

if (isDedicated) exitWith {};

_mine = _this select 0;
_pos = [(getPos _mine select 0), (getPos _mine select 1), 0.25];

_trg = createTrigger ["EmptyDetector", _pos];
_trg setTriggerArea [5, 5, 0, false];
_trg setTriggerActivation ["ANY", "PRESENT", false];
_trg setTriggerStatements ["{_x in thislist && _x iskindof 'SHIP'} count vehicles > 1;", "hdl = 'pook_minemed' createVehicleLocal [(getPos thisTrigger select 0), (getPos thisTrigger select 1), 0.25]; _locAttachedObj = nearestObject position thisTrigger; deleteVehicle _locAttachedObj; deleteVehicle thisTrigger", ""];
_trg attachTo [_mine,[0,0,0]];


Here's the NEW problem- been working with boats. But the amphibious ARMORED vehicles aren't working. Because of this:

EDIT - FIXED! Now explodes if amphibious vehicles OR boats come near! I had to tweak the trigger SIZE from 2,2 to 5,5 because the way the vehicle distance is detected appears to be from the centerpoint. This makes amphib vehicles bump into the mines before the trigger can fire, causing "dud" mines. SO IT WORKS! :)

// medium mine

if (isDedicated) exitWith {};

_mine = _this select 0;
_pos = [(getPos _mine select 0), (getPos _mine select 1), 0.25];

_trg = createTrigger ["EmptyDetector", _pos];
_trg setTriggerArea [5, 5, 0, false];
_trg setTriggerActivation ["ANY", "PRESENT", false];
_trg setTriggerStatements ["({_x in thislist && (_x iskindof 'SHIP')} count vehicles > 1) || ({_x in thislist && (_x iskindof 'LANDVEHICLE')} count vehicles > 0)", "hdl = 'pook_minemed' createVehicleLocal [(getPos thisTrigger select 0), (getPos thisTrigger select 1), 0.25]; _locAttachedObj = nearestObject position thisTrigger; deleteVehicle _locAttachedObj; deleteVehicle thisTrigger", ""];
_trg attachTo [_mine,[0,0,0]];

Edited by hcpookie, 27 April 2012 - 16:29.


FallujahMedic(FM)
FallujahMedic(FM)

    Staff Sergeant

  • Members
  • 292 posts

Posted 28 April 2012 - 20:35 #17

got a vid of it in action?
Posted Image