fnc_heavyWeaponHandlePlayerWeaponChanged.sqf 932 B

12345678910111213141516171819202122232425262728293031323334353637
  1. params ["_unit", "_weapon"];
  2. systemChat "Handling Weapon Swap";
  3. if(_weapon == "" && !isForcedWalk _unit) exitWith { systemChat "No Weapon"; };
  4. systemChat _weapon + " :: " + _unit;
  5. private _fn_unForceWalk = {
  6. params["_target"];
  7. systemChat "Unforce Walk";
  8. _target setVariable ["RD501_FORCE_WALK", false];
  9. _target forceWalk false;
  10. };
  11. private _forceWalk = _unit getVariable ["RD501_FORCE_WALK", false];
  12. systemChat "Checking _forceWalk :: " + _forceWalk;
  13. if(_weapon == "" && _forceWalk) exitWith {
  14. _unit call _fn_unForceWalk;
  15. };
  16. private _fn_forceWalk = {
  17. params["_target"];
  18. systemChat "Force Walk";
  19. _target setVariable ["RD501_FORCE_WALK", true];
  20. _target forceWalk true;
  21. };
  22. systemChat "Weapon in array :: " + (_weapon in RD501_FORCE_WALK_WEAPONS);
  23. if(_weapon in RD501_FORCE_WALK_WEAPONS) exitWith
  24. {
  25. if(!isForcedWalk _unit) then{
  26. _unit call _fn_forceWalk;
  27. };
  28. };
  29. if(_forceWalk) exitWith
  30. {
  31. _unit call _fn_unForceWalk;
  32. };