fnc_heavyWeaponHandlePlayerWeaponChanged.sqf 772 B

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