Jump to content
brians200

How do you find out what type of explosive hit an object?

Recommended Posts

Hello,

I am trying to determine what type of explosive (hand grenade, explosive charge, satchel, etc...) hits an object that is not a soldier or vehicle.

For example, if I have "Land_Bricks_V2_F" and throw a grenade next to it, I would like to be able to detect that and know it was a grenade.

If I have a soldier or vehicle ("B_MRAP_01_F" for example), I can detect what hit it several ways:

this [url="http://community.bistudio.com/wiki/addEventHandler"]addeventhandler [/url]["[url="http://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HitPart"]HitPart[/url]", {hint format["%1",_this select 0 select 6 select 4]}] //check the first hit, for example

this [url="http://community.bistudio.com/wiki/addEventHandler"]addeventhandler [/url]["[url="http://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage"]HandleDamage[/url]", {hint format["%1",_this select 4]}]

However, if I try to apply this to an object, like "Land_Bricks_V2_F", it does not produce the desired results...

The first bit of code will detect bullets hitting it, but not explosions.

The second bit of code is never fired and thus acts like nothing happens.

The objects will fire the "Explosion" event, however, that does not tell me what type of explosive it was and does not fire on rocket explosions...

If anybody has any advice on this matter, I would appreciate it.

Share this post


Link to post
Share on other sites

Nope. Firednear doesn't work for explosions on servers. :(

Share this post


Link to post
Share on other sites

this script detects explosions:

//nul = [this,25] execVM "exploDetector.sqf";

private ["_list","_unit","_range","_target","_class","_fired","_fnc_exb"];

_fnc_exb = 
{
_item = _this select 0;
_class = typeOf _item;
waitUntil {!(alive _item)};
player sidechat format ["%1 exploded",_class];
};


_unit = _this select 0;
_range = _this select 1;
_fired = [];

while {alive _unit} do 
{
   _list = (position _unit) nearObjects ["Default",_range];

if (count _list >=1) then 
{
_ammo = _list select 0;

	if (!(_ammo in _fired)) then
	{
	nul = [_ammo] spawn _fnc_exb;
	_fired = _fired + [_ammo];
	};
};
   sleep 0.01;
};

Share this post


Link to post
Share on other sites

Thanks Falsche9. I was hoping to avoid using loops to check this.

Is there a superclass for explosives, or will I have to make a list of all the explosives and check if it is in there?

Edited by brians200

Share this post


Link to post
Share on other sites

results from config viewer:

configfile >> "CfgAmmo" >> "DemoCharge_Remote_Ammo" = ["PipeBombBase","PipeBombCore","TimeBombCore","Default"]
configfile >> "CfgAmmo" >> "SatchelCharge_Remote_Ammo" = ["PipeBombBase","PipeBombCore","TimeBombCore","Default"]

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

×