Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. if (!hasInterface) exitWith {};
  2.  
  3. SL_jumpBaseHeight = 1.8;
  4. SL_jumpMaxHeight = 4.7;
  5. SL_jumpBaseSpeed = 0.5;
  6. SL_jumpAnimation = "AovrPercMrunSrasWrflDf";
  7.  
  8. "SL_fn_jumpOverAnim" addPublicVariableEventHandler {
  9. (_this select 1) spawn SL_fn_doAnim;
  10. };
  11.  
  12. SL_fn_doAnim =
  13. {
  14. params ["_unit","_velocity","_direction","_speed","_height","_anim"];
  15. _unit setVelocity [(_velocity select 0) + (sin _direction * _speed), (_velocity select 1) + (cos _direction * _speed), ((_velocity select 2) * _speed) + _height];
  16. _unit switchMove _anim;
  17. };
  18.  
  19. SL_fn_jumpOver = {
  20. params ["_displayCode","_keyCode","_isShift","_isCtrl","_isAlt"];
  21. _handled = false;
  22. if ((_keyCode in actionKeys "GetOver" && _isShift) && (animationState player != SL_jumpAnimation)) then {
  23. private ["_height","_velocity","_direction","_speed"];
  24. if ((player == vehicle player) && (isTouchingGround player) && ((stance player == "STAND") || (stance player == "CROUCH"))) exitWith
  25. {
  26. _height = (SL_jumpBaseHeight - (load player)) max SL_jumpMaxHeight;
  27. _velocity = velocity player;
  28. _direction = direction player;
  29. _speed = SL_jumpBaseSpeed;
  30. player setVelocity [(_velocity select 0) + (sin _direction * _speed), (_velocity select 1) + (cos _direction * _speed), ((_velocity select 2) * _speed) + _height];
  31. SL_fn_jumpOverAnim = [player,_velocity,_direction,_speed,_height,SL_jumpAnimation];
  32. publicVariable "SL_fn_jumpOverAnim";
  33. if (currentWeapon player == "") then // half working buggy 'fix' for having no weapon in hands (no animation available for it... BIS!!)
  34. {
  35. player switchMove SL_jumpAnimation;
  36. player playMoveNow SL_jumpAnimation;
  37. }
  38. else
  39. {
  40. player switchMove SL_jumpAnimation;
  41. };
  42. _handled = true;
  43. };
  44. };
  45. _handled
  46. };
  47.  
  48. waituntil {!(isNull (findDisplay 46))};
  49. (findDisplay 46) displayAddEventHandler ["KeyDown", "_this call SL_fn_jumpOver;"];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement