Jump to content
Sign in to follow this  
Tand3rsson

IED clearing with explosives or 50 cal rounds

Recommended Posts

Hi!

I have searched the forum some, but haven't found the answer for my question.

I want to be able to clear an IED I made with either a 50 cal sniper rifle or a satchel charge.

So I got this, added to the init of the object which needs to be damaged.

this addEventHandler ["HandleDamage",{(_this select 4) == "B_127x99_Ball_noTracer"}];

This makes it so that only the 50 cal triggers damage for the object. If I add:

this addEventHandler ["HandleDamage",{(_this select 4) == "PipeBomb"}];

Then only the pipebomb (satchel) damage the objective.

Question is: How do I add a eventHandler which works for both at the same time? I tried just adding the names like:

this addEventHandler ["HandleDamage",{(_this select 4) == "B_127x99_Ball_noTracer", "Pipebomb"}];

But that is obviously not working XD

Help please?

Share this post


Link to post
Share on other sites

Here mate.... Demo Mission here.

Put all of this into the init of the object..... or look at the demo and see a different more manageable way.

nul = this addEventHandler ["HandleDamage",{nul = [_this select 0, _this select 4] spawn {private ["_obj","_ammo"];_obj = _this select 0;_ammo = _this select 1;hint "hit";if (_ammo == "B_127x99_Ball_noTracer" or _ammo == "PipeBomb") then {hint "fired";_boom = createVehicle ["Sh_85_HE",position _obj, [], 0, "CAN_COLLIDE"];_obj removeAllEventHandlers "HandleDamage";deleteVehicle _obj;};};}];  

I think you are jumping in at the deep end though. There's a lot to understand before you start using Eventhandlers!

EDIT: Here's a link to a good thread... http://forums.bistudio.com/showthread.php?113418

Edited by twirly
Fixed broken link

Share this post


Link to post
Share on other sites

Little idea. Instead of comparing _ammo for each possibility separately like you do:


if (_ammo == "B_127x99_Ball_noTracer" or _ammo == "PipeBomb") then
[font=verdana]

[/font]

compare against a array:

if (_ammo in ["B_127x99_Ball_noTracer", "PipeBomb"]) then....

Makes it easer to add more classnames if required.

Share this post


Link to post
Share on other sites

One more thing,

If you are using BAF or PMC ied (or as Myke put it: IED in [bAF,PMC] ;)) then keep in mind the the eventhandler "HandleDamage" isn't working for them as in config file they are not land objects. Which leads me to asking when will BIS fix it?

BTW if that is the problem you can work around it by attaching it to an ammobox or something.

Share this post


Link to post
Share on other sites
Here mate.... Demo Mission here.

Put all of this into the init of the object..... or look at the demo and see a different more manageable way.

nul = this addEventHandler ["HandleDamage",{nul = [_this select 0, _this select 4] spawn {private ["_obj","_ammo"];_obj = _this select 0;_ammo = _this select 1;hint "hit";if (_ammo == "B_127x99_Ball_noTracer" or _ammo == "PipeBomb") then {hint "fired";_boom = createVehicle ["Sh_85_HE",position _obj, [], 0, "CAN_COLLIDE"];_obj removeAllEventHandlers "HandleDamage";deleteVehicle _obj;};};}];  

So everything about the IED is done, accept adding both the 12.7 and the Pipebomb to that eventhandler :)

I think you are jumping in at the deep end though. There's a lot to understand before you start using Eventhandlers!

EDIT: Here's a link to a good thread... http://forums.bistudio.com/showthread.php?113418

Thank you for your time!

However, I might have been just a bit off with my description of what I wanted to do:P

The object shot or blown isn't the real "IED". However, when it is damaged a IED man, who previously planted a BAF IED, gets a touchoff action.

So, as in my exampel above, all I wanted to do was to add both pipebomb and the 12,7 round to that kind of eventhandler, not spawn any munitions to fake the IED going off.

However, you are right about me in the deep end :) But, thats what I got you guys here for ;)

Anywho, thanks alot for your response!

---------- Post added at 07:57 PM ---------- Previous post was at 07:16 PM ----------

OK!

I solved it myself! :) :)

this addEventHandler ["HandleDamage",{if (_this select 4 in ["B_127x99_Ball_noTracer","PipeBomb"])}];

Was the thing I was looking for :)

THANKS for your time guys! Virtual beers to you all!

---------- Post added at 08:11 PM ---------- Previous post was at 07:57 PM ----------

If anyone wants to know:

I placed one man, namned IEDman1 on the map. I gave him a BAF_IED and told him to plant it right away in his init.

this addMagazine "BAF_ied_v2"; this Fire ["BAF_ied_v2_muzzle"];

Next I grouped him to a couple of markers (makes him spawn at one of them, randomly)

A trigger for the detonation (IED1T) is teleported to his posistion, also some garbage (which will be the "detonator")

IED1T setPos (getPos IEDman1); GARB1 setPos (getPos IEDman1);;

then I made his IED activation trigger (NAMNED IED1T):

Anybody present (8x8m)

Condition:

this && {_x iskindof "Landvehicle"} count thisList > 0

Act:

IEDman1 setPos (getPos IED1T); IEDman1 action ["TOUCHOFF", IEDman1]; deleteVehicle garb1; deleteVehicle IEDman1;

As anyone will notice: What I wanted to achive was an IED with a preasure pad (the condition makes it activate on ANY vehicle)

The reason I teleport the IEDman1 to the bomb is because the range of the TOUCHOFF is 300m, which dosent work for me.

GARB1, is the whole remote detonation thing, if BLUFOR detects the charge, they will be able to shoot or blow it getting the postistion of the IEDman1, just like the trigger.

Havent found that many good garbage iteams (garbage is good though),

I have yet another trigger for this BLUFOR detonation, which basically says:

con:

damage garb1 > 0;

and then the same detonation procedure :P

This is problem solving for those who suck at scripting ;)

---------- Post added at 08:14 PM ---------- Previous post was at 08:11 PM ----------

Alot of editing, I know.

Just wanted to clarify that I did this for 30 different IEDmen, which all has a random chance of spawning. So this way, I got random IEDs (about 10 per play at a 33% chance) and each has like.. 6 different locations :P The result is epic, although the way might be hard. And some guy will probably be able to do this all from a script, at much less effort :D

Edited by Tand3rsson

Share this post


Link to post
Share on other sites

[/color]

One more thing,

If you are using BAF or PMC ied (or as Myke put it: IED in [bAF,PMC] ;)) then keep in mind the the eventhandler "HandleDamage" isn't working for them as in config file they are not land objects. Which leads me to asking when will BIS fix it?

BTW if that is the problem you can work around it by attaching it to an ammobox or something.

This is what I'm looking for!!!

What do you mean by attaching to an ammo box or something? I tried that and the IED still gets destroyed by a Hum 50cal

What I'm trying to do is to force the destruction of the IED only whit C4 or Satchels, so you can't just shoot at it whit the 50 on a Humv (to easy) give the engineers some work.

This is what I put on the Init of the IED but it doesn't work

this addEventHandler ["HandleDamage", {if (_this select 4 in ["ACE_C4Explosion", "ACE_PipebombExplosion"])}];

It works if I put this script on a normal Garbage object but I want the tripwire of the IED, is there a solution for this? you mentioned attaching, can you be more specific please? because simple attaching to an object didn't work or I did something wrong.

Big thanks in advance.

Share this post


Link to post
Share on other sites

Create a garbage item. like an empty ammo box or something. Attach it to the object or just spawn it on the same location of the IED. Make it invisabel

garbageItem hideObject true;

and place the eventhandler on the object once the object detect the ammo type you want it to trigger. Trigger the actual IED or delete it.

Share this post


Link to post
Share on other sites
Create a garbage item. like an empty ammo box or something. Attach it to the object or just spawn it on the same location of the IED. Make it invisabel

garbageItem hideObject true;

and place the eventhandler on the object once the object detect the ammo type you want it to trigger. Trigger the actual IED or delete it.

Well no Joy, when I put the garbageItem hideObject true; script the object disappears of course but you can walk thru it also and shoot at the IED, I thought the object was not visible but was still there, any thoughts? oh well thanks for your time.

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  

×