Jump to content

Simple AutoRun Script


Drokz

Recommended Posts

Simple AutoRun Script

 

DePbo your mission.epoch folder

Then select epoch_code -> customs -> and open EPOCH_custom_EH_KeyDown.sqf

 

After line 16 (_handled = false;) paste the following code:

Spoiler
  1. /////////////// SimpleAutorun by ShadowRanger24/He-Man/xDrokZ ////////////////
  2.  
  3. if (vehicle player == player) then {
  4.        
  5.     if (_dikCode == 0x0B) then {
  6.    
  7.         if (isNil "AR_active") then {AR_active = false;};
  8.             if (AR_active) exitWith {AR_active = false; _handled = true;};
  9.             If (surfaceiswater (getpos player)) exitWith {AR_active = false; _handled = true;};
  10.  
  11.             AR_active = true;
  12.             AR_weapon = currentWeapon player;
  13.             AR_animation = switch (true) do {
  14.                 case (AR_weapon isEqualTo ""): {"AmovPercMevaSnonWnonDf"};
  15.                 case (AR_weapon isEqualTo (primaryWeapon player)): {"AmovPercMevaSlowWrflDf"};
  16.                 case (AR_weapon isEqualTo (secondaryWeapon player)): {"AmovPercMevaSlowWrflDf"};
  17.                 case (AR_weapon isEqualTo (handgunWeapon player)): {"AmovPercMevaSlowWpstDf"};
  18.             };
  19.  
  20.             player playMoveNow AR_animation;
  21.  
  22.             player addEventHandler ["AnimChanged", {
  23.                 if((!AR_active) || {!((currentWeapon player) isEqualTo AR_activeWep)})exitWith {
  24.                     player removeEventHandler ["AnimChanged", _thisEventHandler];
  25.  
  26.                     AR_weapon = currentWeapon player;
  27.                     AR_animation = switch (true) do {
  28.                         case (AR_weapon isEqualTo ""): {"AmovPercMstpSnonWnonDnon"};
  29.                         case (AR_weapon isEqualTo (primaryWeapon player)): {"AmovPercMstpSlowWrflDnon"};
  30.                         case (AR_weapon isEqualTo (secondaryWeapon player)): {"AmovPercMevaSlowWlnrDf"};
  31.                         case (AR_weapon isEqualTo (handgunWeapon player)): {"AmovPercMstpSlowWpstDnon"};
  32.                     };
  33.  
  34.                     player playMoveNow AR_animation;
  35.  
  36.                     AR_active = false;
  37.                     AR_weapon = nil;
  38.                     AR_animation = nil;
  39.                 };
  40.  
  41.                 player playMove AR_animation;
  42.             }];
  43.         };
  44.     };
  45.  
  46.     ///////////// End Autorun /////////////

 

Save the file and repack your pbo.

Press 0 to use this feature

 

 

This is not a perfect AutoRun script, but it works so far.

Current issues are that it doesn´t stop when you run up a hill, enter vehicles (it continues when you leave the vehicle again) or when you enter water.

It also would be great to make it stop when hitting w,a, s, d or the arrow keys.

I appreciate if anybody knows how to fix those and would like to share.

 

I took it from the BI Forums, changed it a little bit and just wanted to show you how I made it to work with Epoch.

So this is not my work at all.

 

Original post by @oldmatechoc 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Discord

×
×
  • Create New...