diff --git a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf index 06466c70d4..20f75e2714 100644 --- a/addons/grenades/functions/fnc_flashbangExplosionEH.sqf +++ b/addons/grenades/functions/fnc_flashbangExplosionEH.sqf @@ -3,28 +3,29 @@ * Creates the flashbang effect and knock out AI units. * * Arguments: - * 0: The grenade + * 0: The flashBang position ASL * * Return Value: * None * * Example: - * [theGrenade] call ace_grenades_fnc_flashbangExplosionEH + * [[0,0,0]] call ace_grenades_fnc_flashbangExplosionEH * * Public: No */ #include "script_component.hpp" -params ["_grenade"]; +params ["_grenadePosASL"]; +TRACE_1("params",_grenadePosASL); -private _affected = _grenade nearEntities ["CAManBase", 20]; +private _affected = (ASLtoAGL _grenadePosASL) nearEntities ["CAManBase", 20]; { if (local _x && {alive _x}) then { - private _strength = 1 - ((_x distance _grenade) min 15) / 15; + private _strength = 1 - (((getPosASL _x) vectorDistance _grenadePosASL) min 15) / 15; - TRACE_3("FlashBangEffect Start",_x,(_x distance _grenade),_strength); + TRACE_3("FlashBangEffect Start",_x,((getPosASL _x) vectorDistance _grenadePosASL),_strength); if (_x != ACE_player) then { //must be AI @@ -45,13 +46,12 @@ private _affected = _grenade nearEntities ["CAManBase", 20]; } else { //Do effects for player // is there line of sight to the grenade? - private _posGrenade = getPosASL _grenade; private _eyePos = eyePos ACE_player; //PositionASL _posGrenade set [2, (_posGrenade select 2) + 0.2]; // compensate for grenade glitching into ground //Check for line of sight (check 4 points in case grenade is stuck in an object or underground) private _losCount = { - !lineIntersects [_posGrenade vectorAdd _x, _eyePos, _grenade, ACE_player] + !lineIntersects [_grenadePosASL vectorAdd _x, _eyePos, ACE_player] } count [[0,0,0], [0,0,0.2], [0.1, 0.1, 0.1], [-0.1, -0.1, 0.1]]; TRACE_1("Line of sight count (out of 4)",_losCount); @@ -83,7 +83,8 @@ private _affected = _grenade nearEntities ["CAManBase", 20]; }; // create flash to illuminate environment - private _light = "#lightpoint" createVehicleLocal getPos _grenade; + private _light = "#lightpoint" createVehicleLocal _grenadePosASL; + _light setPosASL _grenadePosASL; _light setLightBrightness 200; _light setLightAmbient [1,1,1]; diff --git a/addons/grenades/functions/fnc_flashbangThrownFuze.sqf b/addons/grenades/functions/fnc_flashbangThrownFuze.sqf index ef6224f8ce..9c92f84508 100644 --- a/addons/grenades/functions/fnc_flashbangThrownFuze.sqf +++ b/addons/grenades/functions/fnc_flashbangThrownFuze.sqf @@ -16,11 +16,13 @@ #include "script_component.hpp" params ["_projectile"]; +TRACE_1("params",_projectile); if (alive _projectile) then { playSound3D ["A3\Sounds_F\weapons\Explosion\explosion_mine_1.wss", _projectile, false, getPosASL _projectile, 5, 1.2, 400]; - private _affected = _projectile nearEntities ["CAManBase", 50]; + private _affected = _projectile nearEntities ["CAManBase", 20]; + TRACE_2("people hit",_affected,getPosASL _projectile); - ["flashbangExplosion", _affected, [_projectile]] call EFUNC(common,targetEvent); + ["flashbangExplosion", _affected, [getPosASL _projectile]] call EFUNC(common,targetEvent); }; diff --git a/addons/grenades/functions/fnc_throwGrenade.sqf b/addons/grenades/functions/fnc_throwGrenade.sqf index e66498a854..1d7d470b80 100644 --- a/addons/grenades/functions/fnc_throwGrenade.sqf +++ b/addons/grenades/functions/fnc_throwGrenade.sqf @@ -37,7 +37,7 @@ if (local _unit) then { if (getNumber (_config >> QGVAR(flashbang)) == 1) then { private _fuzeTime = getNumber (_config >> "explosionTime"); - [FUNC(flashbangThrownFuze), [_projectile], _fuzeTime, 0] call EFUNC(common,waitAndExecute); + [FUNC(flashbangThrownFuze), [_projectile], _fuzeTime] call EFUNC(common,waitAndExecute); }; };