mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
parent
4612652f8c
commit
7fc84c60dd
@ -3,28 +3,29 @@
|
|||||||
* Creates the flashbang effect and knock out AI units.
|
* Creates the flashbang effect and knock out AI units.
|
||||||
*
|
*
|
||||||
* Arguments:
|
* Arguments:
|
||||||
* 0: The grenade <OBJECT>
|
* 0: The flashBang position ASL <ARRAY>
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* None
|
* None
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* [theGrenade] call ace_grenades_fnc_flashbangExplosionEH
|
* [[0,0,0]] call ace_grenades_fnc_flashbangExplosionEH
|
||||||
*
|
*
|
||||||
* Public: No
|
* Public: No
|
||||||
*/
|
*/
|
||||||
#include "script_component.hpp"
|
#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 {
|
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 {
|
if (_x != ACE_player) then {
|
||||||
//must be AI
|
//must be AI
|
||||||
@ -45,13 +46,12 @@ private _affected = _grenade nearEntities ["CAManBase", 20];
|
|||||||
} else {
|
} else {
|
||||||
//Do effects for player
|
//Do effects for player
|
||||||
// is there line of sight to the grenade?
|
// is there line of sight to the grenade?
|
||||||
private _posGrenade = getPosASL _grenade;
|
|
||||||
private _eyePos = eyePos ACE_player; //PositionASL
|
private _eyePos = eyePos ACE_player; //PositionASL
|
||||||
_posGrenade set [2, (_posGrenade select 2) + 0.2]; // compensate for grenade glitching into ground
|
_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)
|
//Check for line of sight (check 4 points in case grenade is stuck in an object or underground)
|
||||||
private _losCount = {
|
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]];
|
} 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);
|
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
|
// create flash to illuminate environment
|
||||||
private _light = "#lightpoint" createVehicleLocal getPos _grenade;
|
private _light = "#lightpoint" createVehicleLocal _grenadePosASL;
|
||||||
|
_light setPosASL _grenadePosASL;
|
||||||
|
|
||||||
_light setLightBrightness 200;
|
_light setLightBrightness 200;
|
||||||
_light setLightAmbient [1,1,1];
|
_light setLightAmbient [1,1,1];
|
||||||
|
@ -16,11 +16,13 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
params ["_projectile"];
|
params ["_projectile"];
|
||||||
|
TRACE_1("params",_projectile);
|
||||||
|
|
||||||
if (alive _projectile) then {
|
if (alive _projectile) then {
|
||||||
playSound3D ["A3\Sounds_F\weapons\Explosion\explosion_mine_1.wss", _projectile, false, getPosASL _projectile, 5, 1.2, 400];
|
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);
|
||||||
};
|
};
|
||||||
|
@ -37,7 +37,7 @@ if (local _unit) then {
|
|||||||
if (getNumber (_config >> QGVAR(flashbang)) == 1) then {
|
if (getNumber (_config >> QGVAR(flashbang)) == 1) then {
|
||||||
private _fuzeTime = getNumber (_config >> "explosionTime");
|
private _fuzeTime = getNumber (_config >> "explosionTime");
|
||||||
|
|
||||||
[FUNC(flashbangThrownFuze), [_projectile], _fuzeTime, 0] call EFUNC(common,waitAndExecute);
|
[FUNC(flashbangThrownFuze), [_projectile], _fuzeTime] call EFUNC(common,waitAndExecute);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user