mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Work on removing spawned
This commit is contained in:
parent
19c815f779
commit
9224cd0c2a
@ -83,7 +83,7 @@ class CfgAmmo {
|
|||||||
SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70};
|
SmokeShellSoundLoop1[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop1",0.125893,1,70};
|
||||||
SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70};
|
SmokeShellSoundLoop2[] = {"A3\Sounds_F\weapons\smokeshell\smoke_loop2",0.125893,1,70};
|
||||||
timeToLive = 60;
|
timeToLive = 60;
|
||||||
fuseDistance = 2.3; //todo should this be explosionTime
|
fuseDistance = 2.3;
|
||||||
model = PATHTOF(\models\ACE_m84_thrown.p3d);
|
model = PATHTOF(models\ACE_m84_thrown.p3d);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -44,8 +44,8 @@ class CfgMagazines {
|
|||||||
displayname = "$STR_ACE_Grenades_M84_Name";
|
displayname = "$STR_ACE_Grenades_M84_Name";
|
||||||
descriptionshort = "$STR_ACE_Grenades_M84_Description";
|
descriptionshort = "$STR_ACE_Grenades_M84_Description";
|
||||||
displayNameShort = "M84";
|
displayNameShort = "M84";
|
||||||
model = PATHTOF(\models\ACE_m84.p3d);
|
model = PATHTOF(models\ACE_m84.p3d);
|
||||||
picture = PATHTOF(\UI\ACE_m84_x_ca.paa);
|
picture = PATHTOF(UI\ACE_m84_x_ca.paa);
|
||||||
};
|
};
|
||||||
|
|
||||||
class 3Rnd_UGL_FlareGreen_F;
|
class 3Rnd_UGL_FlareGreen_F;
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
PREP(flashbangEffect);
|
PREP(flashbangEffect);
|
||||||
|
PREP(flashbangExplosionEH);
|
||||||
|
PREP(flashbangThrownFuze);
|
||||||
PREP(nextMode);
|
PREP(nextMode);
|
||||||
PREP(throwGrenade);
|
PREP(throwGrenade);
|
||||||
|
|
||||||
|
[QGVAR(flashbangExplosionEvent), { _this call DFUNC(flashbangExplosionEH) }] call EFUNC(common,addNetEventHandler);
|
||||||
|
@ -1,95 +0,0 @@
|
|||||||
/*
|
|
||||||
* Author: KoffeinFlummi
|
|
||||||
*
|
|
||||||
* Creates the flashbang effect locally/knocks out AI units.
|
|
||||||
*
|
|
||||||
* Arguments:
|
|
||||||
* 0: The unit (Object)
|
|
||||||
* 1: The grenade (Object)
|
|
||||||
*
|
|
||||||
* Return Value:
|
|
||||||
* None
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "script_component.hpp"
|
|
||||||
|
|
||||||
_this spawn {
|
|
||||||
_unit = _this select 0;
|
|
||||||
_grenade = _this select 1;
|
|
||||||
|
|
||||||
if (damage _unit >= 1) exitWith {};
|
|
||||||
|
|
||||||
_strength = 1 - ((_unit distance _grenade) min 15) / 15;
|
|
||||||
|
|
||||||
if !(isPlayer _unit) exitWith {
|
|
||||||
_unit disableAI "MOVE";
|
|
||||||
_unit disableAI "ANIM";
|
|
||||||
_unit disableAI "AUTOTARGET";
|
|
||||||
_unit disableAI "TARGET";
|
|
||||||
_unit disableAI "FSM";
|
|
||||||
_unit setSkill (skill _unit / 50);
|
|
||||||
|
|
||||||
sleep (7 * _strength);
|
|
||||||
|
|
||||||
_unit enableAI "MOVE";
|
|
||||||
_unit enableAI "ANIM";
|
|
||||||
_unit enableAI "AUTOTARGET";
|
|
||||||
_unit enableAI "TARGET";
|
|
||||||
_unit enableAI "FSM";
|
|
||||||
_unit setSkill (skill _unit * 50);
|
|
||||||
};
|
|
||||||
|
|
||||||
// is there line of sight to the grenade?
|
|
||||||
_posGrenade = getPosASL _grenade;
|
|
||||||
_posGrenade set [2, (_posGrenade select 2) + 0.2]; // compensate for grenade glitching into ground
|
|
||||||
if (lineIntersects [_posGrenade, getPosASL _unit, _grenade, _unit]) then {
|
|
||||||
_strength = _strength / 10;
|
|
||||||
};
|
|
||||||
|
|
||||||
// beeeeeeeeeeeeeeeeeeeeeeeeeeeeep
|
|
||||||
if (isClass (configFile >> "CfgPatches" >> "ACE_Hearing") and _strength > 0) then {
|
|
||||||
[_unit, 0.5 + (_strength / 2)] call ACE_Hearing_fnc_earRinging;
|
|
||||||
};
|
|
||||||
|
|
||||||
// account for people looking away by slightly
|
|
||||||
// reducing the effect for visual effects.
|
|
||||||
_posUnit = getPos _unit;
|
|
||||||
_posGrenade = getPos _grenade;
|
|
||||||
_angleGrenade = ((_posGrenade select 0) - (_posUnit select 0)) atan2 ((_posGrenade select 1) - (_posUnit select 1));
|
|
||||||
_angleGrenade = (_angleGrenade + 360) % 360;
|
|
||||||
|
|
||||||
_angleView = (eyeDirection player select 0) atan2 (eyeDirection player select 1);
|
|
||||||
_angleView = (_angleView + 360) % 360;
|
|
||||||
|
|
||||||
_angleDiff = 180 - abs (abs (_angleGrenade - _angleView) - 180);
|
|
||||||
_angleDiff = ((_angleDiff - 45) max 0);
|
|
||||||
|
|
||||||
_strength = _strength - _strength * (_angleDiff / 135);
|
|
||||||
|
|
||||||
// create flash to illuminate environment
|
|
||||||
_light = "#lightpoint" createVehicleLocal getPos _grenade;
|
|
||||||
_light setLightBrightness 200;
|
|
||||||
_light setLightAmbient [1,1,1];
|
|
||||||
_light setLightColor [1,1,1];
|
|
||||||
_light setLightDayLight true;
|
|
||||||
|
|
||||||
// blind player
|
|
||||||
if (_strength > 0.1) then {
|
|
||||||
GVAR(flashbangPPEffectCC) ppEffectEnable true;
|
|
||||||
GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,(0.8 + _strength) min 1,[1,1,1,0],[0,0,0,1],[0,0,0,0]];
|
|
||||||
GVAR(flashbangPPEffectCC) ppEffectCommit 0.01;
|
|
||||||
};
|
|
||||||
|
|
||||||
sleep 0.1;
|
|
||||||
deleteVehicle _light;
|
|
||||||
sleep (7 * _strength);
|
|
||||||
|
|
||||||
if (_strength > 0.1) then {
|
|
||||||
GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,0,[1,1,1,0],[0,0,0,1],[0,0,0,0]];
|
|
||||||
GVAR(flashbangPPEffectCC) ppEffectCommit (10 * _strength);
|
|
||||||
|
|
||||||
sleep (10 * _strength);
|
|
||||||
|
|
||||||
GVAR(flashbangPPEffectCC) ppEffectEnable false;
|
|
||||||
};
|
|
||||||
};
|
|
14
addons/grenades/functions/fnc_flashbangEffectStages.sqf
Normal file
14
addons/grenades/functions/fnc_flashbangEffectStages.sqf
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* Author: KoffeinFlummi
|
||||||
|
*
|
||||||
|
* Creates the flashbang effect locally/knocks out AI units.
|
||||||
|
*
|
||||||
|
* Arguments:
|
||||||
|
* 0: The unit (Object)
|
||||||
|
* 1: The grenade (Object)
|
||||||
|
*
|
||||||
|
* Return Value:
|
||||||
|
* None
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "script_component.hpp"
|
89
addons/grenades/functions/fnc_flashbangExplosionEH.sqf
Normal file
89
addons/grenades/functions/fnc_flashbangExplosionEH.sqf
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
#include "script_component.hpp"
|
||||||
|
|
||||||
|
#define EFFECT_STAGE_RESETAI 0
|
||||||
|
#define EFFECT_STAGE_DELETELIGHT 1
|
||||||
|
|
||||||
|
_unit = _this select 0;
|
||||||
|
_grenade = _this select 1;
|
||||||
|
|
||||||
|
if (!local _unit) exitWith {};
|
||||||
|
if (!alive _unit) exitWith {};
|
||||||
|
if (damage _unit >= 1) exitWith {};
|
||||||
|
|
||||||
|
_strength = 1 - ((_unit distance _grenade) min 15) / 15;
|
||||||
|
|
||||||
|
if (_unit != ACE_player) exitWith {
|
||||||
|
//must be AI
|
||||||
|
_unit disableAI "MOVE";
|
||||||
|
_unit disableAI "ANIM";
|
||||||
|
_unit disableAI "AUTOTARGET";
|
||||||
|
_unit disableAI "TARGET";
|
||||||
|
_unit disableAI "FSM";
|
||||||
|
_unit setSkill (skill _unit / 50);
|
||||||
|
|
||||||
|
sleep (7 * _strength);
|
||||||
|
|
||||||
|
_unit enableAI "MOVE";
|
||||||
|
_unit enableAI "ANIM";
|
||||||
|
_unit enableAI "AUTOTARGET";
|
||||||
|
_unit enableAI "TARGET";
|
||||||
|
_unit enableAI "FSM";
|
||||||
|
_unit setSkill (skill _unit * 50);
|
||||||
|
};
|
||||||
|
|
||||||
|
// is there line of sight to the grenade?
|
||||||
|
_posGrenade = getPosASL _grenade;
|
||||||
|
_posGrenade set [2, (_posGrenade select 2) + 0.2]; // compensate for grenade glitching into ground
|
||||||
|
if (lineIntersects [_posGrenade, getPosASL _unit, _grenade, _unit]) then {
|
||||||
|
_strength = _strength / 10;
|
||||||
|
};
|
||||||
|
|
||||||
|
// beeeeeeeeeeeeeeeeeeeeeeeeeeeeep
|
||||||
|
if (isClass (configFile >> "CfgPatches" >> "ACE_Hearing") and _strength > 0) then {
|
||||||
|
[_unit, 0.5 + (_strength / 2)] call EFUNC(hearing,earRinging);
|
||||||
|
};
|
||||||
|
|
||||||
|
// account for people looking away by slightly
|
||||||
|
// reducing the effect for visual effects.
|
||||||
|
_posUnit = getPos _unit;
|
||||||
|
_posGrenade = getPos _grenade;
|
||||||
|
_angleGrenade = ((_posGrenade select 0) - (_posUnit select 0)) atan2 ((_posGrenade select 1) - (_posUnit select 1));
|
||||||
|
_angleGrenade = (_angleGrenade + 360) % 360;
|
||||||
|
|
||||||
|
_angleView = (eyeDirection player select 0) atan2 (eyeDirection player select 1);
|
||||||
|
_angleView = (_angleView + 360) % 360;
|
||||||
|
|
||||||
|
_angleDiff = 180 - abs (abs (_angleGrenade - _angleView) - 180);
|
||||||
|
_angleDiff = ((_angleDiff - 45) max 0);
|
||||||
|
|
||||||
|
_strength = _strength - _strength * (_angleDiff / 135);
|
||||||
|
|
||||||
|
// create flash to illuminate environment
|
||||||
|
_light = "#lightpoint" createVehicleLocal getPos _grenade;
|
||||||
|
_light setLightBrightness 200;
|
||||||
|
_light setLightAmbient [1,1,1];
|
||||||
|
_light setLightColor [1,1,1];
|
||||||
|
_light setLightDayLight true;
|
||||||
|
|
||||||
|
// blind player
|
||||||
|
if (_strength > 0.1) then {
|
||||||
|
GVAR(flashbangPPEffectCC) ppEffectEnable true;
|
||||||
|
GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,(0.8 + _strength) min 1,[1,1,1,0],[0,0,0,1],[0,0,0,0]];
|
||||||
|
GVAR(flashbangPPEffectCC) ppEffectCommit 0.01;
|
||||||
|
};
|
||||||
|
|
||||||
|
[] spawn {
|
||||||
|
sleep 0.1;
|
||||||
|
deleteVehicle _light;
|
||||||
|
};
|
||||||
|
|
||||||
|
sleep (7 * _strength);
|
||||||
|
|
||||||
|
if (_strength > 0.1) then {
|
||||||
|
GVAR(flashbangPPEffectCC) ppEffectAdjust [1,1,0,[1,1,1,0],[0,0,0,1],[0,0,0,0]];
|
||||||
|
GVAR(flashbangPPEffectCC) ppEffectCommit (10 * _strength);
|
||||||
|
|
||||||
|
sleep (10 * _strength);
|
||||||
|
|
||||||
|
GVAR(flashbangPPEffectCC) ppEffectEnable false;
|
||||||
|
};
|
@ -1,3 +1,5 @@
|
|||||||
|
//Waits for the grenade fuze to trigger and 'explode'
|
||||||
|
|
||||||
#include "script_component.hpp"
|
#include "script_component.hpp"
|
||||||
|
|
||||||
_projectile = (_this select 0) select 0;
|
_projectile = (_this select 0) select 0;
|
||||||
@ -14,6 +16,6 @@ if (alive _projectile) then {
|
|||||||
_affected = _projectile nearEntities ["CAManBase", 50];
|
_affected = _projectile nearEntities ["CAManBase", 50];
|
||||||
{
|
{
|
||||||
// [[_x, _projectile], "ACE_Grenades_fnc_flashbangEffect", _x] call ACE_Core_fnc_execRemoteFnc;
|
// [[_x, _projectile], "ACE_Grenades_fnc_flashbangEffect", _x] call ACE_Core_fnc_execRemoteFnc;
|
||||||
// [[_x, _projectile], "ACE_Grenades_fnc_flashbangEffect", _x] call ACE_Core_fnc_execRemoteFnc;
|
[QGVAR(flashbangExplosionEvent), [_x, _projectile]] call EFUNC(common,globalEvent);
|
||||||
} forEach _affected;
|
} forEach _affected;
|
||||||
};
|
};
|
@ -55,7 +55,7 @@ if (_mode != 0) then {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (typeOf _projectile == "ACE_G_M84") then {
|
if (typeOf _projectile == "ACE_G_M84") then {
|
||||||
// _fuzeTime = (configFile >> "CfgAmmo" >> typeOf _projectile >> "fuseDistance");
|
_fuzeTime = getNumber (configFile >> "CfgAmmo" >> typeOf _projectile >> "fuseDistance");
|
||||||
_fuzeTime = (configFile >> "CfgAmmo" >> typeOf _projectile >> "explosionTime"); //@toDo pretty sure this should be explosionTime not fuseDistance
|
// _fuzeTime = getNumber (configFile >> "CfgAmmo" >> typeOf _projectile >> "explosionTime"); //@toDo pretty sure this should be explosionTime not fuseDistance
|
||||||
[FUNC(flashbangThrownFuze), 0, [_projectile, (time + _fuzeTime)]] call CBA_fnc_addPerFrameHandler;
|
[FUNC(flashbangThrownFuze), 0, [_projectile, (time + _fuzeTime)]] call CBA_fnc_addPerFrameHandler;
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user