diff --git a/Sources/epoch_code/compile/EPOCH_DefuseBomb.sqf b/Sources/epoch_code/compile/EPOCH_DefuseBomb.sqf new file mode 100644 index 00000000..c8eb2288 --- /dev/null +++ b/Sources/epoch_code/compile/EPOCH_DefuseBomb.sqf @@ -0,0 +1,33 @@ +_object = _this; +_type = typeof _object; +if (({alive _x && isplayer _x} count (_object nearentities 6)) > 1) exitwith { + ["You should not defuse Bombs next to other Players!",5] call Epoch_Message; +}; +player playMove 'AinvPknlMstpSnonWrflDnon_medic0'; +player playMove 'AinvPknlMstpSnonWrflDnon_medicEnd'; +_object say3d 'vehicle_repair'; +uisleep 5; +if (alive player && !isnull _object) then { + _reward = gettext (configfile >> "cfgammo" >> _type >> "defaultMagazine"); + if !(_reward isequalto "") then { + _chance = ["CfgEpochClient", "DefuseBombChance", 0.4] call EPOCH_fnc_returnConfigEntryV2; + if (_chance >= ((random 100) / 100)) then { + deletevehicle _object; + _reward call EPOCH_fnc_addItemOverflow; + [format ['Sucessfully defused %1 - You have it now in your Inventory',_reward call Epoch_ItemDisplayName],5] call Epoch_Message; + } + else { + ['Oh No... The Bomb will explode in a few seconds... RUN!!!!',5] call Epoch_Message; + for '_i' from 1 to 6 do { + playSound3D ['a3\sounds_f\air\heli_attack_02\alarm.wss', player, false,getposasl _object, 1, 1, 300]; + uisleep 1; + }; + 'HelicopterExploSmall' createVehicle (position _object); + deletevehicle _object; + }; + } + else { + [format ['Sorry, can not defuse %1',_type],5] call Epoch_Message; + }; +}; + diff --git a/Sources/epoch_code/customs/Defuse.paa b/Sources/epoch_code/customs/Defuse.paa new file mode 100644 index 00000000..ced9ed79 Binary files /dev/null and b/Sources/epoch_code/customs/Defuse.paa differ diff --git a/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_target.hpp b/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_target.hpp index 4f96fc65..d836091b 100644 --- a/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_target.hpp +++ b/Sources/epoch_config/Configs/CfgActionMenu/CfgActionMenu_target.hpp @@ -593,5 +593,12 @@ class ConnectUAV icon = "x\addons\a3_epoch_code\Data\UI\buttons\epoch_UAV.paa"; tooltip = "Connect to UAV"; }; +class Defuse_Bomb +{ + condition = "if (player != vehicle player) exitwith {false};if (player distance dyna_cursorTarget > 3.5) exitwith {false};!((gettext (configfile >> 'cfgammo' >> (typeof dyna_cursorTarget) >> 'defaultMagazine')) isEqualTo '')"; + action = "dyna_cursorTarget spawn Epoch_DefuseBomb"; + icon = "epoch_code\customs\Defuse.paa"; + tooltip = "Defuse Bomb"; +}; diff --git a/Sources/epoch_config/Configs/CfgClientFunctions.hpp b/Sources/epoch_config/Configs/CfgClientFunctions.hpp index 0b53498e..54ed9cfa 100644 --- a/Sources/epoch_config/Configs/CfgClientFunctions.hpp +++ b/Sources/epoch_config/Configs/CfgClientFunctions.hpp @@ -53,6 +53,7 @@ class CfgClientFunctions class AutoRun {}; class DefibrillatorUse {}; class CamUse {}; + class DefuseBomb {}; }; class building { diff --git a/Sources/epoch_config/Configs/CfgEpochClient.hpp b/Sources/epoch_config/Configs/CfgEpochClient.hpp index eccb757f..41058cb5 100644 --- a/Sources/epoch_config/Configs/CfgEpochClient.hpp +++ b/Sources/epoch_config/Configs/CfgEpochClient.hpp @@ -65,6 +65,8 @@ class CfgEpochClient ActionFireOnLighter = "true"; // Lighter is needed to inflame fires ActionBurnBarrelOffExtinguisher = "true"; // FireExtinguisher is needed to put off Burn Barrels ActionHookRope = "true"; // Rope is needed to hook vehicles (get back on release) + + DefuseBombChance = 0.4; // Chance for successfully defuse a bomb -> If fail, the bomb will explode epochMessageBackgroundCol[] = {0,0,0,0.2}; //Epoch_message background color (format: {R,G,B,A}) epochMessageTextCol[] = {1,1,1,0.95}; //Epoch_message text color (format: {R,G,B,A})