Epoch/Sources/epoch_code/compile/EPOCH_AutoRun.sqf
He-Man 096f03e7b9 AutoRun
- Default Key is "W"
- You can change the key in EPOCH ESC Menu
- If choosen key is same as "moveforward" (default), you have to 2x tap
it, else you only have to 1x tap it
- If your legs are broken, you get a hint "can not autorun - legs are
broken"
- If the terrain is too steep, you only walk in AutoRun
- Inside Water, you can not Autorun
2018-01-18 21:40:18 +01:00

67 lines
1.5 KiB
Plaintext

/*
Author: [Ignatz] He-Man
Contributors:
Description:
Autorun script
Licence:
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
Github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/EPOCH_AutoRun.sqf
*/
private ["_myheight","_nextpos","_newheight"];
// _EPOCH_Autorunspeed is NOT a private variable, it is defined in Masterloop init!
_myheight = (getposasl player) select 2;
_nextpos = player modelToWorld [0,1,0];
_nextpos set [2,0];
_newheight = (atltoasl _nextpos) select 2;
if (surfaceiswater position player || ((getposatl player) select 2) > 0.5) then {
_newheight = _myheight;
};
if (_myheight-_newheight > 0.8 || _myheight-_newheight < -0.6) then {
if (_EPOCH_Autorunspeed != 1) then {
player playActionnow 'PlayerWalkF';
}
else {
player playAction 'PlayerWalkF';
};
_EPOCH_Autorunspeed = 1;
}
else {
if (_myheight-_newheight > 0.5 || _myheight-_newheight < -0.35) then {
if (_EPOCH_Autorunspeed != 2) then {
player playActionnow 'PlayerSlowF';
}
else {
player playAction 'PlayerSlowF';
};
_EPOCH_Autorunspeed = 2;
}
else {
if (getFatigue player < 0.8) then {
if (_EPOCH_Autorunspeed != 3) then {
player playActionnow 'FastF';
}
else {
player playAction 'FastF';
};
_EPOCH_Autorunspeed = 3;
}
else {
if (_EPOCH_Autorunspeed != 2) then {
player playActionnow 'PlayerSlowF';
}
else {
player playAction 'PlayerSlowF';
};
_EPOCH_Autorunspeed = 2;
};
};
};