Jump to content
Sign in to follow this  
arye_r

Mines & Pipe Bombs

Recommended Posts

Hey guys.

I wanna make mines/pipebombs explode if they're shot upon or when a nearby explosion occurs.

For enemy mines the only way to get rid of them is using an engineer, but no such option with pipebombs.

Ideas anyone?

Share this post


Link to post
Share on other sites

You could modify the CfgVehicles entries for "Man".

Adding a "Fired" eventhandler.

The script which exec's when the unit fires simply checks the ammo type which is fired from the player. If the ammo type is a pipebomb, that could then exec another script which sets up a trigger or while loop around your pipebomb.

If this trigger or while loop becomes true, it does what you want, which in this case is explode the pipebomb.

Hope that makes sense.

Share this post


Link to post
Share on other sites

Thanks Nullsystems.

Can you provide me with some more specific guidelines?

Or any other ways to implement this feature, like changing the configs of the ammo types maybe, i dunno...

Just got back from a MOUT drill and I'm desperately trying to reproduce it in-game ;)

Again, thanks for the help!

Share this post


Link to post
Share on other sites

In ACE we made Claymores destructible by making them an ammobox type object with armor low enough to react to bullets and nearby explosions. We also assigned a killed eventhandler to it, which allowed us to randomize the effects (explosion or simple removal). You can check ace_sys_explosives.pbo for reference.

Share this post


Link to post
Share on other sites

@Q1184

Thanks mate, awesome, I got the code, here it is :

class cfgVehicles
{
class ReammoBox;
class ACE_Pomz: ReammoBox
{
	model="\ace_sys_explosives\data\pomz\m\ace_pomz.p3d";
	class TransportMagazines
	{
	};
	forceSupply=0;
	showWeaponCargo=0;
	transportMaxMagazines=0;
	transportMaxWeapons=0;
	nameSound="";
	armor=20;
	armorstructural=1;
	destructype="DestructMan";
	class EventHandlers
	{
		killed="[_this select 0] execVM ""\ace_sys_explosives\data\pomz\s\onDestroyed.sqf""";
	};
};
class ACE_Claymore: ReammoBox
{
	model="\ace_sys_explosives\data\clay\m\claymore.p3d";
	class TransportMagazines
	{
	};
	forceSupply=0;
	showWeaponCargo=0;
	transportMaxMagazines=0;
	transportMaxWeapons=0;
	nameSound="";
	armor=20;
	destructype="DestructMan";
	class EventHandlers
	{
		killed="[_this select 0] execVM ""\ace_sys_explosives\data\clay\s\onDestroyed.sqf""";
	};
};
};

Now, where do i find the Mine, EMine and Pipebomb CfgVehicle classes? Tried Ca, weapons, weapons2, misc, misc2, misc3 configs, no luck so far.

So i feel a little dumb and helpless...

Any idea where to find them and what to change there so it works?

Share this post


Link to post
Share on other sites

You have several kinds of Configs, including; CfgVehicles ( for men, vehicles, houses and alike ), CfgWeapons, CfgMagazines and CfgAmmo ( for weapons, mags and their ammo ).

Those items are not CfgVehicle classes, as they are Weapons ;)

So your best looking in Weapons/Weapons2.

There is a kind of hirarchy system with configs.

Eg:

CfgWeapons

> CfgMagazines

>> CfgAmmo

First the weapon is defined in CfgWeapons. This file also informs us of what Magazine is used...

Open up CfgMagazines and find the corresponding Magazine. This file then informs us of what ammo the magazine uses...

Open up CfgAmmo and you get the actual ammo which is fired from a weapon.

Hope this makes more sense.

My advice is to pick ONE weapon to look at, M9 is a simple one.

Try modifying the M9 in some way in each of the Cfg's. For example, make it rapid fire or use explosive ammo.

This might help you understand how each config works in relation to each other and how you can change the ammo/mag type of a weapon.

Then move onto copying and renaming a MINE or PIPEBOMB. Then adding extra features, changes or event handlers as discussed above :)

http://community.bistudio.com/wiki/CfgWeapons_Config_Reference

http://community.bistudio.com/wiki/CfgAmmo_Config_Reference

Share this post


Link to post
Share on other sites

@Nullsystems

That was amazingly helpful dude.

Thanks again.

I'll see what I can do with all that and let you guys know.

Meanwhile if you have any more suggestions/ideas/tips, I'll be more than happy.

---------- Post added at 05:37 PM ---------- Previous post was at 04:40 PM ----------

Ok... I'm completely lost.

I did find the reference to Pipebombs & Mines under CfgMagazines in weapons.pbo config.

This is what it looks like :

class TimeBomb: CA_Magazine
{
	scope=1;
	displayName="$STR_MN_TIME_BOMB";
	picture="\CA\weapons\data\equip\m_satchel_CA.paa";
	useAction=1;
	useActionTitle="$STR_ACTION_PUTBOMB";
	type="2 * 		256";
	value=5;
	ammo="TimeBomb";
	count=1;
	initSpeed=0;
	maxLeadSpeed=0;
	nameSoundWeapon="satchelcharge";
	nameSound="satchelcharge";
	sound[]=
	{
		"\ca\Weapons\Data\Sound\gravel_L",
		0.000316,
		1,
		10
	};
	descriptionShort="$STR_DSS_TimeBomb";
};
class Mine: TimeBomb
{
	scope=2;
	displayName="$STR_MN_MINE";
	picture="\CA\weapons\data\equip\m_AT15_ca.paa";
	ammo="Mine";
	nameSoundWeapon="mine";
	nameSound="mine";
	descriptionShort="$STR_DSS_MINE";
};
class MineE: TimeBomb
{
	scope=2;
	displayName="$STR_MN_MINE";
	picture="\CA\weapons\data\equip\m_TM46_ca.paa";
	ammo="MineE";
	nameSoundWeapon="mine";
	descriptionShort="$STR_DSS_MINE_E";
};
class PipeBomb: TimeBomb
{
	scope=2;
	displayName="$STR_MN_PIPE_BOMB";
	value=5;
	ammo="PipeBomb";
	count=1;
	initSpeed=0;
	maxLeadSpeed=0;
	nameSoundWeapon="satchelcharge";
	nameSound="satchelcharge";
	useAction=1;
	useActionTitle="$STR_ACTION_PUTBOMB";
	sound[]=
	{
		"\ca\Weapons\Data\Sound\gravel_L",
		0.000316,
		1,
		10
	};
	descriptionShort="$STR_DSS_Pipe_Bomb";
};

But what do i do now? Can i add armor value to them? And how? Or should i transform them into ammocrates first like in A.C.E Claymore example above? And how do I do that??? ;)

Oh god...

So many questions!!!!

Help!!!!!

;)

Share this post


Link to post
Share on other sites

To use the destructiblle object trick you'll have to replace the stock explosive handling with scripted one. Roughly it's setup like this: there's a dummy magazine to represent the explosive device in inventory. A user action scans inventory and gives the option to place the explosive if this dummy magazine is present. When this action is performed, the mag is removed and the destructible object is created on the ground. A set of actions are added to the player and/or object (in satchel's case those would be 'set timer', 'touch off' and alike, in mine's case you might want to add 'deactivate mine' or something similar). Proximity triggers might be added in case of mines and tripwires. You can refer to the sys_explosives pbo for details.

Edited by Q1184

Share this post


Link to post
Share on other sites

OK. That makes sense.

The only problem is that I still have no idea how to implement all the above, me being pretty much a "grade D" amateur scripter...

Q1184, Nullsystems, your replies are very helpful, and I'm learning bit by bit but for me it's all still very vague and unclear and i feel like i walk in total darkness, seeing only a couple of green lights flashing from time to time far in the distance ;)

The reason I got into this thing in the first place is because realism is the most important thing for me in-game, and being a combat engineer and seeing explosives not going off by nearby explosions just feels SO wrong...

Like, you make a mission where your company is advancing through a street, and there's mines and IEDs all over the place, and there's nothing you can do!!!!

Frustrating ;)

So I'm gonna try to learn how to do it myself anyway, but it's gonna take time.

Meanwhile, if those of you who eat scripting for breakfast can provide clear and specific guidelines (like in those "for dummies" books), or make some scripts of your own (and take credit for them!!!) - I think the whole community will benefit!

Off to Biki, and waiting for you help.

P.S.

Another thing i wanted to do is this :

If a team is advancing and enemy mines/pipebombs are detected nearby (i think this will have something to do with "nearestobject"?), the team will halt, defend perimeter, and call an engineering team, if available (like calling a Support Ambulance maybe?), providing them with obstacle coordinates. Then the engineering team will deal with the threat, either by disarming it or initiating it by .05/C4.

What do you think?

And how do we do it??? ;)

Let's go people!

Edited by arye_r

Share this post


Link to post
Share on other sites

Ok, a couple of hours of banging my head on the wall have passed and I wrote a simple script :

_soldier = _this select 0

#sweep
_nminev = nearestObject [vehicle _soldier, "MineE"]
_nmine = nearestObject [_soldier, "MineE"]
if ((getpos _nminev select 0) != 0) then  {hint format ["Mine!!!, %1", getpos _nminev]; dostop vehicle _soldier;  _marker1 = createMarker 

["Marker1", position _nminev]; "Marker1" setMarkerType "Dot"; "Marker1" setMarkerColor "ColorRed"; "Marker1" setMarkerText "Mine";goto 

"thenwhat"}  

if ((getpos _nmine select 0) != 0) then {hint format ["Mine!!!, %1", getpos _nmine]; dostop _soldier; _marker2 = createMarker ["Marker2", 

position _nmine]; "Marker2" setMarkerType "Dot"; "Marker2" setMarkerColor "ColorRed"; "Marker2" setMarkerText "Mine"; goto "thenwhat"}  
~1
goto "sweep"

#thenwhat

exit

Now.

What i wanna do is make the script suitable for OPFOR as well, and make the vehicle stop only if the mine is in the direction the vehicle is going (probably some trig functions will go here), plus letting all friendly forces know about that. Another question is how to get awareness of multiple mines (script is working only for one), how do I put an integer into a string, e.g if there's a loop and a counter

and i wanna name those mines "Mine1", "Mine2", "Mine3", etc., using "Mine + _i" when _i is the counter?

And should I convert all that into an sqf? And why? And if yes, then how??

Help people! ;)

And don't forget about the main reason I started this thread for.

The latest is a secondary objective as they call it...

Edited by arye_r
1 problem solved, more questions added

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
Sign in to follow this  

×