lawman_actual 24 Posted August 30, 2017 I seem to be having a little trouble assessing exactly what type of thing a unit has fired using the fired event handler. Basically I want to know if the unit is shooting a gun, shooting a launcher or throwing an item. So far I'm working with something like this, coming from the FIRED event handler: _unit = _this select 0; _weapon = _this select 1; _muzzle = _this select 2; _mode = _this select 3; _ammo = _this select 4; _magazine = _this select 5; _projectile = _this select 6; _vehicle = _this select 7; _muzzleActual = (_unit weaponAccessories currentMuzzle _unit) select 0; And then: _typeOfProjectile = (typeOf _projectile); if (_typeOfProjectile isKindOf ["Grenade",configFile >> "GrenadeCore"]) then {hint "Grenade Thrown"}; _typeOfProjectile = (typeOf _projectile); if (_typeOfProjectile isKindOf ["BulletBase",configFile >> "BulletCore"]) then {hint "Gun Fired"}; _typeOfProjectile = (typeOf _projectile); if (_typeOfProjectile isKindOf ["MissileBase",configFile >> "MissileCore"]) then {hint "Launcher Fired"}; I'm aware i'm probably not using these right; I was just messing around with using either strings or configFile until it stopped giving me errors. The grenade one works just fine, but I'm not getting notified if I fire a launcher or shoot a gun. It might be that it's better to assess the weapon or the magazine or whatever, but the furthest I managed to get so far used this approach. Thanks in advance Law Share this post Link to post Share on other sites
Grumpy Old Man 3545 Posted August 30, 2017 player addEventHandler ["Fired",{ params ["_firer","_weapon"]; _type = getNumber (configfile >> "CfgWeapons" >> _weapon >> "type"); if (_type isEqualTo 0) then {systemchat "Thrown"}; if (_type isEqualTo 1) then {systemchat "Rifle"}; if (_type isEqualTo 2) then {systemchat "Pistol"}; if (_type isEqualTo 3) then {systemchat "No Idea"}; if (_type isEqualTo 4) then {systemchat "Launcher"}; }]; Cheers Share this post Link to post Share on other sites
lawman_actual 24 Posted August 30, 2017 19 minutes ago, Grumpy Old Man said: player addEventHandler ["Fired",{ params ["_firer","_weapon"]; _type = getNumber (configfile >> "CfgWeapons" >> _weapon >> "type"); if (_type isEqualTo 0) then {systemchat "Thrown"}; if (_type isEqualTo 1) then {systemchat "Rifle"}; if (_type isEqualTo 2) then {systemchat "Pistol"}; if (_type isEqualTo 3) then {systemchat "No Idea"}; if (_type isEqualTo 4) then {systemchat "Launcher"}; }]; Cheers I still have much to learn about config files! Had no idea you could do that Thank you kind sir 1 Share this post Link to post Share on other sites