Browse Source

Basic setup, script isn't working at moment, need to figure out bugs.

m3ales 4 years ago
parent
commit
4971075c81

+ 3 - 1
addons - Copy/RD501_Main/XEH_postinit.sqf

@@ -5,4 +5,6 @@
 	[] spawn compile preprocessFileLineNumbers 'macro_mod_script_path\jumppack\jumppack.sqf';
 	sleep 0.5;
 	call compile preprocessFileLineNumbers 'macro_mod_script_path\jumppack\jumppack_effects.sqf';
-};
+};
+RD501_FORCE_WALK_WEAPONS = ["RD501_DC_15a_gl_rifle"];
+["weapon", macro_fnc_name(heavyWeaponHandlePlayerWeaponChanged)] call CBA_fnc_addPlayerEventHandler;

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

@@ -82,4 +82,6 @@ call compile preprocessFileLineNumbers 'macro_mod_script_path\add_radio_freq_sho
         call {profileNamespace getVariable ["RD501_MedNotif_Message", "%1 is asking that you kindly hold still."]}
  ] call cba_settings_fnc_init;
  diag_log format["RD501_MedNotif[DEBUG]: %1", "Settings Added"];
-macro_prep_xeh(medical_notification\add_med_notification.sqf,add_med_notification)
+macro_prep_xeh(medical_notification\add_med_notification.sqf,add_med_notification)
+
+macro_prep_xeh(heavy_weapon\fnc_heavyWeaponHandlePlayerWeaponChanged.sqf,heavyWeaponHandlePlayerWeaponChanged)

+ 35 - 0
addons - Copy/RD501_Main/functions/heavy_weapon/fnc_heavyWeaponHandlePlayerWeaponChanged.sqf

@@ -0,0 +1,35 @@
+params ["_unit", "_weapon"];
+systemChat "Handling Weapon Swap";
+if(_weapon == "" && !isForcedWalk _unit) exitWith { systemChat "No Weapon"; };
+
+private _fn_unForceWalk = {
+	params["_target"];
+	systemChat "Unforce Walk";
+	_target setVariable ["RD501_FORCE_WALK", false];
+	_target forceWalk false;
+};
+
+private _forceWalk = _unit getVariable ["RD501_FORCE_WALK", false];
+
+if(_weapon == "" && _forceWalk) exitWith {
+	_unit call _fn_unForceWalk;
+};
+
+private _fn_forceWalk = {
+	params["_target"];
+	systemChat "Force Walk";
+	_target setVariable ["RD501_FORCE_WALK", true];
+	_target forceWalk true;
+};
+
+if(_weapon in RD501_FORCE_WALK_WEAPONS ) exitWith 
+{
+	if(!isForcedWalk _unit) then{
+		_unit call _fn_forceWalk;
+	};
+};
+
+if(_forceWalk) exitWith
+{
+	_unit call _fn_unForceWalk;
+};