Browse Source

add surrender stun system;

thefloff 4 years ago
parent
commit
faea036c9b

+ 4 - 1
addons - Copy/RD501_Main/XEH_preInit.sqf

@@ -116,4 +116,7 @@ macro_prep_xeh(external_reload\fnc_reloadExternal.sqf,reloadExternal)
 macro_prep_xeh(external_reload\fnc_onReloadExternalHandler.sqf,onReloadExternalHandler)
 
 // Heal Nearby
-macro_prep_xeh(heal_nearby\fnc_healAllNearby.sqf,healAllNearby)
+macro_prep_xeh(heal_nearby\fnc_healAllNearby.sqf,healAllNearby)
+
+// stun
+macro_prep_xeh(stun\stun.sqf,stun)

+ 1 - 0
addons - Copy/RD501_Main/config.cpp

@@ -679,6 +679,7 @@ class CfgVehicles
 			killed="(_this select 0) setVariable ['GEARF_HelmetAttached', false]; (_this select 0) setVariable ['GEARF_HelmetAttachedClass','']; (_this select 0) setVariable ['GEARF_HelmetAdditionalClass',''];";
 			getInMan="[(_this select 0), true] call GEARF_fnc_hideSlungHelmet";
 			getOutMan="[(_this select 0), false] call GEARF_fnc_hideSlungHelmet;";
+			hit="[(_this select 0), (_this select 1), (_this select 3)] call RD501_fnc_stun";
 		};
 	};
 };

+ 16 - 0
addons - Copy/RD501_Main/functions/stun/stun.sqf

@@ -0,0 +1,16 @@
+params ["_unit", "_source", "_instigator"];
+
+{
+	private _mag = currentMagazine _source;
+	private _ammo = (configFile >> "CfgMagazines" >> _mag >> "ammo") call BIS_fnc_getCfgData;
+	private _stunDuration = (configFile >> "CfgAmmo" >> _ammo >> "RD501_stunDuration") call BIS_fnc_getCfgData;
+
+	if (_stunDuration > 0.0) then
+	{
+		["ace_captives_setSurrendered" ,[_unit, true]] call CBA_fnc_globalEvent;
+		[{
+			["ace_captives_setSurrendered", [_this select 0, false]] call CBA_fnc_globalEvent;
+		}, [_unit], _stunDuration] call CBA_fnc_waitAndExecute;
+
+	};
+} remoteExec ['call', _instigator];