-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJump.sqf
More file actions
50 lines (45 loc) · 2.01 KB
/
Jump.sqf
File metadata and controls
50 lines (45 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//By Soulkobk at https://github.com/soulkobk/ArmA_Scripts/blob/master/playerJump/playerJump.sqf
If (!hasinterface) exitwith {}; //If you don't have an interface, do nothing.
Jumpbase = 1.00; //Jump at least this high.
Jumpmax = 2.00; //Jump this high if not encumbered.
Jumpspeed = 0.50; //Forward distance of jump.
Jumpact = "AovrPercMrunSrasWrflDf"; //This is the animation.
"FN_jumpact" addpublicvariableeventhandler { //Create a public varable event handler.
(_this select 1) spawn FN_dojump; //This is the part that triggers the event.
};
FN_dojump =
{
params ["_unit","_velocity","_direction","_speed","_height","_anim"];
_unit setvelocity [(_velocity select 0) + (sin _direction * _speed), (_velocity select 1) + (cos _direction * _speed), ((_velocity select 2) * _speed) + _height];
_unit switchmove _anim;
};
FN_jump = {
params ["_displaycode","_keycode","_isshift","_isctrl","_isalt"];
_handled = false;
if ((_keycode in actionkeys "getover" && _isshift) && (animationState player != jumpact)) then {
private ["_height","_velocity","_direction","_speed"];
if ((player == vehicle player) && (istouchingground player) && ((stance player == "STAND") || (stance player == "CROUCH"))) exitwith
{
_height = (jumpbase - (load player)) max jumpmax;
_velocity = velocity player;
_direction = direction player;
_speed = jumpspeed;
player setvelocity [(_velocity select 0) + (sin _direction * _speed), (_velocity select 1) + (cos _direction * _speed), ((_velocity select 2) * _speed) + _height];
FN_jumpact = [player,_velocity,_direction,_speed,_height,jumpact];
publicvariable "FN_jumpact";
if (currentweapon player == "") then // half working buggy 'fix' for having no weapon in hands (no animation available for it... BIS!!)
{
player switchmove jumpact;
player playmovenow jumpact;
}
else
{
player switchmove jumpact;
};
_handled = true;
};
};
_handled
};
waituntil {!(isnull (finddisplay 46))};
(finddisplay 46) displayaddeventhandler ["Keydown", "_this call FN_jump;"];